From f0d2370d5cdae6b6f9d50747636b0a69580c39f3 Mon Sep 17 00:00:00 2001 From: "mirlan.maksitaliev" Date: Fri, 5 Jun 2020 18:02:10 +0600 Subject: [PATCH] feat(ott-37): added simple routing --- package.json | 6 ++++++ src/config/pages.tsx | 1 + src/features/App/index.tsx | 31 ++++++++++++++++++++++++++----- src/features/Register/index.tsx | 3 +++ 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 src/features/Register/index.tsx diff --git a/package.json b/package.json index a1076adc..a0e041a5 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,12 @@ "build-storybook": "build-storybook -s public" }, "dependencies": { + "history": "^4.10.1", "lodash": "^4.17.15", "react": "^16.13.1", "react-dom": "^16.13.1", + "react-router": "^5.2.0", + "react-router-dom": "^5.2.0", "react-scripts": "3.4.1", "styled-components": "^5.1.1" }, @@ -32,11 +35,14 @@ "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", + "@types/history": "^4.7.6", "@types/jest": "^24.0.0", "@types/lodash": "^4.14.154", "@types/node": "^12.0.0", "@types/react": "^16.9.0", "@types/react-dom": "^16.9.0", + "@types/react-router": "^5.1.7", + "@types/react-router-dom": "^5.1.5", "@types/styled-components": "^5.1.0", "commitizen": "^4.1.2", "eslint": "6.8.0", diff --git a/src/config/pages.tsx b/src/config/pages.tsx index f960c655..570ecc08 100644 --- a/src/config/pages.tsx +++ b/src/config/pages.tsx @@ -1,3 +1,4 @@ export const PAGES = { login: '/login', + register: '/register', } diff --git a/src/features/App/index.tsx b/src/features/App/index.tsx index 153f5549..11b966cb 100644 --- a/src/features/App/index.tsx +++ b/src/features/App/index.tsx @@ -1,12 +1,33 @@ import React from 'react' +import { + Router, + Route, + Redirect, +} from 'react-router-dom' +import { createBrowserHistory } from 'history' +import { GlobalStyles } from 'features/GlobalStyles' import { Theme } from 'features/Theme' import { Login } from 'features/Login' -import { GlobalStyles } from 'features/GlobalStyles' +import { Register } from 'features/Register' +import { PAGES } from 'config' + +const history = createBrowserHistory() export const App = () => ( - - - - + + + + + + + + + + + + + + + ) diff --git a/src/features/Register/index.tsx b/src/features/Register/index.tsx new file mode 100644 index 00000000..9adf25ca --- /dev/null +++ b/src/features/Register/index.tsx @@ -0,0 +1,3 @@ +import React from 'react' + +export const Register = () =>
Registration page