From bf7d94b33dc1adb5ea51e73317153220276d4fe5 Mon Sep 17 00:00:00 2001 From: J Francisco Rader Date: Sun, 21 Feb 2021 13:03:19 -0500 Subject: [PATCH] Fix alerts overflow and improve message-bubble style --- .../components/modal/MessageBubble.tsx | 12 ++++++--- phone/src/ui/components/Alert.tsx | 26 +++++++++++++++++-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/phone/src/apps/messages/components/modal/MessageBubble.tsx b/phone/src/apps/messages/components/modal/MessageBubble.tsx index de52d8a..a4ebebd 100644 --- a/phone/src/apps/messages/components/modal/MessageBubble.tsx +++ b/phone/src/apps/messages/components/modal/MessageBubble.tsx @@ -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 = ({
{message.message}
)} - + {isGroupChat && !message.isMine ? message.display || message.phone_number diff --git a/phone/src/ui/components/Alert.tsx b/phone/src/ui/components/Alert.tsx index 697fb4c..edfd7f7 100644 --- a/phone/src/ui/components/Alert.tsx +++ b/phone/src/ui/components/Alert.tsx @@ -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 ; +const useStyles = makeStyles({ + root: { + zIndex: 10000, + }, + msg: { + maxWidth: '300px', + wordWrap: 'break-word', + fontSize: '1em' + }, +}); + +export function Alert({ children, ...props }) { + const classes = useStyles(); + return ( + + {children} + + ); } export default Alert;