Fix alerts overflow and improve message-bubble style

This commit is contained in:
J Francisco Rader committed 2021-02-21 13:03:19 -05:00
1 parent 9f04ac3243
commit bf7d94b33d
2 files changed
+32 -6

No files matched your search

@@ -12,9 +12,11 @@ const useStyles = makeStyles((theme) => ({
mySms: {
float: 'right',
margin: theme.spacing(1),
padding: '6px 12px',
padding: '6px 16px',
height: 'auto',
width: '80%',
width: 'auto',
minWidth: '60%',
maxWidth: '85%',
background: theme.palette.background.default,
color: theme.palette.text.primary,
borderRadius: '20px',
@@ -24,7 +26,9 @@ const useStyles = makeStyles((theme) => ({
float: 'left',
margin: theme.spacing(1),
padding: '6px 12px',
width: '80%',
width: 'auto',
minWidth: '60%',
maxWidth: '85%',
height: 'auto',
background: theme.palette.primary.light,
color: theme.palette.getContrastText(theme.palette.primary.light),
@@ -62,7 +66,7 @@ export const MessageBubble = ({
<div>{message.message}</div>
)}
</Box>
<Box textAlign='right'>
<Box>
<Typography variant='subtitle1' color='secondary'>
{isGroupChat && !message.isMine
? message.display || message.phone_number
+24 -2
View File
@@ -1,8 +1,30 @@
import React from 'react';
import MuiAlert from '@material-ui/lab/Alert';
import { makeStyles, Typography } from '@material-ui/core';
export function Alert(props) {
return <MuiAlert style={{ zIndex: 10000 }} elevation={6} variant='filled' {...props} />;
const useStyles = makeStyles({
root: {
zIndex: 10000,
},
msg: {
maxWidth: '300px',
wordWrap: 'break-word',
fontSize: '1em'
},
});
export function Alert({ children, ...props }) {
const classes = useStyles();
return (
<MuiAlert
className={classes.root}
elevation={6}
variant='filled'
{...props}
>
<Typography className={classes.msg}>{children}</Typography>
</MuiAlert>
);
}
export default Alert;