이승윤

style: 컴포넌트 스타일에 mantine적용

...@@ -132,7 +132,7 @@ const Header = () => { ...@@ -132,7 +132,7 @@ const Header = () => {
132 /> 132 />
133 </DropDownWrap> 133 </DropDownWrap>
134 </DropDownContainer> 134 </DropDownContainer>
135 - <InputBlock color="blue" size="14px" width="400px" display=""> 135 + <InputBlock color="blue" fontsize="20px" width="850px" display="">
136 <input /> 136 <input />
137 </InputBlock> 137 </InputBlock>
138 </SearchContainer> 138 </SearchContainer>
...@@ -156,15 +156,14 @@ const Header = () => { ...@@ -156,15 +156,14 @@ const Header = () => {
156 width="85px" 156 width="85px"
157 fontsize="16px" 157 fontsize="16px"
158 height="38px" 158 height="38px"
159 + title="정렬"
159 options={[ 160 options={[
160 - { value: 0, name: '정렬' }, 161 + { id: 0, name: '정렬' },
161 - { value: 1, name: '날짜빠른순' }, 162 + { id: 1, name: '날짜빠른순' },
162 - { value: 2, name: '크기높은순' }, 163 + { id: 2, name: '크기높은순' },
163 - { value: 3, name: '크기낮은순' }, 164 + { id: 3, name: '크기낮은순' },
164 ]} 165 ]}
165 - > 166 + />
166 - 정렬
167 - </DropDownButton>
168 </SortOptionContainer> 167 </SortOptionContainer>
169 </OptionContainer> 168 </OptionContainer>
170 <UserContainer> 169 <UserContainer>
......
...@@ -81,11 +81,18 @@ const Modal = ({ showModal, setShowModal }) => { ...@@ -81,11 +81,18 @@ const Modal = ({ showModal, setShowModal }) => {
81 <Background onClick={closeModal}> 81 <Background onClick={closeModal}>
82 <ModalWrapper> 82 <ModalWrapper>
83 <ModalContent> 83 <ModalContent>
84 - <TextWrap top="15px" right="20px" bottom="19px"> 84 + <TextWrap top="15px" right="20px" bottom="19px" height="40px">
85 기본검색 85 기본검색
86 </TextWrap> 86 </TextWrap>
87 <StandardWrap> 87 <StandardWrap>
88 - <Input float="left" color="blue" width="140px" size="10px" /> 88 + <Input
89 + float="left"
90 + color="blue"
91 + width="350px"
92 + height="40px"
93 + paddingsize="3px"
94 + fontsize="15px"
95 + />
89 </StandardWrap> 96 </StandardWrap>
90 <TextWrap top="75px" right="20px" bottom="137px"> 97 <TextWrap top="75px" right="20px" bottom="137px">
91 고급검색 98 고급검색
...@@ -94,24 +101,30 @@ const Modal = ({ showModal, setShowModal }) => { ...@@ -94,24 +101,30 @@ const Modal = ({ showModal, setShowModal }) => {
94 <Input 101 <Input
95 float="left" 102 float="left"
96 color="blue" 103 color="blue"
97 - width="140px" 104 + width="350px"
98 - size="10px" 105 + height="40px"
106 + paddingsize="3px"
107 + fontsize="15px"
99 placeholder="단어/ 문장검색" 108 placeholder="단어/ 문장검색"
100 /> 109 />
101 <br /> <br /> 110 <br /> <br />
102 <Input 111 <Input
103 float="left" 112 float="left"
104 color="blue" 113 color="blue"
105 - width="140px" 114 + width="350px"
106 - size="10px" 115 + height="40px"
116 + paddingsize="3px"
117 + fontsize="15px"
107 placeholder="최초 작성자" 118 placeholder="최초 작성자"
108 /> 119 />
109 <br /> <br /> 120 <br /> <br />
110 <Input 121 <Input
111 float="left" 122 float="left"
112 color="blue" 123 color="blue"
113 - width="140px" 124 + width="350px"
114 - size="10px" 125 + height="40px"
126 + paddingsize="3px"
127 + fontsize="15px"
115 placeholder="최종 수정자" 128 placeholder="최종 수정자"
116 /> 129 />
117 </AdvancedWrap> 130 </AdvancedWrap>
......
1 -import React from 'react'; 1 +import React, { useState, useEffect } from 'react';
2 +import { Menu, MenuItem } from '@mantine/core';
2 import styled from 'styled-components'; 3 import styled from 'styled-components';
3 import { dropdownHeaderColorMap } from '../../lib/styles/palette'; 4 import { dropdownHeaderColorMap } from '../../lib/styles/palette';
4 5
...@@ -6,30 +7,23 @@ const DropDownBlock = styled.div` ...@@ -6,30 +7,23 @@ const DropDownBlock = styled.div`
6 margin: 0 auto; 7 margin: 0 auto;
7 float: ${props => props.float || ''}; 8 float: ${props => props.float || ''};
8 `; 9 `;
9 -const DropDownHeader = styled.select` 10 +const DropDownHeader = styled(Menu)``;
10 - margin-bottom: 0.8em; 11 +
11 - padding: 0.4em; 12 +const DropDownWrap = styled.button`
12 - width: ${props => props.width || '100px'};
13 - height: ${props => props.height || '30px'};
14 - padding-right: 30px;
15 - font-size: ${props => props.fontsize || '20px'};
16 - cursor: pointer;
17 color: ${props => dropdownHeaderColorMap[props.color].color}; 13 color: ${props => dropdownHeaderColorMap[props.color].color};
18 background-color: ${props => dropdownHeaderColorMap[props.color].background}; 14 background-color: ${props => dropdownHeaderColorMap[props.color].background};
15 + cursor: pointer;
19 &:hover { 16 &:hover {
20 background-color: ${props => 17 background-color: ${props =>
21 dropdownHeaderColorMap[props.color].hoverBackground}; 18 dropdownHeaderColorMap[props.color].hoverBackground};
22 } 19 }
20 + margin-bottom: 0.8em;
21 + padding: 0.4em;
22 + width: ${props => props.width || '100px'};
23 + height: ${props => props.height || '30px'};
24 + padding-right: 30px;
25 + font-size: ${props => props.fontsize || '20px'};
23 border: 1px ${props => dropdownHeaderColorMap[props.color].background}; 26 border: 1px ${props => dropdownHeaderColorMap[props.color].background};
24 -
25 - option {
26 - color: blue;
27 - background-color: blue;
28 - display: flex;
29 - white-space: pre;
30 - min-height: 20px;
31 - padding: 0px 2px 1px;
32 - }
33 `; 27 `;
34 28
35 const DropDown = ({ 29 const DropDown = ({
...@@ -39,18 +33,36 @@ const DropDown = ({ ...@@ -39,18 +33,36 @@ const DropDown = ({
39 fontsize, 33 fontsize,
40 width, 34 width,
41 height, 35 height,
36 + title = '전체',
42 }) => { 37 }) => {
38 + const [menuTitle, setTitle] = useState('');
39 + useEffect(() => {
40 + setTitle(title);
41 + }, []);
43 return ( 42 return (
44 - <DropDownBlock float={float} color={color}> 43 + <DropDownBlock float={float} color={color} title={title}>
45 <DropDownHeader 44 <DropDownHeader
46 - options={options} 45 + control={
47 - color={color} 46 + <DropDownWrap
48 - fontsize={fontsize} 47 + options={options}
49 - width={width} 48 + color={color}
50 - height={height} 49 + fontsize={fontsize}
50 + width={width}
51 + height={height}
52 + >
53 + {menuTitle}
54 + </DropDownWrap>
55 + }
51 > 56 >
52 {options.map(friend => ( 57 {options.map(friend => (
53 - <option value={friend.id}>{friend.name}</option> 58 + <MenuItem
59 + value={friend.id}
60 + onClick={() => {
61 + setTitle(friend.name);
62 + }}
63 + >
64 + {friend.name}
65 + </MenuItem>
54 ))} 66 ))}
55 </DropDownHeader> 67 </DropDownHeader>
56 </DropDownBlock> 68 </DropDownBlock>
......
1 -import React, { useState } from 'react'; 1 +import React, { useState, useEffect } from 'react';
2 +import { TextInput } from '@mantine/core';
2 import styled from 'styled-components'; 3 import styled from 'styled-components';
3 -import { useHistory } from 'react-router-dom'; 4 +import { useHistory, useLocation } from 'react-router-dom';
4 import SearchBox from './SearchBox'; 5 import SearchBox from './SearchBox';
5 import { inputColorMap } from '../../lib/styles/palette'; 6 import { inputColorMap } from '../../lib/styles/palette';
6 7
7 const InputBlock = styled.div` 8 const InputBlock = styled.div`
8 - input { 9 + width: ${props => props.width};
9 - padding: ${props => props.size}; 10 + float: ${props => props.float || 'left'};
10 - padding-right: ${props => props.width}; 11 + height: ${props => props.height};
11 - color: ${props => inputColorMap[props.color].color}; 12 +`;
12 - box-shadow: 2px 3px 28px 1px rgba(0, 0, 0, 0.1);
13 - border: 3px solid ${props => inputColorMap[props.color].borderColor};
14 -
15 - font-size: ${props => props.size};
16 13
17 - &::placeholder { 14 +const InputWrap = styled.div`
18 - color: ${props => inputColorMap[props.color].placeholder}; 15 + padding-top: ${props => props.paddingsize};
19 - text-transform: uppercase; 16 + padding-left: 10px;
20 - } 17 + width: 70%;
21 - float: left; 18 + height: 100%;
22 - } 19 + color: ${props => inputColorMap[props.color].color};
23 - float: ${props => props.float || ''}; 20 + box-shadow: 2px 3px 28px 1px rgba(0, 0, 0, 0.1);
21 + outline: none;
22 + font-size: ${props => props.size};
23 + border: 3px solid ${props => inputColorMap[props.color].borderColor};
24 + float: left;
25 +`;
26 +const SearchIconWrap = styled.div`
27 + float: left;
24 `; 28 `;
25 -const SearchIconWrap = styled.div``;
26 29
27 -const Input = ({ 30 +const MyInput = ({
28 color, 31 color,
29 - size, 32 + paddingsize = '10px',
30 float, 33 float,
31 width, 34 width,
35 + height = '50px',
32 placeholder = '내용을 입력해 주세요.', 36 placeholder = '내용을 입력해 주세요.',
33 display, 37 display,
38 + fontsize = '20px',
34 }) => { 39 }) => {
35 const [query, setQuery] = useState(''); 40 const [query, setQuery] = useState('');
36 const history = useHistory(); 41 const history = useHistory();
42 + const search = useLocation();
43 + const name = search.search.substring(7);
44 + useEffect(() => {
45 + setQuery(name);
46 + }, []);
47 +
37 return ( 48 return (
38 <InputBlock 49 <InputBlock
39 color={color} 50 color={color}
40 - size={size} 51 + size={paddingsize}
41 float={float} 52 float={float}
42 width={width} 53 width={width}
43 placeholder={placeholder} 54 placeholder={placeholder}
44 display={display} 55 display={display}
56 + height={height}
45 > 57 >
46 - <input 58 + <InputWrap color={color} paddingsize={paddingsize} float={float}>
47 - placeholder={placeholder} 59 + <TextInput
48 - type="text" 60 + inputStyle={{
49 - value={query} 61 + fontSize: fontsize,
50 - onChange={e => setQuery(e.target.value)} 62 + }}
51 - onKeyPress={e => { 63 + variant="unstyled"
52 - if (e.key === 'Enter') { 64 + placeholder={placeholder}
53 - if (query === '') { 65 + type="text"
54 - alert('검색어를 입력 해 주세요.'); 66 + value={query}
55 - return; 67 + onChange={e => setQuery(e.target.value)}
68 + onKeyPress={e => {
69 + if (e.key === 'Enter') {
70 + if (query === '') {
71 + alert('검색어를 입력 해 주세요.');
72 + return;
73 + }
74 + const params = new URLSearchParams({ query });
75 + history.push(`search?${params.toString()}`);
56 } 76 }
57 - const params = new URLSearchParams({ query }); 77 + }}
58 - history.push(`search?${params.toString()}`); 78 + />
59 - } 79 + </InputWrap>
60 - }}
61 - />
62 <SearchIconWrap 80 <SearchIconWrap
63 onClick={() => { 81 onClick={() => {
64 const params = new URLSearchParams({ query }); 82 const params = new URLSearchParams({ query });
...@@ -71,4 +89,4 @@ const Input = ({ ...@@ -71,4 +89,4 @@ const Input = ({
71 ); 89 );
72 }; 90 };
73 91
74 -export default Input; 92 +export default MyInput;
......
...@@ -13,9 +13,10 @@ const Main = styled.div` ...@@ -13,9 +13,10 @@ const Main = styled.div`
13 `; 13 `;
14 14
15 const SearchBlock = styled.div` 15 const SearchBlock = styled.div`
16 - display: flex; 16 + display: inline-block;
17 + width: 100%;
18 + margin-left: 23%;
17 `; 19 `;
18 -
19 const LoginButtonBlock = styled.div` 20 const LoginButtonBlock = styled.div`
20 position: fixed; 21 position: fixed;
21 top: 20px; 22 top: 20px;
...@@ -35,8 +36,9 @@ const HomePage = () => { ...@@ -35,8 +36,9 @@ const HomePage = () => {
35 { id: 2, name: '개인' }, 36 { id: 2, name: '개인' },
36 { id: 3, name: '부서' }, 37 { id: 3, name: '부서' },
37 ]} 38 ]}
39 + float="left"
38 /> 40 />
39 - <Input color="blue" size="14px" width="400px" display /> 41 + <Input color="blue" paddingsize="10px" width="700px" display />
40 </SearchBlock> 42 </SearchBlock>
41 43
42 {/* Todo : 로그인 했을 경우 로그인 버튼 숨기기 */} 44 {/* Todo : 로그인 했을 경우 로그인 버튼 숨기기 */}
......