Showing
1 changed file
with
44 additions
and
27 deletions
... | @@ -19,8 +19,18 @@ const Wrapper = styled.div` | ... | @@ -19,8 +19,18 @@ const Wrapper = styled.div` |
19 | } | 19 | } |
20 | `; | 20 | `; |
21 | 21 | ||
22 | +const HideWrapper = styled.div` | ||
23 | + display: flex; | ||
24 | + flex-direction: column; | ||
25 | + width: 100%; | ||
26 | + height: 100%; | ||
27 | + justify-content: center; | ||
28 | + align-items: center; | ||
29 | + background-color: #535c68; | ||
30 | + opacity: 0.6; | ||
31 | +`; | ||
32 | + | ||
22 | const FormContainer = styled.div` | 33 | const FormContainer = styled.div` |
23 | - visibility: hidden; | ||
24 | display: flex; | 34 | display: flex; |
25 | position: fixed; | 35 | position: fixed; |
26 | background-color: #f5f6fa; | 36 | background-color: #f5f6fa; |
... | @@ -143,35 +153,42 @@ const StyledLink = styled(Link)` | ... | @@ -143,35 +153,42 @@ const StyledLink = styled(Link)` |
143 | } | 153 | } |
144 | `; | 154 | `; |
145 | 155 | ||
146 | -export default ({ roomArray, action }) => { | 156 | +export default ({ roomArray, action, setAction }) => { |
147 | return ( | 157 | return ( |
148 | <Wrapper> | 158 | <Wrapper> |
149 | <Header text={"KhuChat"}></Header> | 159 | <Header text={"KhuChat"}></Header> |
150 | - <RoomWrapper> | 160 | + {action === "showList" ? ( |
151 | - <RoomContainer> | 161 | + <> |
152 | - <RoomUL> | 162 | + <RoomWrapper> |
153 | - {roomArray && | 163 | + <RoomContainer> |
154 | - roomArray.map((e) => ( | 164 | + <RoomUL> |
155 | - <StyledLink to={e.name} key={e.id}> | 165 | + {roomArray && |
156 | - <RoomItem>{e.name}</RoomItem> | 166 | + roomArray.map((e) => ( |
157 | - <FontAwesomeIcon icon={faArrowRight} /> | 167 | + <StyledLink to={e.name} key={e.id}> |
158 | - </StyledLink> | 168 | + <RoomItem>{e.name}</RoomItem> |
159 | - ))} | 169 | + <FontAwesomeIcon icon={faArrowRight} /> |
160 | - </RoomUL> | 170 | + </StyledLink> |
161 | - </RoomContainer> | 171 | + ))} |
162 | - <CreateContainer> | 172 | + </RoomUL> |
163 | - <StyledLink to="/"> | 173 | + </RoomContainer> |
164 | - <span>Create New Room</span> | 174 | + <CreateContainer> |
165 | - </StyledLink> | 175 | + <StyledLink to="/" onClick={() => setAction("makeList")}> |
166 | - </CreateContainer> | 176 | + <span>Create New Room</span> |
167 | - </RoomWrapper> | 177 | + </StyledLink> |
168 | - <FormContainer> | 178 | + </CreateContainer> |
169 | - <Form> | 179 | + </RoomWrapper> |
170 | - <FormText>Room Name</FormText> | 180 | + </> |
171 | - <Input placeholder="Enter new Room name" /> | 181 | + ) : ( |
172 | - <Button text="Submit" /> | 182 | + <HideWrapper className="hideWrapper"> |
173 | - </Form> | 183 | + <FormContainer> |
174 | - </FormContainer> | 184 | + <Form> |
185 | + <FormText>Room Name</FormText> | ||
186 | + <Input placeholder="Enter new Room name" /> | ||
187 | + <Button text="Submit" /> | ||
188 | + </Form> | ||
189 | + </FormContainer> | ||
190 | + </HideWrapper> | ||
191 | + )} | ||
175 | </Wrapper> | 192 | </Wrapper> |
176 | ); | 193 | ); |
177 | }; | 194 | }; | ... | ... |
-
Please register or login to post a comment