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