mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 06:28:51 +00:00
* 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
76 lines
1.7 KiB
TypeScript
76 lines
1.7 KiB
TypeScript
import React from 'react';
|
|
import {
|
|
ListItemIcon,
|
|
ListItemText,
|
|
Slide,
|
|
makeStyles,
|
|
Paper,
|
|
} from '@material-ui/core';
|
|
import { List } from './List';
|
|
import { ListItem } from './ListItem';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
const useStyles = makeStyles((theme) => ({
|
|
root: {
|
|
borderTop: '1px solid',
|
|
borderColor: theme.palette.primary.main,
|
|
width: '100%',
|
|
position: 'absolute',
|
|
bottom: 0,
|
|
zIndex: 2,
|
|
},
|
|
}));
|
|
|
|
interface IContextMenuOption {
|
|
onClick(e, option): void;
|
|
label: string;
|
|
description?: string;
|
|
selected?: boolean;
|
|
icon?: React.ReactNode;
|
|
key?: string;
|
|
};
|
|
|
|
interface IContextMenuProps {
|
|
open: boolean;
|
|
onClose(): void;
|
|
options: Array<IContextMenuOption>;
|
|
}
|
|
|
|
export const ContextMenu = ({ open, onClose, options }: IContextMenuProps) => {
|
|
const classes = useStyles();
|
|
const { t } = useTranslation();
|
|
|
|
const _options = onClose
|
|
? [
|
|
...options,
|
|
{
|
|
label: t('GENERIC_CLOSE'),
|
|
onClick: onClose,
|
|
} as IContextMenuOption,
|
|
]
|
|
: options;
|
|
|
|
return (
|
|
<Slide direction='up' in={open} mountOnEnter unmountOnExit>
|
|
<Paper square className={classes.root}>
|
|
<List disablePadding>
|
|
{_options.map((option) => (
|
|
<ListItem
|
|
selected={option.selected}
|
|
key={option.key || option.label}
|
|
button
|
|
onClick={(e) => {
|
|
option.onClick(e, option);
|
|
onClose();
|
|
}}
|
|
>
|
|
{option.icon && <ListItemIcon >{option.icon}</ListItemIcon>}
|
|
<ListItemText primary={option.label} secondary={option.description} />
|
|
</ListItem>
|
|
))}
|
|
</List>
|
|
</Paper>
|
|
</Slide>
|
|
);
|
|
};
|