From 40d97c10c024d6f4bb00c953b74205b92d8eba6a Mon Sep 17 00:00:00 2001 From: popuguy Date: Sat, 1 Feb 2020 12:59:43 +0000 Subject: [PATCH 01/21] Update package.json --- package.json | 84 +++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/package.json b/package.json index 679fda4..da5a1e9 100644 --- a/package.json +++ b/package.json @@ -8,52 +8,48 @@ "prod": "cross-env NODE_ENV=production webpack --mode production" }, "dependencies": { - "@material-ui/core": "^3.9.3", - "@material-ui/icons": "^3.0.2", - "@material-ui/styles": "^3.0.0-alpha.10", - "@reach/router": "^1.3.0-alpha.1", - "dayjs": "^1.8.12", - "final-form": "^4.12.0", - "final-form-arrays": "^1.1.2", - "jss": "^9.8.7", - "react": "^16.8.6", - "react-dom": "^16.8.6", - "react-final-form": "^4.1.0", - "react-final-form-arrays": "^2.0.3", - "react-jss": "^8.6.1", - "react-redux": "^7.0.2", - "react-swipeable-views": "^0.13.1", - "redux": "^4.0.1" + "@material-ui/core": "4.9.0", + "@material-ui/icons": "4.5.1", + "@material-ui/styles": "4.9.0", + "wouter": "2.4.0", + "dayjs": "1.8.19", + "final-form": "4.18.7", + "final-form-arrays": "3.0.2", + "react": "16.12.0", + "react-dom": "16.12.0", + "react-final-form": "6.3.5", + "react-final-form-arrays": "3.1.1", + "react-redux": "7.1.3", + "react-swipeable-views": "0.13.6", + "redux": "4.0.5" }, "devDependencies": { - "@babel/cli": "^7.4.3", - "@babel/core": "^7.4.3", - "@babel/plugin-proposal-class-properties": "^7.4.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/preset-env": "^7.4.3", - "@babel/preset-react": "^7.0.0", - "babel-eslint": "^10.0.1", - "babel-loader": "^8.0.5", - "cross-env": "^5.2.0", - "eslint": "^5.16.0", - "eslint-config-airbnb": "^17.1.0", - "eslint-config-prettier": "^4.1.0", - "eslint-import-resolver-webpack": "^0.11.1", - "eslint-loader": "^2.1.2", - "eslint-plugin-import": "^2.17.2", - "eslint-plugin-jsx-a11y": "^6.2.1", - "eslint-plugin-prettier": "^3.0.1", - "eslint-plugin-react": "^7.12.4", - "eslint-plugin-react-hooks": "^1.6.0", - "file-loader": "^3.0.1", - "html-loader": "^0.5.5", + "@babel/cli": "7.8.4", + "@babel/core": "7.8.4", + "@babel/preset-env": "7.8.4", + "@babel/preset-react": "7.8.3", + "babel-eslint": "10.0.3", + "babel-loader": "8.0.6", + "cross-env": "7.0.0", + "eslint": "6.8.0", + "eslint-config-airbnb": "18.0.1", + "eslint-config-prettier": "6.10.0", + "eslint-import-resolver-webpack": "0.12.1", + "eslint-loader": "3.0.3", + "eslint-plugin-import": "2.20.0", + "eslint-plugin-jsx-a11y": "6.2.3", + "eslint-plugin-prettier": "3.1.2", + "eslint-plugin-react": "7.18.0", + "eslint-plugin-react-hooks": "2.3.0", + "file-loader": "5.0.2", + "html-loader": "0.5.5", "html-webpack-plugin": "^4.0.0-beta.5", - "prettier": "^1.17.0", - "redux-devtools-extension": "^2.13.8", - "uglifyjs-webpack-plugin": "^2.1.2", - "webpack": "^4.30.0", - "webpack-cli": "^3.3.1", - "webpack-dev-server": "^3.3.1", - "webpack-merge": "^4.2.1" + "prettier": "1.19.1", + "redux-devtools-extension": "2.13.8", + "terser-webpack-plugin": "2.3.4", + "webpack": "4.41.5", + "webpack-cli": "3.3.10", + "webpack-dev-server": "3.10.2", + "webpack-merge": "4.2.2" } } From 39c6006209ab69d42bf3b37ba54f6697b4086fdf Mon Sep 17 00:00:00 2001 From: popuguy Date: Sat, 1 Feb 2020 13:00:14 +0000 Subject: [PATCH 02/21] move App to app.js --- app/index.jsx | 71 --------------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 app/index.jsx diff --git a/app/index.jsx b/app/index.jsx deleted file mode 100644 index eaed48f..0000000 --- a/app/index.jsx +++ /dev/null @@ -1,71 +0,0 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import { Link, Match } from '@reach/router'; -import { ThemeProvider } from '@material-ui/styles'; -import CssBaseline from '@material-ui/core/CssBaseline'; -import AppBar from '@material-ui/core/AppBar'; -import Toolbar from '@material-ui/core/Toolbar'; -import Typography from '@material-ui/core/Typography'; -import Fab from '@material-ui/core/Fab'; -import Zoom from '@material-ui/core/Zoom'; - -import AddIcon from '@material-ui/icons/Add'; - -import { Routes } from 'routes'; -// theming and styling -import { theme } from './theme'; -// actions - -const style = { - background: 'linear-gradient(to right, #f79d00, #64f38c)', - fab: { - position: 'fixed', - bottom: 50, - right: 50 - }, - typo: { - textDecoration: 'none' - } -}; - -function App(props) { - return ( - - - - - - Book Editor - - - - - - {({ match }) => - match && ( - - - - - - ) - } - - - ); -} - -function mapStateToProps() { - return {}; -} - -function mapDispatchToProps(dispatch) { - return {}; -} - -const ConnectedApp = connect( - mapStateToProps, - mapDispatchToProps -)(App); - -export default ConnectedApp; From df4198e5b8554ba07f8ed414cd662d7c704e87ee Mon Sep 17 00:00:00 2001 From: popuguy Date: Sat, 1 Feb 2020 13:00:41 +0000 Subject: [PATCH 03/21] add responsive font to theme --- app/theme/index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/theme/index.js b/app/theme/index.js index cd453ac..4790b4f 100644 --- a/app/theme/index.js +++ b/app/theme/index.js @@ -1,8 +1,7 @@ -import { createMuiTheme } from '@material-ui/core/styles'; +import { createMuiTheme, responsiveFontSizes } from '@material-ui/core/styles'; -export const theme = createMuiTheme({ - overrides: {}, - typography: { - useNextVariants: true - } -}); +export const theme = responsiveFontSizes( + createMuiTheme({ + overrides: {} + }) +); From 150258b1b08c7cdd63078bef21ea4ed3afcdac22 Mon Sep 17 00:00:00 2001 From: popuguy Date: Sat, 1 Feb 2020 13:04:36 +0000 Subject: [PATCH 04/21] remove useless plugins --- babel.config.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/babel.config.js b/babel.config.js index 9665af8..e932d00 100644 --- a/babel.config.js +++ b/babel.config.js @@ -12,8 +12,6 @@ module.exports = function(api) { '@babel/preset-react' ]; const plugins = [ - '@babel/plugin-proposal-class-properties', - '@babel/plugin-syntax-dynamic-import' ]; return { From c0dc4dfddba7bfd347b9ff7a202f55d8cbc73e22 Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 19:58:26 +0000 Subject: [PATCH 05/21] refactor: Home page --- app/pages/Home/HomePage.jsx | 32 ++++++++++++++++++++++++++++++++ app/pages/Home/index.js | 1 + 2 files changed, 33 insertions(+) create mode 100644 app/pages/Home/HomePage.jsx create mode 100644 app/pages/Home/index.js diff --git a/app/pages/Home/HomePage.jsx b/app/pages/Home/HomePage.jsx new file mode 100644 index 0000000..f62a187 --- /dev/null +++ b/app/pages/Home/HomePage.jsx @@ -0,0 +1,32 @@ +import React, { useEffect, useCallback } from 'react'; +import { useSelector, useDispatch } from 'react-redux'; + +import Grid from '@material-ui/core/Grid'; + +import { BooksList } from 'components/BooksList'; + +import { deleteBookAction, editBookAction, getBooksAction } from 'actions/book'; + +export function HomePage() { + const dispatch = useDispatch(); + const { books, loaded } = useSelector(state => ({ books: state.books, loaded: state.loaded })); + + const getBooks = useCallback(() => dispatch(getBooksAction()), [dispatch]); + const editBook = useCallback(book => dispatch(editBookAction(book)), [dispatch]); + const deleteBook = useCallback(id => dispatch(deleteBookAction(id)), [dispatch]); + + useEffect(() => { + if (books.length === 0) { + console.log(books.length); + getBooks(); + } + }, [getBooks, loaded, books.length]); + + if (!loaded) return null; + + return ( + + + + ); +} diff --git a/app/pages/Home/index.js b/app/pages/Home/index.js new file mode 100644 index 0000000..0799f47 --- /dev/null +++ b/app/pages/Home/index.js @@ -0,0 +1 @@ +export { HomePage } from './HomePage'; From 72d8db5de7cbc8eee526dfd7fd3d791aa56978e5 Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 19:58:53 +0000 Subject: [PATCH 06/21] refactor: AddBook page --- app/pages/Book/AddBook/AddBook.jsx | 26 ++++++++++++++++++++++++++ app/pages/Book/AddBook/index.js | 1 + 2 files changed, 27 insertions(+) create mode 100644 app/pages/Book/AddBook/AddBook.jsx create mode 100644 app/pages/Book/AddBook/index.js diff --git a/app/pages/Book/AddBook/AddBook.jsx b/app/pages/Book/AddBook/AddBook.jsx new file mode 100644 index 0000000..38c2af9 --- /dev/null +++ b/app/pages/Book/AddBook/AddBook.jsx @@ -0,0 +1,26 @@ +import React, { useCallback } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; + +import Grid from '@material-ui/core/Grid'; +import { BookForm } from 'components/BookForm'; + +import { addBookAction, editBookAction } from 'actions/book'; + +function getBookSelector(books, id) { + return books.find(book => book.id === id); +} + +export function AddBookPage({ id, edit }) { + const dispatch = useDispatch(); + + const book = useSelector(({ books }) => getBookSelector(books, id)); + + const editBook = useCallback(bookId => dispatch(editBookAction(bookId)), [dispatch]); + const addBook = useCallback(newBook => dispatch(addBookAction(newBook)), [dispatch]); + + return ( + + + + ); +} diff --git a/app/pages/Book/AddBook/index.js b/app/pages/Book/AddBook/index.js new file mode 100644 index 0000000..f26a5e4 --- /dev/null +++ b/app/pages/Book/AddBook/index.js @@ -0,0 +1 @@ +export { AddBookPage } from './AddBook'; From 17c05862a802358ea4ba94f8826634975d6d6c5b Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 19:59:04 +0000 Subject: [PATCH 07/21] create Link component --- app/components/Link/Link.jsx | 7 +++++++ app/components/Link/index.js | 1 + 2 files changed, 8 insertions(+) create mode 100644 app/components/Link/Link.jsx create mode 100644 app/components/Link/index.js diff --git a/app/components/Link/Link.jsx b/app/components/Link/Link.jsx new file mode 100644 index 0000000..bffd530 --- /dev/null +++ b/app/components/Link/Link.jsx @@ -0,0 +1,7 @@ +import React from 'react'; +import { Link } from 'wouter'; + +export const LinkBehavior = React.forwardRef((props, ref) => ( + // eslint-disable-next-line react/jsx-props-no-spreading + +)); diff --git a/app/components/Link/index.js b/app/components/Link/index.js new file mode 100644 index 0000000..d063e51 --- /dev/null +++ b/app/components/Link/index.js @@ -0,0 +1 @@ +export { LinkBehavior } from './Link.jsx'; From 653febaed12c0571c6f39ae0dcd414b78c71eb8d Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 19:59:32 +0000 Subject: [PATCH 08/21] refactor: App --- src/app.js | 90 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/src/app.js b/src/app.js index 99bf865..7534ebc 100644 --- a/src/app.js +++ b/src/app.js @@ -1,43 +1,89 @@ -import React, { Fragment } from 'react'; +import React from 'react'; import { Provider } from 'react-redux'; -import { Router } from '@reach/router'; -import { create } from 'jss'; -import JssProvider from 'react-jss/lib/JssProvider'; +import { Route, useLocation } from 'wouter'; +import { ThemeProvider } from '@material-ui/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import AppBar from '@material-ui/core/AppBar'; +import Toolbar from '@material-ui/core/Toolbar'; +import Typography from '@material-ui/core/Typography'; +import Fab from '@material-ui/core/Fab'; +import Zoom from '@material-ui/core/Zoom'; -import CssBaseline from '@material-ui/core/CssBaseline/CssBaseline'; -import { createGenerateClassName, jssPreset } from '@material-ui/core/styles'; +import makeStyles from '@material-ui/styles/makeStyles'; -import { configureStore } from 'store'; -import { loadState, saveState } from 'libs/localStorage'; +// icons +import AddIcon from '@material-ui/icons/Add'; -import AppPage from '../app'; +// libs +import { loadState, saveState } from '../libs/localStorage'; -const styleNode = document.createComment('insertion-point-jss'); -document.head.insertBefore(styleNode, document.head.firstChild); +// store +import { configureStore } from '../app/store'; + +// theming and styling +import { theme } from '../app/theme'; + +// pages +import { HomePage } from '../app/pages/Home'; +import { AddBookPage } from '../app/pages/Book/AddBook'; + +// components +import { LinkBehavior } from '../app/components/Link'; -const generateClassName = createGenerateClassName(); -const jss = create(jssPreset()); -jss.options.insertionPoint = 'insertion-point-jss'; // redux store const persistedState = loadState(); const store = configureStore(persistedState); store.subscribe(() => { - console.log('storeSave'); saveState(store.getState()); }); +const useStyles = makeStyles({ + appBar: { + background: 'linear-gradient(to right, #f79d00, #64f38c)' + }, + fab: { + position: 'fixed', + bottom: 50, + right: 50 + }, + typo: { + textDecoration: 'none' + } +}); + export function App() { + const [location] = useLocation(); + const { appBar, fab, typo } = useStyles(); + return ( - + - - - - - - + + + + Book Editor + + + + + + + {params => } + + + + + + + ); } From 5fcd5c1899e9cec36496e4af4a9adfdbc1553dc8 Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 19:59:41 +0000 Subject: [PATCH 09/21] update deps --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index da5a1e9..67e42c8 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,11 @@ "prod": "cross-env NODE_ENV=production webpack --mode production" }, "dependencies": { - "@material-ui/core": "4.9.0", - "@material-ui/icons": "4.5.1", + "@material-ui/core": "4.9.1", + "@material-ui/icons": "4.9.1", "@material-ui/styles": "4.9.0", "wouter": "2.4.0", - "dayjs": "1.8.19", + "dayjs": "1.8.20", "final-form": "4.18.7", "final-form-arrays": "3.0.2", "react": "16.12.0", @@ -20,7 +20,7 @@ "react-final-form": "6.3.5", "react-final-form-arrays": "3.1.1", "react-redux": "7.1.3", - "react-swipeable-views": "0.13.6", + "react-swipeable-views": "0.13.8", "redux": "4.0.5" }, "devDependencies": { From 8c4574acd37f67ec44ec83bea559aa91836f6460 Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 20:00:04 +0000 Subject: [PATCH 10/21] refactor: reducers --- app/reducers/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/reducers/index.js b/app/reducers/index.js index bb9d42f..00cfabd 100644 --- a/app/reducers/index.js +++ b/app/reducers/index.js @@ -1,6 +1,4 @@ -import { combineReducers } from 'redux'; +// import { combineReducers } from 'redux'; import { booksReducer } from './book.reducer'; -export const rootReducer = combineReducers({ - booksList: booksReducer -}); +export const rootReducer = booksReducer; From bc3f0965c3304d84ad70ad75a26cfe66468e2646 Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 20:00:40 +0000 Subject: [PATCH 11/21] refactor: update code --- app/components/BooksListItem/BookListItem.jsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/components/BooksListItem/BookListItem.jsx b/app/components/BooksListItem/BookListItem.jsx index 24dac0e..7e3b80c 100644 --- a/app/components/BooksListItem/BookListItem.jsx +++ b/app/components/BooksListItem/BookListItem.jsx @@ -1,7 +1,8 @@ import React from 'react'; -import { navigate } from '@reach/router'; +import { useLocation } from 'wouter'; import { makeStyles } from '@material-ui/styles'; import Grid from '@material-ui/core/Grid'; +import Box from '@material-ui/core/Box'; import Paper from '@material-ui/core/Paper'; import Typography from '@material-ui/core/Typography'; import ButtonBase from '@material-ui/core/ButtonBase'; @@ -14,7 +15,7 @@ const useStyles = makeStyles(theme => ({ root: { flexGrow: 1, maxWidth: 600, - padding: theme.spacing.unit * 2 + padding: theme.spacing(2) }, image: { width: 128 @@ -50,16 +51,17 @@ export function BooksListItem({ onDeleteBook }) { const classes = useStyles(); + const [, navigate] = useLocation(); return ( - - + + {title} - + {title} From c4a36d4ab34c43c836fff65a520c579db18e7682 Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 20:01:02 +0000 Subject: [PATCH 12/21] prettired --- app/components/BooksList/BooksList.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/components/BooksList/BooksList.jsx b/app/components/BooksList/BooksList.jsx index d432b22..c12efc5 100644 --- a/app/components/BooksList/BooksList.jsx +++ b/app/components/BooksList/BooksList.jsx @@ -23,4 +23,3 @@ export function BooksList({ books, onDeleteBook }) { /> )); } - From c727659ef51b35d0b7c0db6268cc391380283cde Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 20:01:20 +0000 Subject: [PATCH 13/21] refactor: update code --- app/components/BookForm/BookForm.jsx | 52 +++++++++++----------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/app/components/BookForm/BookForm.jsx b/app/components/BookForm/BookForm.jsx index 5009d24..11916fe 100644 --- a/app/components/BookForm/BookForm.jsx +++ b/app/components/BookForm/BookForm.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import { Match } from '@reach/router'; import { Field, Form } from 'react-final-form'; import arrayMutators from 'final-form-arrays'; @@ -79,16 +78,16 @@ export const BookForm = ({ edit, onAddBook, onEditBook, book }) => { ...arrayMutators }} render={({ - handleSubmit, - form: { - mutators: { push, pop }, - submitting, - pristine - }, - values - }) => ( + handleSubmit, + form: { + mutators: { push, pop }, + submitting, + pristine + }, + values + }) => (
- + { component={TextFieldAdapter} type="year" label="Год публикации" - InputLabelProps={{ - shrink: true - }} /> @@ -177,31 +173,23 @@ export const BookForm = ({ edit, onAddBook, onEditBook, book }) => { component={TextFieldAdapter} type="date" label="Дата выхода в тираж" - InputLabelProps={{ - shrink: true - }} /> - - {({ match }) => - match && ( - - - {edit ? : } - - - ) - } - + + + + {edit ? : } + + )} /> From 4a1ae1fb8b403b76ba8b37dc934155a83bbba06d Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 20:01:46 +0000 Subject: [PATCH 14/21] move code and delete files --- app/pages/Book/AddBook/index.jsx | 44 ------------------------------ app/pages/Home/index.jsx | 46 -------------------------------- 2 files changed, 90 deletions(-) delete mode 100644 app/pages/Book/AddBook/index.jsx delete mode 100644 app/pages/Home/index.jsx diff --git a/app/pages/Book/AddBook/index.jsx b/app/pages/Book/AddBook/index.jsx deleted file mode 100644 index 48b1d66..0000000 --- a/app/pages/Book/AddBook/index.jsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import { connect } from 'react-redux'; - -import Grid from '@material-ui/core/Grid'; -import { BookForm } from 'components/BookForm'; - -import { addBookAction, editBookAction } from 'actions/book'; - -function getBookSelector(books, id) { - return books.find(book => book.id === id); -} - -function BookPage(props) { - const { addBook, editBook, edit, book } = props; - - return ( - - - - ); -} - -function mapStateToProps({ booksList }, ownProps) { - const { id } = ownProps; - const { books, loaded } = booksList; - - return { books, loaded, book: getBookSelector(books, id) }; -} - -function mapDispatchToProps(dispatch) { - return { - addBook(bookData) { - dispatch(addBookAction(bookData)); - }, - editBook(bookID) { - dispatch(editBookAction(bookID)); - } - }; -} - -export const withReduxAddBookPage = connect( - mapStateToProps, - mapDispatchToProps -)(BookPage); diff --git a/app/pages/Home/index.jsx b/app/pages/Home/index.jsx deleted file mode 100644 index 37d165e..0000000 --- a/app/pages/Home/index.jsx +++ /dev/null @@ -1,46 +0,0 @@ -import React, { useEffect } from 'react'; -import { connect } from 'react-redux'; - -import Grid from '@material-ui/core/Grid'; - -import { BooksList } from 'components/BooksList'; - -import { deleteBookAction, editBookAction, getBooksAction } from 'actions/book'; - -function HomePage({ loaded, getBooks, books, editBook, deleteBook }) { - useEffect(() => { - getBooks(); - }, [getBooks, loaded]); - - if (!loaded) return null; - - return ( - - - - ); -} - -function mapStateToProps({ booksList }) { - const { books, loaded } = booksList; - return { books, loaded }; -} - -function mapDispatchToProps(dispatch) { - return { - getBooks() { - dispatch(getBooksAction()); - }, - editBook(book) { - dispatch(editBookAction(book)); - }, - deleteBook(id) { - dispatch(deleteBookAction(id)); - } - }; -} - -export const withReduxHomePage = connect( - mapStateToProps, - mapDispatchToProps -)(HomePage); From 4a13fff496607cc42a9d6fd2af64df1e65feb1be Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 20:02:26 +0000 Subject: [PATCH 15/21] delete folder routes --- app/routes/index.jsx | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 app/routes/index.jsx diff --git a/app/routes/index.jsx b/app/routes/index.jsx deleted file mode 100644 index 4457415..0000000 --- a/app/routes/index.jsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { Router } from '@reach/router'; -// routes -import { NotFound } from 'pages/NotFound'; -import { withReduxHomePage as HomePage } from 'pages/Home'; -import { withReduxAddBookPage as BookPage } from 'pages/Book/AddBook'; - -export const Routes = () => ( - - - - - - -); From 4af02c2da169fd744c8e6cbf070814adcb782a85 Mon Sep 17 00:00:00 2001 From: popuguy Date: Sun, 9 Feb 2020 20:08:47 +0000 Subject: [PATCH 16/21] update deps --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 67e42c8..15e3cf6 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "prod": "cross-env NODE_ENV=production webpack --mode production" }, "dependencies": { - "@material-ui/core": "4.9.1", + "@material-ui/core": "4.9.2", "@material-ui/icons": "4.9.1", "@material-ui/styles": "4.9.0", "wouter": "2.4.0", From 892d92072f3ad2decb1a11babdb93b974dad964d Mon Sep 17 00:00:00 2001 From: popuguy Date: Sat, 22 Feb 2020 14:30:44 +0000 Subject: [PATCH 17/21] fix styles in app --- src/app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index 7534ebc..0823443 100644 --- a/src/app.js +++ b/src/app.js @@ -40,7 +40,8 @@ store.subscribe(() => { const useStyles = makeStyles({ appBar: { - background: 'linear-gradient(to right, #f79d00, #64f38c)' + background: 'linear-gradient(to right, #f79d00, #64f38c)', + marginBottom: 16 }, fab: { position: 'fixed', From da4f0f73a79b16eb679a21afa224d2631cc389bb Mon Sep 17 00:00:00 2001 From: popuguy Date: Sat, 22 Feb 2020 14:30:53 +0000 Subject: [PATCH 18/21] update dependencies --- package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 15e3cf6..760b6f3 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "prod": "cross-env NODE_ENV=production webpack --mode production" }, "dependencies": { - "@material-ui/core": "4.9.2", + "@material-ui/core": "4.9.3", "@material-ui/icons": "4.9.1", "@material-ui/styles": "4.9.0", "wouter": "2.4.0", @@ -19,8 +19,8 @@ "react-dom": "16.12.0", "react-final-form": "6.3.5", "react-final-form-arrays": "3.1.1", - "react-redux": "7.1.3", - "react-swipeable-views": "0.13.8", + "react-redux": "7.2.0", + "react-swipeable-views": "0.13.9", "redux": "4.0.5" }, "devDependencies": { @@ -36,20 +36,20 @@ "eslint-config-prettier": "6.10.0", "eslint-import-resolver-webpack": "0.12.1", "eslint-loader": "3.0.3", - "eslint-plugin-import": "2.20.0", + "eslint-plugin-import": "2.20.1", "eslint-plugin-jsx-a11y": "6.2.3", "eslint-plugin-prettier": "3.1.2", - "eslint-plugin-react": "7.18.0", - "eslint-plugin-react-hooks": "2.3.0", - "file-loader": "5.0.2", + "eslint-plugin-react": "7.18.3", + "eslint-plugin-react-hooks": "2.4.0", + "file-loader": "5.1.0", "html-loader": "0.5.5", "html-webpack-plugin": "^4.0.0-beta.5", "prettier": "1.19.1", "redux-devtools-extension": "2.13.8", - "terser-webpack-plugin": "2.3.4", - "webpack": "4.41.5", - "webpack-cli": "3.3.10", - "webpack-dev-server": "3.10.2", + "terser-webpack-plugin": "2.3.5", + "webpack": "4.41.6", + "webpack-cli": "3.3.11", + "webpack-dev-server": "3.10.3", "webpack-merge": "4.2.2" } } From 1b7cbedcf3299a3ed3229e2f94a51d9d2775acff Mon Sep 17 00:00:00 2001 From: popuguy Date: Sat, 22 Feb 2020 14:31:09 +0000 Subject: [PATCH 19/21] fix styles --- app/components/BookForm/styles.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/components/BookForm/styles.js b/app/components/BookForm/styles.js index 605eebf..5b0f82e 100644 --- a/app/components/BookForm/styles.js +++ b/app/components/BookForm/styles.js @@ -1,8 +1,7 @@ export const style = { paper: { width: '50%', - margin: 16, - padding: 8 + padding: 16 }, typo: { margin: 8 From 83f332045b3349d2b2552da98ec02b0d26cfc6cb Mon Sep 17 00:00:00 2001 From: popuguy Date: Sat, 22 Feb 2020 14:31:24 +0000 Subject: [PATCH 20/21] refactoring BookForm --- app/components/BookForm/BookForm.jsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/components/BookForm/BookForm.jsx b/app/components/BookForm/BookForm.jsx index 11916fe..a689305 100644 --- a/app/components/BookForm/BookForm.jsx +++ b/app/components/BookForm/BookForm.jsx @@ -60,10 +60,10 @@ export const BookForm = ({ edit, onAddBook, onEditBook, book }) => { const newBook = { id: nextid.toString(), ...values }; if (edit) { - return onEditBook(values); + onEditBook(values); } onAddBook(newBook); - return formApi.reset(); + setTimeout(formApi.reset) }; return ( @@ -111,9 +111,9 @@ export const BookForm = ({ edit, onAddBook, onEditBook, book }) => { {({ fields }) => fields.map((name, index) => ( - + - {`Автор #${index + 1}`} + {`Автор #${index + 1}`} { @@ -173,6 +176,9 @@ export const BookForm = ({ edit, onAddBook, onEditBook, book }) => { component={TextFieldAdapter} type="date" label="Дата выхода в тираж" + InputLabelProps={{ + shrink: true + }} /> From 88b53f43a8723a14b39f218f218448a75e40621a Mon Sep 17 00:00:00 2001 From: popuguy Date: Sat, 22 Feb 2020 17:37:50 +0300 Subject: [PATCH 21/21] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99a8c16..1998da0 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ kaspersky react test-task * [React](https://github.com/facebook/react/) * [Redux](https://github.com/reduxjs/redux) * [Webpack](https://github.com/webpack/webpack) -* [@reach/router](https://github.com/reach/router) +* [wouter](https://github.com//molefrog/wouter) * [Material UI](https://github.com/mui-org/material-ui) ## Установка и запуск проекта @@ -20,4 +20,4 @@ kaspersky react test-task `src` - картинки, шрифты, css, etc -`webpack` - модули вебпака \ No newline at end of file +`webpack` - модули вебпака