안형욱

style: 고급 검색 ui 개선

...@@ -8,7 +8,7 @@ const Background = styled.div``; ...@@ -8,7 +8,7 @@ const Background = styled.div``;
8 8
9 const ModalWrapper = styled.div` 9 const ModalWrapper = styled.div`
10 width: 400px; 10 width: 400px;
11 - height: 300px; 11 + height: 194px;
12 `; 12 `;
13 13
14 const ModalContent = styled.div` 14 const ModalContent = styled.div`
...@@ -23,13 +23,13 @@ const ModalContent = styled.div` ...@@ -23,13 +23,13 @@ const ModalContent = styled.div`
23 const SearchWrap = styled.div` 23 const SearchWrap = styled.div`
24 position: absolute; 24 position: absolute;
25 top: 80%; 25 top: 80%;
26 - left: 20%; 26 + right: 20%;
27 `; 27 `;
28 28
29 const CloseWrap = styled.div` 29 const CloseWrap = styled.div`
30 position: absolute; 30 position: absolute;
31 top: 80%; 31 top: 80%;
32 - right: 20%; 32 + left: 20%;
33 `; 33 `;
34 34
35 const StandardWrap = styled.div` 35 const StandardWrap = styled.div`
...@@ -51,7 +51,6 @@ const TextWrap = styled.div` ...@@ -51,7 +51,6 @@ const TextWrap = styled.div`
51 width: 360px; 51 width: 360px;
52 top: ${props => props.top}; 52 top: ${props => props.top};
53 right: ${props => props.right}; 53 right: ${props => props.right};
54 - border-bottom: 2px solid #dee2e6;
55 padding-left: 20px; 54 padding-left: 20px;
56 padding-bottom: ${props => props.bottom}; 55 padding-bottom: ${props => props.bottom};
57 `; 56 `;
...@@ -59,8 +58,7 @@ const TextWrap = styled.div` ...@@ -59,8 +58,7 @@ const TextWrap = styled.div`
59 const Modal = ({ showModal, setShowModal }) => { 58 const Modal = ({ showModal, setShowModal }) => {
60 const [query, setQuery] = useState(''); 59 const [query, setQuery] = useState('');
61 const [keywordQuery, setKeywordQuery] = useState(''); 60 const [keywordQuery, setKeywordQuery] = useState('');
62 - const [writerQuery, setWriterQuery] = useState(''); 61 + const [writer, setWriter] = useState('');
63 - const [dateQuery, setDateQuery] = useState('');
64 const history = useHistory(); 62 const history = useHistory();
65 const modalRef = useRef(); 63 const modalRef = useRef();
66 const closeModal = e => { 64 const closeModal = e => {
...@@ -76,7 +74,7 @@ const Modal = ({ showModal, setShowModal }) => { ...@@ -76,7 +74,7 @@ const Modal = ({ showModal, setShowModal }) => {
76 <Card shadow="lg"> 74 <Card shadow="lg">
77 <ModalWrapper> 75 <ModalWrapper>
78 <ModalContent> 76 <ModalContent>
79 - <TextWrap top="6%" right="10%" bottom="4%" height="40px"> 77 + <TextWrap top="8%" right="10%" bottom="4%" height="40px">
80 기본검색 78 기본검색
81 </TextWrap> 79 </TextWrap>
82 <StandardWrap> 80 <StandardWrap>
...@@ -103,7 +101,7 @@ const Modal = ({ showModal, setShowModal }) => { ...@@ -103,7 +101,7 @@ const Modal = ({ showModal, setShowModal }) => {
103 }} 101 }}
104 /> 102 />
105 </StandardWrap> 103 </StandardWrap>
106 - <TextWrap top="24%" right="10%" bottom="31%"> 104 + <TextWrap top="34%" right="10%" bottom="31%">
107 고급검색 105 고급검색
108 </TextWrap> 106 </TextWrap>
109 <AdvancedWrap> 107 <AdvancedWrap>
...@@ -124,28 +122,29 @@ const Modal = ({ showModal, setShowModal }) => { ...@@ -124,28 +122,29 @@ const Modal = ({ showModal, setShowModal }) => {
124 }} 122 }}
125 placeholder="작성자" 123 placeholder="작성자"
126 type="text" 124 type="text"
127 - value={decodeURIComponent(writerQuery)} 125 + value={decodeURIComponent(writer)}
128 - onChange={e => setWriterQuery(e.target.value)} 126 + onChange={e => setWriter(e.target.value)}
129 - />
130 - <TextInput
131 - inputStyle={{
132 - marginBottom: 18,
133 - fontSize: 15,
134 - }}
135 - placeholder="생성 날짜"
136 - type="text"
137 - value={decodeURIComponent(dateQuery)}
138 - onChange={e => setDateQuery(e.target.value)}
139 /> 127 />
140 </AdvancedWrap> 128 </AdvancedWrap>
141 </ModalContent> 129 </ModalContent>
142 <CloseWrap onClick={() => setShowModal(prev => !prev)}> 130 <CloseWrap onClick={() => setShowModal(prev => !prev)}>
143 - <Button width="100px" color="blue"> 131 + <Button width="100px" color="gray">
144 닫기 132 닫기
145 </Button> 133 </Button>
146 </CloseWrap> 134 </CloseWrap>
147 - <SearchWrap> 135 + <SearchWrap
148 - <Button width="100px" color="gray"> 136 + onClick={() => {
137 + const searchQuery = {};
138 + if (query !== '') searchQuery.query = query;
139 + if (keywordQuery !== '') searchQuery.keyword = keywordQuery;
140 + if (writer !== '') searchQuery.writer = writer;
141 + const params = new URLSearchParams(searchQuery);
142 + history.push(
143 + `search?${decodeURIComponent(params.toString())}`
144 + );
145 + }}
146 + >
147 + <Button width="100px" color="blue">
149 검색 148 검색
150 </Button> 149 </Button>
151 </SearchWrap> 150 </SearchWrap>
......
...@@ -18,10 +18,16 @@ const Buttons = ({ ...@@ -18,10 +18,16 @@ const Buttons = ({
18 width, 18 width,
19 fontsize, 19 fontsize,
20 icon = '', 20 icon = '',
21 + onClick,
21 }) => { 22 }) => {
22 return ( 23 return (
23 <ButtonBlock float={float} width={width} fontsize={fontsize}> 24 <ButtonBlock float={float} width={width} fontsize={fontsize}>
24 - <Button size={size} color={color || 'blue'} rightIcon={icon}> 25 + <Button
26 + onClick={onClick}
27 + size={size}
28 + color={color || 'blue'}
29 + rightIcon={icon}
30 + >
25 {children} 31 {children}
26 </Button> 32 </Button>
27 </ButtonBlock> 33 </ButtonBlock>
......
...@@ -43,8 +43,10 @@ const MyInput = ({ ...@@ -43,8 +43,10 @@ const MyInput = ({
43 }) => { 43 }) => {
44 const [query, setQuery] = useState(''); 44 const [query, setQuery] = useState('');
45 const history = useHistory(); 45 const history = useHistory();
46 - const search = useLocation(); 46 + const { search } = useLocation();
47 - const name = decodeURIComponent(search.search.substring(7)); 47 + const name = decodeURIComponent(
48 + new URLSearchParams(search).get('query') || ''
49 + );
48 const dispatch = useDispatch(); 50 const dispatch = useDispatch();
49 51
50 useEffect(() => { 52 useEffect(() => {
......
...@@ -15,7 +15,6 @@ const ImageWrapper = styled.div` ...@@ -15,7 +15,6 @@ const ImageWrapper = styled.div`
15 `; 15 `;
16 const Thumbnails = ({ srcs }) => { 16 const Thumbnails = ({ srcs }) => {
17 const [lists, setLists] = useState([]); 17 const [lists, setLists] = useState([]);
18 - console.log(srcs);
19 const placeholder = () => { 18 const placeholder = () => {
20 if (srcs.length < 4) { 19 if (srcs.length < 4) {
21 const list = []; 20 const list = [];
......
...@@ -19,4 +19,12 @@ export const esApi = { ...@@ -19,4 +19,12 @@ export const esApi = {
19 19
20 return res.data; 20 return res.data;
21 }, 21 },
22 + // searchByFilter: async (filters, searchWord = '') => {
23 + // // const res = await esInstance.post(
24 + // // `/api/as/v1/engines/${process.env.REACT_APP_ENGINE_NAME}/search`,
25 + // // {
26 + // // query: searchWord,
27 + // // }
28 + // // );
29 + // },
22 }; 30 };
......