Task/improve hardcoded styles and types (#107)

* Add working notifications with only twitter for now

* feat(notification-bar): I didnt copy from NP

* feat(notifications): Collapse when no more notifications after closing one

* Improve overall messages styling code

* Improve Routing performance

* improve use keyboard hook

* Remove unused returns

* Button hover color :)

* Button hover color :) x2

* Added hover style to containedPrimary msg btn

* Replace custom components for custom theme providers for Messages and Contacts apps

* Improve createAppThemeProvider

* Improve createAppThemeProvider

* Final housekeeping for messages styles

* Change placeholder to label in Contacts app text fields

* Fix alerts style with navigation and fix calc copy alerrt

* Split Phone code for snackbar

* Add more options and style Context Menu

* Enable Sellout theme provider and make it work with light themes
This commit is contained in:
J Francisco Rader authored and GitHub committed 2021-02-21 12:41:25 -05:00
1 parent 75e23b783c
commit 4acb214ec9
56 files changed
+738 -578

No files matched your search

@@ -0,0 +1,75 @@
import { Box, makeStyles, Paper, Typography } from '@material-ui/core';
import React from 'react';
import { Message } from '../../../../common/typings/messages';
const useStyles = makeStyles((theme) => ({
imageMessage: {
width: '80%',
maxWidth: '80%',
height: '80%',
maxHeight: '80%',
},
mySms: {
float: 'right',
margin: theme.spacing(1),
padding: '6px 12px',
height: 'auto',
width: '80%',
background: theme.palette.background.default,
color: theme.palette.text.primary,
borderRadius: '20px',
textOverflow: 'ellipsis',
},
sms: {
float: 'left',
margin: theme.spacing(1),
padding: '6px 12px',
width: '80%',
height: 'auto',
background: theme.palette.primary.light,
color: theme.palette.getContrastText(theme.palette.primary.light),
borderRadius: '15px',
textOverflow: 'ellipsis',
},
}));
const isImage = (url) => {
return /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|png|jpeg|gif)/g.test(url);
};
export const MessageBubble = ({
message,
isGroupChat,
}: {
message: Message;
isGroupChat: boolean;
}) => {
const classes = useStyles();
return (
<div>
<Paper
className={message.isMine ? classes.mySms : classes.sms}
variant='outlined'
>
<Box>
{isImage(message.message) ? (
<img
src={message.message}
className={classes.imageMessage}
alt='multimedia'
/>
) : (
<div>{message.message}</div>
)}
</Box>
<Box textAlign='right'>
<Typography variant='subtitle1' color='secondary'>
{isGroupChat && !message.isMine
? message.display || message.phone_number
: null}
</Typography>
</Box>
</Paper>
</div>
);
};