Showing
1 changed file
with
117 additions
and
0 deletions
frontend/src/components/SearchOptionModal.js
0 → 100644
1 | +import React, { useRef } from 'react'; | ||
2 | +import styled from 'styled-components'; | ||
3 | +import Button from './common/Button'; | ||
4 | +import Input from './common/Input'; | ||
5 | + | ||
6 | +const Background = styled.div` | ||
7 | + position: fixed; | ||
8 | + display: flex; | ||
9 | + justify-content: center; | ||
10 | + align-items: center; | ||
11 | +`; | ||
12 | +const ModalWrapper = styled.div` | ||
13 | + width: 400px; | ||
14 | + height: 350px; | ||
15 | + box-shadow: 0 5px 16px rgba(0, 0, 0, 0.2); | ||
16 | + background: #fff; | ||
17 | + color: #000; | ||
18 | + display: grid; | ||
19 | + grid-template-columns: 1fr 1fr; | ||
20 | + position: relative; | ||
21 | + z-index: 10; | ||
22 | + border-radius: 10px; | ||
23 | +`; | ||
24 | + | ||
25 | +const ModalContent = styled.div` | ||
26 | + line-height: 1.8; | ||
27 | + color: #141414; | ||
28 | + p { | ||
29 | + margin-bottom: 1rem; | ||
30 | + } | ||
31 | + align-content: left; | ||
32 | +`; | ||
33 | + | ||
34 | +const SearchWrap = styled.div` | ||
35 | + position: fixed; | ||
36 | + top: 50%; | ||
37 | + right: 43%; | ||
38 | +`; | ||
39 | + | ||
40 | +const CloseWrap = styled.div` | ||
41 | + position: fixed; | ||
42 | + top: 50%; | ||
43 | + right: 32%; | ||
44 | +`; | ||
45 | + | ||
46 | +const StandardWrap = styled.div` | ||
47 | + width: 50px; | ||
48 | + position: fixed; | ||
49 | + top: 18%; | ||
50 | + right: 43%; | ||
51 | +`; | ||
52 | + | ||
53 | +const AdvancedWrap = styled.div` | ||
54 | + width: 50px; | ||
55 | + position: fixed; | ||
56 | + top: 27%; | ||
57 | + right: 43%; | ||
58 | +`; | ||
59 | + | ||
60 | +const TextWrap = styled.div` | ||
61 | + position: fixed; | ||
62 | + width: 340px; | ||
63 | + top: ${props => props.top}; | ||
64 | + right: ${props => props.right}; | ||
65 | + border-bottom: 2px solid #dee2e6; | ||
66 | + padding-left: 20px; | ||
67 | + padding-bottom: ${props => props.bottom}; | ||
68 | +`; | ||
69 | + | ||
70 | +const Modal = ({ showModal, setShowModal }) => { | ||
71 | + const modalRef = useRef(); | ||
72 | + const closeModal = e => { | ||
73 | + if (modalRef.current === e.target) { | ||
74 | + setShowModal(false); | ||
75 | + } | ||
76 | + }; | ||
77 | + | ||
78 | + return ( | ||
79 | + <> | ||
80 | + {showModal ? ( | ||
81 | + <Background onClick={closeModal}> | ||
82 | + <ModalWrapper> | ||
83 | + <ModalContent> | ||
84 | + <TextWrap top="18.5%" right="28.5%" bottom="19px"> | ||
85 | + 기본검색 | ||
86 | + </TextWrap> | ||
87 | + <StandardWrap> | ||
88 | + <Input float="left" color="blue" width="140px" size="10px" /> | ||
89 | + </StandardWrap> | ||
90 | + <TextWrap top="27%" right="28.5%" bottom="137px"> | ||
91 | + 고급검색 | ||
92 | + </TextWrap> | ||
93 | + <AdvancedWrap> | ||
94 | + <Input float="left" color="blue" width="140px" size="10px" /> | ||
95 | + <br /> <br /> | ||
96 | + <Input float="left" color="blue" width="140px" size="10px" /> | ||
97 | + <br /> <br /> | ||
98 | + <Input float="left" color="blue" width="140px" size="10px" /> | ||
99 | + </AdvancedWrap> | ||
100 | + </ModalContent> | ||
101 | + <CloseWrap onClick={() => setShowModal(prev => !prev)}> | ||
102 | + <Button width="100px" color="blue"> | ||
103 | + 닫기 | ||
104 | + </Button> | ||
105 | + </CloseWrap> | ||
106 | + <SearchWrap> | ||
107 | + <Button width="100px" color="gray"> | ||
108 | + 검색 | ||
109 | + </Button> | ||
110 | + </SearchWrap> | ||
111 | + </ModalWrapper> | ||
112 | + </Background> | ||
113 | + ) : null} | ||
114 | + </> | ||
115 | + ); | ||
116 | +}; | ||
117 | +export default Modal; |
-
Please register or login to post a comment