mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Add status button | Revert white icons
This commit is contained in:
7 files changed
+109
-44
No files matched your search
@@ -15,6 +15,7 @@ import useStyles from './modal.styles';
|
||||
import Nui from '../../../os/nui-events/utils/Nui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { StatusButton } from '../../../ui/components/StatusButton';
|
||||
|
||||
export const NoteModal = () => {
|
||||
const classes = useStyles();
|
||||
@@ -99,35 +100,48 @@ export const NoteModal = () => {
|
||||
}
|
||||
/>
|
||||
<Typography paragraph>{detail.content.length}/250</Typography>
|
||||
{!detail.id && (
|
||||
<Button
|
||||
color='primary'
|
||||
variant='contained'
|
||||
disabled={detail.title.length > 0 ? false : true}
|
||||
className={classes.saveButton}
|
||||
onClick={handleNoteSave}
|
||||
>
|
||||
{t('GENERIC_SAVE')}
|
||||
</Button>
|
||||
)}
|
||||
{!!detail.id && (
|
||||
{!detail.id ? (
|
||||
<>
|
||||
<Button
|
||||
color='primary'
|
||||
variant='contained'
|
||||
className={classes.updateButton}
|
||||
onClick={handleUpdateNote}
|
||||
>
|
||||
{t('GENERIC_UPDATE')}
|
||||
</Button>
|
||||
<Button
|
||||
color='secondary'
|
||||
variant='contained'
|
||||
className={classes.deleteButton}
|
||||
onClick={handleDeleteNote}
|
||||
>
|
||||
{t('GENERIC_DELETE')}
|
||||
</Button>
|
||||
<Box display="inline" p={1}>
|
||||
<Button
|
||||
color='primary'
|
||||
variant='contained'
|
||||
disabled={detail.title.length > 0 ? false : true}
|
||||
onClick={handleNoteSave}
|
||||
>
|
||||
{t('GENERIC_SAVE')}
|
||||
</Button>
|
||||
</Box>
|
||||
<Box display="inline" p={1}>
|
||||
<StatusButton
|
||||
color='error'
|
||||
variant='contained'
|
||||
onClick={_handleClose}
|
||||
>
|
||||
{t('GENERIC_CANCEL')}
|
||||
</StatusButton>
|
||||
</Box>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Box display="inline" p={1}>
|
||||
<Button
|
||||
color='primary'
|
||||
variant='contained'
|
||||
onClick={handleUpdateNote}
|
||||
>
|
||||
{t('GENERIC_UPDATE')}
|
||||
</Button>
|
||||
</Box>
|
||||
<Box display="inline" p={1}>
|
||||
<StatusButton
|
||||
color='error'
|
||||
variant='contained'
|
||||
onClick={handleDeleteNote}
|
||||
>
|
||||
{t('GENERIC_DELETE')}
|
||||
</StatusButton>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
@@ -4,7 +4,7 @@ const useStyles = makeStyles((theme) => ({
|
||||
modalRoot: {
|
||||
zIndex: 20,
|
||||
position: 'absolute',
|
||||
height: '100%',
|
||||
height: '99%',
|
||||
width: '100%',
|
||||
background: theme.palette.background.default,
|
||||
},
|
||||
@@ -16,17 +16,7 @@ const useStyles = makeStyles((theme) => ({
|
||||
},
|
||||
inputPropsContent: {
|
||||
fontSize: 20,
|
||||
lineHeight: 1.2
|
||||
},
|
||||
saveButton: {
|
||||
padding: '10px 30px',
|
||||
},
|
||||
updateButton: {
|
||||
padding: '10px 30px',
|
||||
marginRight: '8px',
|
||||
},
|
||||
deleteButton: {
|
||||
padding: '10px 30px',
|
||||
lineHeight: 1.2,
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { common, yellow } from "@material-ui/core/colors";
|
||||
|
||||
export const NOTES_APP_PRIMARY_COLOR = yellow[800];
|
||||
export const NOTES_APP_ICON_COLOR = common.white;
|
||||
export const NOTES_APP_TEXT_COLOR = common.black;
|
||||
|
||||
const theme = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { common, red } from "@material-ui/core/colors";
|
||||
|
||||
export const SELLOUT_APP_PRIMARY_COLOR = red[500];
|
||||
export const SELLOUT_APP_ICON_COLOR = common.white;
|
||||
export const SELLOUT_APP_TEXT_COLOR = common.black;
|
||||
|
||||
const theme = {
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
"GENERIC_UPDATE": "Update",
|
||||
"GENERIC_DELETE": "Delete",
|
||||
"GENERIC_CLOSE": "Close",
|
||||
"GENERIC_CANCEL": "Cancel",
|
||||
"GENERIC_TITLE": "Title",
|
||||
"GENERIC_CONTENT": "Content"
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import { SelloutApp } from '../../../apps/sellout/components/SelloutApp';
|
||||
import { NotesApp } from '../../../apps/notes/NotesApp';
|
||||
import CameraApp from '../../../apps/camera/components/CameraApp';
|
||||
import { AppRoute } from '../components/AppRoute';
|
||||
|
||||
import {
|
||||
MESSAGES_APP_PRIMARY_COLOR,
|
||||
MESSAGES_APP_TEXT_COLOR,
|
||||
@@ -41,8 +42,8 @@ import {
|
||||
CONTACTS_APP_PRIMARY_COLOR,
|
||||
CONTACTS_APP_TEXT_COLOR,
|
||||
} from '../../../apps/contacts/contacts.theme';
|
||||
import { SELLOUT_APP_PRIMARY_COLOR, SELLOUT_APP_TEXT_COLOR } from '../../../apps/sellout/sellout.theme';
|
||||
import { NOTES_APP_PRIMARY_COLOR, NOTES_APP_TEXT_COLOR } from '../../../apps/notes/notes.theme';
|
||||
import { SELLOUT_APP_PRIMARY_COLOR, SELLOUT_APP_ICON_COLOR } from '../../../apps/sellout/sellout.theme';
|
||||
import { NOTES_APP_ICON_COLOR, NOTES_APP_PRIMARY_COLOR } from '../../../apps/notes/notes.theme';
|
||||
|
||||
export interface IAppConfig {
|
||||
id: string;
|
||||
@@ -142,7 +143,7 @@ export const APPS: IAppConfig[] = [
|
||||
icon: <FontAwesomeIcon icon={faAd} fixedWidth />,
|
||||
notificationIcon: <FontAwesomeIcon icon={faAd} fixedWidth size='xs' />,
|
||||
backgroundColor: SELLOUT_APP_PRIMARY_COLOR,
|
||||
color: SELLOUT_APP_TEXT_COLOR,
|
||||
color: SELLOUT_APP_ICON_COLOR,
|
||||
path: '/sellout',
|
||||
Route: () => (
|
||||
<AppRoute id='SELLOUT' path='/sellout' component={SelloutApp} />
|
||||
@@ -156,7 +157,7 @@ export const APPS: IAppConfig[] = [
|
||||
<FontAwesomeIcon icon={faStickyNote} fixedWidth size='xs' />
|
||||
),
|
||||
backgroundColor: NOTES_APP_PRIMARY_COLOR,
|
||||
color: NOTES_APP_TEXT_COLOR,
|
||||
color: NOTES_APP_ICON_COLOR,
|
||||
path: '/notes',
|
||||
Route: () => <AppRoute id='NOTES' path='/notes' component={NotesApp} />,
|
||||
},
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import { Button, ButtonProps, fade, makeStyles } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
|
||||
type StatusButtonStyleColor = 'success' | 'error' | 'warning' | 'info';
|
||||
|
||||
interface IStatusButtonStyleProps {
|
||||
color: StatusButtonStyleColor;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles(
|
||||
(theme) => ({
|
||||
root: {
|
||||
color: ({ color }: IStatusButtonStyleProps) => theme.palette[color].main,
|
||||
'&:hover': {
|
||||
backgroundColor: ({ color }: IStatusButtonStyleProps) =>
|
||||
fade(theme.palette[color].light, theme.palette.action.hoverOpacity),
|
||||
},
|
||||
},
|
||||
outlined: {
|
||||
border: ({ color }: IStatusButtonStyleProps) =>
|
||||
`1px solid ${fade(theme.palette[color].main, 0.5)}`,
|
||||
'&:hover': {
|
||||
border: ({ color }: IStatusButtonStyleProps) =>
|
||||
`1px solid ${theme.palette[color].main}`,
|
||||
},
|
||||
'&$disabled': {
|
||||
border: `1px solid ${theme.palette.action.disabled}`,
|
||||
},
|
||||
},
|
||||
contained: {
|
||||
color: ({ color }: IStatusButtonStyleProps) =>
|
||||
theme.palette[color].contrastText,
|
||||
backgroundColor: ({ color }: IStatusButtonStyleProps) =>
|
||||
theme.palette[color].main,
|
||||
'&:hover': {
|
||||
backgroundColor: ({ color }: IStatusButtonStyleProps) =>
|
||||
theme.palette[color].dark,
|
||||
},
|
||||
},
|
||||
}),
|
||||
{ name: 'MuiButton' }
|
||||
);
|
||||
|
||||
export const StatusButton = ({
|
||||
color = 'info',
|
||||
variant,
|
||||
className,
|
||||
...props
|
||||
}: Omit<ButtonProps, 'color'> & { color: StatusButtonStyleColor }) => {
|
||||
const classes = useStyles({ color });
|
||||
return (
|
||||
<Button
|
||||
className={`${classes.root} ${classes[variant] || ''} ${className}`}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user