Merge branch 'style/components' into 'develop'
merge request from Style/components See merge request !2
Showing
8 changed files
with
239 additions
and
4 deletions
... | @@ -11,7 +11,9 @@ | ... | @@ -11,7 +11,9 @@ |
11 | "prettier/prettier": [2, { | 11 | "prettier/prettier": [2, { |
12 | "endOfLine": "auto" | 12 | "endOfLine": "auto" |
13 | }], | 13 | }], |
14 | - "arrow-body-style": 1 | 14 | + "arrow-body-style": 1, |
15 | + "react/jsx-fragments": 0, | ||
16 | + "react/prop-types": 0 | ||
15 | }, | 17 | }, |
16 | "settings": { | 18 | "settings": { |
17 | "react": { | 19 | "react": { | ... | ... |
1 | import React from 'react'; | 1 | import React from 'react'; |
2 | +import styled from 'styled-components'; | ||
3 | +import { buttonColorMap } from '../../lib/styles/palette'; | ||
2 | 4 | ||
3 | -const Button = () => { | 5 | +const ButtonBlock = styled.button` |
4 | - return <div>Button</div>; | 6 | + width: 20%; |
7 | + background-color: ${props => buttonColorMap[props.color].background}; | ||
8 | + &:hover { | ||
9 | + background-color: ${props => buttonColorMap[props.color].hoverBackground}; | ||
10 | + } | ||
11 | + color: ${props => buttonColorMap[props.color].color}; | ||
12 | + float: ${props => props.float || ''}; | ||
13 | +`; | ||
14 | + | ||
15 | +const Button = ({ children, color, float }) => { | ||
16 | + return ( | ||
17 | + <ButtonBlock color={color} float={float}> | ||
18 | + {children} | ||
19 | + </ButtonBlock> | ||
20 | + ); | ||
5 | }; | 21 | }; |
6 | 22 | ||
7 | export default Button; | 23 | export default Button; | ... | ... |
1 | +import React from 'react'; | ||
2 | +import styled from 'styled-components'; | ||
3 | +import { dropdownListColorMap } from '../../lib/styles/palette'; | ||
4 | + | ||
5 | +const DropDownListBlock = styled.div` | ||
6 | + float: ${props => props.float || ''}; | ||
7 | + width: ${props => props.size || '40%'}; | ||
8 | +`; | ||
9 | + | ||
10 | +const DropDownList = styled.ul` | ||
11 | + padding: 0; | ||
12 | + margin: 0; | ||
13 | + background-color: ${props => dropdownListColorMap[props.color].background}; | ||
14 | + border: 2px solid ${props => dropdownListColorMap[props.color].borderColor}; | ||
15 | + box-sizing: border-box; | ||
16 | + color: ${props => dropdownListColorMap[props.color].color}; | ||
17 | + font-size: 1.3rem; | ||
18 | + font-weight: 500; | ||
19 | + &:first-child { | ||
20 | + padding-top: 0.5em; | ||
21 | + } | ||
22 | +`; | ||
23 | + | ||
24 | +const ListItem = styled.li` | ||
25 | + list-style: none; | ||
26 | + padding-left: 1em; | ||
27 | + padding-bottom: 0.3em; | ||
28 | + border-bottom: 2px solid #e5e5e5; | ||
29 | +`; | ||
30 | + | ||
31 | +const DropDown = ({ children, color, float, size }) => { | ||
32 | + return ( | ||
33 | + <DropDownListBlock color={color} float={float} size={size}> | ||
34 | + <DropDownList color={color}> | ||
35 | + <ListItem>{children}</ListItem> | ||
36 | + </DropDownList> | ||
37 | + </DropDownListBlock> | ||
38 | + ); | ||
39 | +}; | ||
40 | + | ||
41 | +export default DropDown; |
1 | +import React from 'react'; | ||
2 | +import styled from 'styled-components'; | ||
3 | +import { dropdownHeaderColorMap } from '../../lib/styles/palette'; | ||
4 | + | ||
5 | +const DropDownBlock = styled.div` | ||
6 | + margin: 0 auto; | ||
7 | + float: ${props => props.float || ''}; | ||
8 | +`; | ||
9 | + | ||
10 | +const DropDownHeader = styled.button` | ||
11 | + margin-bottom: 0.8em; | ||
12 | + padding: 0.4em; | ||
13 | + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.15); | ||
14 | + font-weight: 500; | ||
15 | + font-size: ${props => props.size}; | ||
16 | + border: 2px solid ${props => dropdownHeaderColorMap[props.color].borderColor}; | ||
17 | + color: ${props => dropdownHeaderColorMap[props.color].color}; | ||
18 | + background-color: ${props => dropdownHeaderColorMap[props.color].background}; | ||
19 | + &:hover { | ||
20 | + background-color: ${props => | ||
21 | + dropdownHeaderColorMap[props.color].hoverBackground}; | ||
22 | + } | ||
23 | +`; | ||
24 | + | ||
25 | +const DropDown = ({ children, float, color, size }) => { | ||
26 | + return ( | ||
27 | + <DropDownBlock float={float} color={color} size={size}> | ||
28 | + <DropDownHeader color={color} size={size}> | ||
29 | + {children} | ||
30 | + </DropDownHeader> | ||
31 | + </DropDownBlock> | ||
32 | + ); | ||
33 | +}; | ||
34 | + | ||
35 | +export default DropDown; |
frontend/src/components/common/Input.js
0 → 100644
1 | +import React from 'react'; | ||
2 | +import styled from 'styled-components'; | ||
3 | +import { inputColorMap } from '../../lib/styles/palette'; | ||
4 | + | ||
5 | +const InputBlock = styled.div` | ||
6 | + input { | ||
7 | + padding: 20px; | ||
8 | + padding-right: 200px; | ||
9 | + color: ${props => inputColorMap[props.color].color}; | ||
10 | + box-shadow: 2px 3px 28px 1px rgba(0, 0, 0, 0.1); | ||
11 | + border: 3px solid ${props => inputColorMap[props.color].borderColor}; | ||
12 | + | ||
13 | + font-size: ${props => props.size}; | ||
14 | + | ||
15 | + &::placeholder { | ||
16 | + color: ${props => inputColorMap[props.color].placeholder}; | ||
17 | + text-transform: uppercase; | ||
18 | + } | ||
19 | + } | ||
20 | + float: ${props => props.float || ''}; | ||
21 | +`; | ||
22 | + | ||
23 | +const Input = ({ children, color, size, float }) => { | ||
24 | + return ( | ||
25 | + <InputBlock color={color} size={size} float={float}> | ||
26 | + <input placeholder={children} color={color} /> | ||
27 | + </InputBlock> | ||
28 | + ); | ||
29 | +}; | ||
30 | + | ||
31 | +export default Input; |
frontend/src/components/common/SearchBox.js
0 → 100644
1 | +import React from 'react'; | ||
2 | +import styled from 'styled-components'; | ||
3 | +import { searchBoxColorMap } from '../../lib/styles/palette'; | ||
4 | + | ||
5 | +const ButtonBlock = styled.button` | ||
6 | + width: ${props => props.size}; | ||
7 | + height: ${props => props.size}; | ||
8 | + background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E"); | ||
9 | + | ||
10 | + background-color: ${props => searchBoxColorMap[props.color].background}; | ||
11 | + &:hover { | ||
12 | + background-color: ${props => | ||
13 | + searchBoxColorMap[props.color].hoverBackground}; | ||
14 | + } | ||
15 | + color: ${props => searchBoxColorMap[props.color].color}; | ||
16 | + float: ${props => props.float || ''}; | ||
17 | +`; | ||
18 | + | ||
19 | +const SearchBox = ({ color, float, size }) => { | ||
20 | + return <ButtonBlock color={color} float={float} size={size} />; | ||
21 | +}; | ||
22 | + | ||
23 | +export default SearchBox; |
frontend/src/lib/styles/palette.js
0 → 100644
1 | +const palette = { | ||
2 | + /* blue */ | ||
3 | + blue0: '#e7f5ff', | ||
4 | + blue1: '#d0ebff', | ||
5 | + blue2: '#a5d8ff', | ||
6 | + blue3: '#74c0fc', | ||
7 | + blue4: '#4dabf7', | ||
8 | + blue5: '#339af0', | ||
9 | + blue6: '#228be6', | ||
10 | + blue7: '#1c7ed6', | ||
11 | + blue8: '#1971c2', | ||
12 | + blue9: '#1864ab', | ||
13 | + /* cyan */ | ||
14 | + cyan0: '#e3fafc', | ||
15 | + cyan1: '#c5f6fa', | ||
16 | + cyan2: '#99e9f2', | ||
17 | + cyan3: '#66d9e8', | ||
18 | + cyan4: '#3bc9db', | ||
19 | + cyan5: '#22b8cf', | ||
20 | + cyan6: '#15aabf', | ||
21 | + cyan7: '#1098ad', | ||
22 | + cyan8: '#0c8599', | ||
23 | + cyan9: '#0b7285', | ||
24 | + /* gray */ | ||
25 | + gray0: '#f8f9fa', | ||
26 | + gray1: '#f1f3f5', | ||
27 | + gray2: '#e9ecef', | ||
28 | + gray3: '#dee2e6', | ||
29 | + gray4: '#ced4da', | ||
30 | + gray5: '#adb5bd', | ||
31 | + gray6: '#868e96', | ||
32 | + gray7: '#495057', | ||
33 | + gray8: '#343a40', | ||
34 | + gray9: '#212529', | ||
35 | +}; | ||
36 | + | ||
37 | +export const buttonColorMap = { | ||
38 | + blue: { | ||
39 | + background: palette.blue6, | ||
40 | + color: 'white', | ||
41 | + hoverBackground: palette.blue5, | ||
42 | + }, | ||
43 | +}; | ||
44 | + | ||
45 | +export const inputColorMap = { | ||
46 | + blue: { | ||
47 | + borderColor: palette.blue6, | ||
48 | + color: 'black', | ||
49 | + placeholder: palette.gray5, | ||
50 | + }, | ||
51 | +}; | ||
52 | + | ||
53 | +export const dropdownListColorMap = { | ||
54 | + blue: { | ||
55 | + background: 'white', | ||
56 | + color: palette.blue8, | ||
57 | + borderColor: palette.blue8, | ||
58 | + }, | ||
59 | +}; | ||
60 | + | ||
61 | +export const dropdownHeaderColorMap = { | ||
62 | + blue: { | ||
63 | + background: palette.blue6, | ||
64 | + color: 'white', | ||
65 | + hoverBackground: palette.blue5, | ||
66 | + borderColor: palette.blue8, | ||
67 | + }, | ||
68 | +}; | ||
69 | + | ||
70 | +export const searchBoxColorMap = { | ||
71 | + blue: { | ||
72 | + background: palette.blue6, | ||
73 | + color: 'white', | ||
74 | + hoverBackground: palette.blue5, | ||
75 | + }, | ||
76 | +}; | ||
77 | + | ||
78 | +export default palette; |
1 | import React from 'react'; | 1 | import React from 'react'; |
2 | +import styled from 'styled-components'; | ||
3 | + | ||
4 | +const Main = styled.div` | ||
5 | + width: 100%; | ||
6 | +`; | ||
2 | 7 | ||
3 | const Home = () => { | 8 | const Home = () => { |
4 | - return <div>Home</div>; | 9 | + return ( |
10 | + <> | ||
11 | + <Main>Home</Main> | ||
12 | + </> | ||
13 | + ); | ||
5 | }; | 14 | }; |
6 | 15 | ||
7 | export default Home; | 16 | export default Home; | ... | ... |
-
Please register or login to post a comment