Skip to content

Commit d8cf8cc

Browse files
styled component integrated
1 parent a9911bc commit d8cf8cc

File tree

7 files changed

+51
-16
lines changed

7 files changed

+51
-16
lines changed

config-overrides.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const { override, addBabelPlugins } = require('customize-cra');
2+
3+
module.exports = override(...addBabelPlugins('babel-plugin-styled-components'));

package.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"start": "react-scripts start",
7-
"build": "react-scripts build",
8-
"test": "react-scripts test",
6+
"start": "react-app-rewired start",
7+
"build": "react-app-rewired build",
8+
"test": "react-app-rewired test",
99
"eject": "react-scripts eject",
1010
"prettify": "prettier --config ./.prettierrc.js -w ./src"
1111
},
1212
"dependencies": {
13-
"babel-plugin-styled-components": "^1.12.0",
14-
"beprofiler": "^0.2.3",
15-
"i18n-keys": "^1.0.8",
16-
"i18next": "^20.3.1",
1713
"@reduxjs/toolkit": "^1.5.1",
1814
"@testing-library/jest-dom": "^5.11.4",
1915
"@testing-library/react": "^11.1.0",
@@ -22,6 +18,10 @@
2218
"@types/node": "^12.0.0",
2319
"@types/react": "^17.0.0",
2420
"@types/react-dom": "^17.0.0",
21+
"babel-plugin-styled-components": "^1.12.0",
22+
"beprofiler": "^0.2.3",
23+
"i18n-keys": "^1.0.8",
24+
"i18next": "^20.3.1",
2525
"react": "^17.0.2",
2626
"react-dom": "^17.0.2",
2727
"react-redux": "^7.2.4",
@@ -30,16 +30,18 @@
3030
"redux-logger": "^3.0.6",
3131
"redux-observable": "^1.2.0",
3232
"rxjs": "^6.6.7",
33-
"typescript": "^4.1.2",
3433
"styled-components": "^5.3.0",
3534
"tailwindcss": "^2.1.4",
36-
"twin.macro": "^2.4.2"
35+
"twin.macro": "^2.4.2",
36+
"typescript": "^4.1.2"
3737
},
3838
"devDependencies": {
39-
"@types/styled-components": "^5.1.9",
4039
"@types/react-router-dom": "^5.1.7",
4140
"@types/redux-logger": "^3.0.8",
42-
"prettier": "^2.3.0"
41+
"@types/styled-components": "^5.1.9",
42+
"customize-cra": "^1.0.0",
43+
"prettier": "^2.3.0",
44+
"react-app-rewired": "^2.1.8"
4345
},
4446
"proxy": "https://api.itbook.store/1.0",
4547
"eslintConfig": {

src/pages/home/components/book-form/book-form.styles.css renamed to src/pages/home/components/search-form/book-form.styles.css

File renamed without changes.

src/pages/home/components/book-form/book-form.tsx renamed to src/pages/home/components/search-form/search-form.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { useCallback, useState } from 'react';
22
import { useDispatch } from 'react-redux';
3+
import styled from 'styled-components';
34
import { Button, ButtonType } from '../../../../components/button/button';
45
import { bookSlice } from '../../../../logic/store/book/book.slice';
6+
import { APP_MARGIN } from '../../../../styles/layout';
57

68
import './book-form.styles.css';
79

8-
export const BookForm: React.FC = () => {
10+
export const SearchForm: React.FC = () => {
911
const dispatch = useDispatch();
1012
const [searchPhrase, setSearchPhrase] = useState('');
1113
const handleOnChange = useCallback((e) => setSearchPhrase(e.target.value), []);
@@ -14,7 +16,7 @@ export const BookForm: React.FC = () => {
1416
}, [dispatch, searchPhrase]);
1517

1618
return (
17-
<div className="notes-container">
19+
<Container>
1820
<input
1921
className="note-input"
2022
type="text"
@@ -25,6 +27,12 @@ export const BookForm: React.FC = () => {
2527
<div className="add-button-container">
2628
<Button title="Search" type={ButtonType.Transparent} onClick={handleAddNote}></Button>
2729
</div>
28-
</div>
30+
</Container>
2931
);
3032
};
33+
34+
const Container = styled.div`
35+
margin-bottom: ${APP_MARGIN};
36+
display: flex;
37+
flex-direction: column;
38+
`;

src/pages/home/home.page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useDispatch } from 'react-redux';
33
import { Layout } from '../../components/layout/layout';
44
import { bookSlice } from '../../logic/store/book/book.slice';
55
import { NoteCards } from './components/book-cards/book-cards';
6-
import { BookForm } from './components/book-form/book-form';
6+
import { SearchForm } from './components/search-form/search-form';
77

88
export const HomePage: React.FC = () => {
99
const dispatch = useDispatch();
@@ -14,7 +14,7 @@ export const HomePage: React.FC = () => {
1414

1515
return (
1616
<Layout>
17-
<BookForm />
17+
<SearchForm />
1818
<NoteCards />
1919
</Layout>
2020
);

src/styles/layout.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const APP_MARGIN = '1rem';
2+
export const APP_PADDING = '1rem';
3+
export const APP_BORDER_RADIUS = '6px';

yarn.lock

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4074,6 +4074,13 @@ csstype@^3.0.2:
40744074
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.8.tgz#d2266a792729fb227cd216fb572f43728e1ad340"
40754075
integrity sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==
40764076

4077+
customize-cra@^1.0.0:
4078+
version "1.0.0"
4079+
resolved "https://registry.yarnpkg.com/customize-cra/-/customize-cra-1.0.0.tgz#73286563631aa08127ad4d30a2e3c89cf4e93c8d"
4080+
integrity sha512-DbtaLuy59224U+xCiukkxSq8clq++MOtJ1Et7LED1fLszWe88EoblEYFBJ895sB1mC6B4uu3xPT/IjClELhMbA==
4081+
dependencies:
4082+
lodash.flow "^3.5.0"
4083+
40774084
cyclist@^1.0.1:
40784085
version "1.0.1"
40794086
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
@@ -7202,6 +7209,11 @@ lodash.flatmap@^4.5.0:
72027209
resolved "https://registry.yarnpkg.com/lodash.flatmap/-/lodash.flatmap-4.5.0.tgz#ef8cbf408f6e48268663345305c6acc0b778702e"
72037210
integrity sha1-74y/QI9uSCaGYzRTBcaswLd4cC4=
72047211

7212+
lodash.flow@^3.5.0:
7213+
version "3.5.0"
7214+
resolved "https://registry.yarnpkg.com/lodash.flow/-/lodash.flow-3.5.0.tgz#87bf40292b8cf83e4e8ce1a3ae4209e20071675a"
7215+
integrity sha1-h79AKSuM+D5OjOGjrkIJ4gBxZ1o=
7216+
72057217
lodash.get@^4.4.2:
72067218
version "4.4.2"
72077219
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
@@ -9356,6 +9368,13 @@ react-app-polyfill@^2.0.0:
93569368
regenerator-runtime "^0.13.7"
93579369
whatwg-fetch "^3.4.1"
93589370

9371+
react-app-rewired@^2.1.8:
9372+
version "2.1.8"
9373+
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.1.8.tgz#e192f93b98daf96889418d33d3e86cf863812b56"
9374+
integrity sha512-wjXPdKPLscA7mn0I1de1NHrbfWdXz4S1ladaGgHVKdn1hTgKK5N6EdGIJM0KrS6bKnJBj7WuqJroDTsPKKr66Q==
9375+
dependencies:
9376+
semver "^5.6.0"
9377+
93599378
react-dev-utils@^11.0.3:
93609379
version "11.0.4"
93619380
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-11.0.4.tgz#a7ccb60257a1ca2e0efe7a83e38e6700d17aa37a"

0 commit comments

Comments
 (0)