-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from ghojeong/fe/41/new-search-bar
[FE] search bar toggle 기능 추가
- Loading branch information
Showing
10 changed files
with
306 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,55 @@ | ||
import CalendarModal from "components/SearchBar/Calendar/CalendarModal"; | ||
import CalendarModal from "./CalendarModal"; | ||
import styled from "styled-components"; | ||
import * as S from "components/SearchBar/SearchBarStyles"; | ||
import CancelButton from "components/common/CancelButton"; | ||
|
||
import { | ||
checkInClickState, | ||
checkOutClickState, | ||
searchBarClickState, | ||
} from "recoil/Atoms"; | ||
import { useRecoilValue, useSetRecoilState } from "recoil"; | ||
|
||
const Calendar = () => { | ||
const setsSearchBarClick = useSetRecoilState(searchBarClickState); | ||
const isCheckInClicked = useRecoilValue(checkInClickState); | ||
const isCheckOutClicked = useRecoilValue(checkOutClickState); | ||
|
||
return ( | ||
<> | ||
<S.SearchBarBox _width="20%" className="check-in"> | ||
<S.SearchBarTitle>체크인</S.SearchBarTitle> | ||
<S.SearchBarText>날짜 입력</S.SearchBarText> | ||
<CancelButton /> | ||
</S.SearchBarBox> | ||
<S.SearchBarBox _width="20%" className="check-out"> | ||
<S.SearchBarTitle>체크아웃</S.SearchBarTitle> | ||
<S.SearchBarText>날짜 입력</S.SearchBarText> | ||
<CancelButton /> | ||
</S.SearchBarBox> | ||
<CalendarModal /> | ||
<CalendarLayout> | ||
<S.SearchBarBox | ||
_width="40%" | ||
className="check-in" | ||
_clicked={isCheckInClicked} | ||
onClick={() => { | ||
setsSearchBarClick("IN"); | ||
}} | ||
> | ||
<S.SearchBarTitle>체크인</S.SearchBarTitle> | ||
<S.SearchBarText>날짜 입력</S.SearchBarText> | ||
<CancelButton /> | ||
</S.SearchBarBox> | ||
<S.SearchBarBox | ||
_width="50%" | ||
className="check-out" | ||
_clicked={isCheckOutClicked} | ||
onClick={() => { | ||
setsSearchBarClick("OUT"); | ||
}} | ||
> | ||
<S.SearchBarTitle>체크아웃</S.SearchBarTitle> | ||
<S.SearchBarText>날짜 입력</S.SearchBarText> | ||
<CancelButton /> | ||
</S.SearchBarBox> | ||
</CalendarLayout> | ||
{(isCheckInClicked || isCheckOutClicked) && <CalendarModal />} | ||
</> | ||
); | ||
}; | ||
const CalendarLayout = styled.div` | ||
display: flex; | ||
width: 60%; | ||
`; | ||
|
||
export default Calendar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
import { useState } from "react"; | ||
import GuestsModal from "./GuestsModal"; | ||
import * as S from "components/SearchBar/SearchBarStyles"; | ||
import CancelButton from "components/common/CancelButton"; | ||
import { guestsClickState, searchBarClickState } from "recoil/Atoms"; | ||
import { useRecoilValue, useSetRecoilState } from "recoil"; | ||
|
||
const Guests = () => { | ||
return <div>??</div>; | ||
const setsSearchBarClick = useSetRecoilState(searchBarClickState); | ||
const isClicked = useRecoilValue(guestsClickState); | ||
const handleClick = () => { | ||
setsSearchBarClick("GUESTS"); | ||
}; | ||
|
||
return ( | ||
<> | ||
<S.SearchBarBox | ||
_width="30%" | ||
className="check-in" | ||
_clicked={isClicked} | ||
onClick={handleClick} | ||
> | ||
<S.SearchBarTitle>인원</S.SearchBarTitle> | ||
<S.SearchBarText _overFlow={true}>게스트 추가</S.SearchBarText> | ||
<CancelButton _right="30%" /> | ||
</S.SearchBarBox> | ||
{isClicked && <GuestsModal />} | ||
</> | ||
); | ||
}; | ||
|
||
export default Guests; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
import React from 'react' | ||
|
||
import { CalendarModalLayout } from "components/SearchBar/Calendar/CalendarStyles"; | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import { guestsClickState, searchBarClickState } from "recoil/Atoms"; | ||
import { useRecoilValue, useSetRecoilState } from "recoil"; | ||
function GuestsModal() { | ||
return ( | ||
<div> | ||
|
||
</div> | ||
) | ||
const isClicked = useRecoilValue(guestsClickState); | ||
return isClicked ? <ModalLayout>디코~~~</ModalLayout> : <></>; | ||
} | ||
|
||
export default GuestsModal | ||
const ModalLayout = styled.div` | ||
position: absolute; //relative는 SearchBarLayout 입니다 | ||
top: 100%; | ||
width: 400px; | ||
height: 355px; | ||
right: 0; | ||
z-index: 1; | ||
overflow: hidden; | ||
margin-top: 1.2rem; | ||
background: #ffffff; | ||
box-shadow: rgb(0 0 0 / 20%) 0px 6px 20px; | ||
border-radius: 40px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
flex-direction: column; | ||
`; | ||
export default GuestsModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 22 additions & 2 deletions
24
frontend/src/components/SearchBar/RoomPrice/RoomPriceModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
import styled from "styled-components"; | ||
import { roomPriceClickState, searchBarClickState } from "recoil/Atoms"; | ||
import { useRecoilValue, useSetRecoilState } from "recoil"; | ||
const RoomPriceModal = () => { | ||
return <div></div>; | ||
const isClicked = useRecoilValue(roomPriceClickState); | ||
return isClicked ? <ModalLayout>데이지~~</ModalLayout> : <></>; | ||
}; | ||
|
||
const ModalLayout = styled.div` | ||
position: absolute; //relative는 SearchBarLayout 입니다 | ||
top: 100%; | ||
width: 493px; | ||
height: 364px; | ||
right: 0; | ||
z-index: 1; | ||
overflow: hidden; | ||
margin-top: 1.2rem; | ||
background: #ffffff; | ||
box-shadow: rgb(0 0 0 / 20%) 0px 6px 20px; | ||
border-radius: 40px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
flex-direction: column; | ||
`; | ||
export default RoomPriceModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import { ReactComponent as CancelBtn } from "image/cancelBtn.svg"; | ||
import styled from "styled-components"; | ||
const CancelButton = () => { | ||
|
||
const CancelButton = ({ ...props }) => { | ||
return ( | ||
<CancelButtonWrap> | ||
<CancelButtonWrap _right={props._right}> | ||
<CancelBtn /> | ||
</CancelButtonWrap> | ||
); | ||
}; | ||
|
||
type TButton = { | ||
_right?: number; | ||
}; | ||
const CancelButtonWrap = styled.div` | ||
position: absolute; | ||
top: 2.5rem; | ||
right: 0; | ||
top: 2rem; | ||
right: ${(props: TButton) => (props._right ? props._right : "10%")}; | ||
`; | ||
|
||
export default CancelButton; |
Oops, something went wrong.