From 2c6358e4c33f02f345495b361f819194fd023f3b Mon Sep 17 00:00:00 2001 From: J Francisco Rader Date: Sun, 21 Feb 2021 18:13:08 -0500 Subject: [PATCH] Add status button | Revert white icons --- phone/src/apps/notes/modal/NoteModal.tsx | 70 +++++++++++++--------- phone/src/apps/notes/modal/modal.styles.ts | 14 +---- phone/src/apps/notes/notes.theme.ts | 1 + phone/src/apps/sellout/sellout.theme.ts | 1 + phone/src/locale/en.json | 1 + phone/src/os/apps/config/apps.tsx | 9 +-- phone/src/ui/components/StatusButton.tsx | 57 ++++++++++++++++++ 7 files changed, 109 insertions(+), 44 deletions(-) create mode 100644 phone/src/ui/components/StatusButton.tsx diff --git a/phone/src/apps/notes/modal/NoteModal.tsx b/phone/src/apps/notes/modal/NoteModal.tsx index 1efad42..2b3b110 100644 --- a/phone/src/apps/notes/modal/NoteModal.tsx +++ b/phone/src/apps/notes/modal/NoteModal.tsx @@ -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 = () => { } /> {detail.content.length}/250 - {!detail.id && ( - - )} - {!!detail.id && ( + {!detail.id ? ( <> - - + + + + + + {t('GENERIC_CANCEL')} + + + + ) : ( + <> + + + + + + {t('GENERIC_DELETE')} + + )} diff --git a/phone/src/apps/notes/modal/modal.styles.ts b/phone/src/apps/notes/modal/modal.styles.ts index e233e3f..f706446 100644 --- a/phone/src/apps/notes/modal/modal.styles.ts +++ b/phone/src/apps/notes/modal/modal.styles.ts @@ -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, }, })); diff --git a/phone/src/apps/notes/notes.theme.ts b/phone/src/apps/notes/notes.theme.ts index 30f63b2..dddda36 100644 --- a/phone/src/apps/notes/notes.theme.ts +++ b/phone/src/apps/notes/notes.theme.ts @@ -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 = { diff --git a/phone/src/apps/sellout/sellout.theme.ts b/phone/src/apps/sellout/sellout.theme.ts index 438790a..92e3f23 100644 --- a/phone/src/apps/sellout/sellout.theme.ts +++ b/phone/src/apps/sellout/sellout.theme.ts @@ -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 = { diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index 94c6c3d..a36c0c1 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -107,6 +107,7 @@ "GENERIC_UPDATE": "Update", "GENERIC_DELETE": "Delete", "GENERIC_CLOSE": "Close", + "GENERIC_CANCEL": "Cancel", "GENERIC_TITLE": "Title", "GENERIC_CONTENT": "Content" } diff --git a/phone/src/os/apps/config/apps.tsx b/phone/src/os/apps/config/apps.tsx index b79a5e4..a1e125c 100644 --- a/phone/src/os/apps/config/apps.tsx +++ b/phone/src/os/apps/config/apps.tsx @@ -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: , notificationIcon: , backgroundColor: SELLOUT_APP_PRIMARY_COLOR, - color: SELLOUT_APP_TEXT_COLOR, + color: SELLOUT_APP_ICON_COLOR, path: '/sellout', Route: () => ( @@ -156,7 +157,7 @@ export const APPS: IAppConfig[] = [ ), backgroundColor: NOTES_APP_PRIMARY_COLOR, - color: NOTES_APP_TEXT_COLOR, + color: NOTES_APP_ICON_COLOR, path: '/notes', Route: () => , }, diff --git a/phone/src/ui/components/StatusButton.tsx b/phone/src/ui/components/StatusButton.tsx new file mode 100644 index 0000000..c219659 --- /dev/null +++ b/phone/src/ui/components/StatusButton.tsx @@ -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 & { color: StatusButtonStyleColor }) => { + const classes = useStyles({ color }); + return ( +