diff --git a/package-lock.json b/package-lock.json index 5e5cfb69..87832212 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15851,6 +15851,11 @@ } } }, + "formik-material-ui": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/formik-material-ui/-/formik-material-ui-3.0.0.tgz", + "integrity": "sha512-JJ8E/BPFhCxSl1HHgCCEiZqHAPb0lR4xB1Am23530cRKBO+nQy9FmlmWjRhGlkO7g0ak0eDVOR8f2pXton0HsQ==" + }, "forwarded": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", @@ -19935,9 +19940,9 @@ }, "dependencies": { "csstype": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.3.tgz", - "integrity": "sha512-jPl+wbWPOWJ7SXsWyqGRk3lGecbar0Cb0OvZF/r/ZU011R4YqiRehgkQ9p4eQfo9DSDLqLL3wHwfxeJiuIsNag==" + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.4.tgz", + "integrity": "sha512-xc8DUsCLmjvCfoD7LTGE0ou2MIWLx0K9RCZwSHMOdynqRsP4MtUcLeqh1HcQ2dInwDTqn+3CE0/FZh1et+p4jA==" } } }, diff --git a/package.json b/package.json index 012ffcf4..58fd379f 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "0.1.0", "private": true, "dependencies": { + "@material-ui/core": "^4.11.0", "@hookform/resolvers": "^1.0.1", - "@material-ui/core": "^4.7.0", "@material-ui/icons": "^4.5.1", "@material-ui/lab": "^4.0.0-alpha.35", "@reach/window-size": "^0.11.2", @@ -39,6 +39,7 @@ "array-move": "^3.0.1", "chromatic": "^5.3.0", "classnames": "^2.2.6", + "formik-material-ui": "^3.0.0", "clsx": "^1.0.4", "date-fns": "^2.16.1", "debug": "^4.2.0", diff --git a/src/components/ui/Sidebar.tsx b/src/components/ui/Sidebar.tsx index 8f34594f..9c736097 100644 --- a/src/components/ui/Sidebar.tsx +++ b/src/components/ui/Sidebar.tsx @@ -21,6 +21,7 @@ import MailTo from 'react-mailto.js'; import { getFirebase } from 'react-redux-firebase'; import { useHistory } from 'react-router-dom'; import useWebShare from 'react-use-web-share'; +import PlaylistAddCheckIcon from '@material-ui/icons/PlaylistAddCheck'; import { handleErrors, toggleSidebar, @@ -99,6 +100,16 @@ const Sidebar: React.FC<{ classes={{ paper: cx.backgroundColor }} onClose={toggleSidebar} > + + + + + {/* TODO: i18n */} + + diff --git a/src/components/unsorted/UpsertDailyGoal.tsx b/src/components/unsorted/UpsertDailyGoal.tsx index edf335c6..c68af3c2 100644 --- a/src/components/unsorted/UpsertDailyGoal.tsx +++ b/src/components/unsorted/UpsertDailyGoal.tsx @@ -1,8 +1,9 @@ -import { Box, TextField, Theme } from '@material-ui/core'; -import { makeStyles } from '@material-ui/styles'; +import { Box, Grid, Theme, Button } from '@material-ui/core'; import classNames from 'classnames'; -import { Formik } from 'formik'; import React, { memo } from 'react'; +import { Field, Form, Formik } from 'formik'; +import { TextField } from 'formik-material-ui'; +import { makeStyles } from '@material-ui/styles'; const useStyles = makeStyles((theme: Theme) => ({ root: {} })); @@ -18,10 +19,11 @@ const UpsertDailyGoal = memo((props: Props) => { { + validate={(values) => { const errors: Partial<{ title: string }> = {}; - if (!values.title) { - errors.title = 'Required'; + if (!values.title?.trim()) { + // TODO i18n + errors.title = 'Обязательно'; } return errors; }} @@ -32,20 +34,34 @@ const UpsertDailyGoal = memo((props: Props) => { }, 400); }} > - {({ - values, handleChange, handleBlur, handleSubmit, -}) => ( -
- - + {({ values, handleChange, handleBlur, handleSubmit }) => ( +
+ + + + + + + + +
)}