-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
770 additions
and
129 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,13 +1,44 @@ | ||
import { IoIosArrowDown } from "react-icons/io"; | ||
import { IoIosArrowUp } from "react-icons/io"; | ||
import Input from "./Input"; | ||
import React,{useState} from "react"; | ||
import React, { useEffect, useState } from "react"; | ||
|
||
type DropDownProps = { | ||
alcohol: string[]; | ||
showDropDown: boolean; | ||
toggleDropDown: Function; | ||
Selection: Function; | ||
}; | ||
|
||
const DropDown: React.FC<DropDownProps> = ({ | ||
alcohol, | ||
Selection, | ||
}: DropDownProps): JSX.Element => { | ||
const [showDropDown, setShowDropDown] = useState<boolean>(false); | ||
|
||
const onClickHandler = (alcohol: string): void => { | ||
Selection(alcohol); | ||
}; | ||
|
||
useEffect(() => { | ||
setShowDropDown(showDropDown); | ||
}, [showDropDown]); | ||
|
||
function DropDown() { | ||
return ( | ||
<div className=""> | ||
|
||
<div className={showDropDown ? "dropdown" : "dropdown active"}> | ||
{alcohol.map((alcohol: string, index: number): JSX.Element => { | ||
return ( | ||
<p | ||
key={index} | ||
onClick={(): void => { | ||
onClickHandler(alcohol); | ||
}} | ||
> | ||
{alcohol} | ||
</p> | ||
); | ||
})} | ||
</div> | ||
); | ||
} | ||
}; | ||
export default DropDown; |
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React, { useState } from "react"; | ||
import DropDown from "./DropDown"; | ||
|
||
const Menu: React.FC = (): JSX.Element => { | ||
const [showDropDown, setShowDropDown] = useState<boolean>(false); | ||
const [select, setSelect] = useState<string>(""); | ||
const degree = () => { | ||
return ["낮음", "중간", "높음"]; | ||
}; | ||
|
||
/** | ||
* Toggle the drop down menu | ||
*/ | ||
const toggleDropDown = () => { | ||
setShowDropDown(!showDropDown); | ||
}; | ||
|
||
/** | ||
* Hide the drop down menu if click occurs | ||
* outside of the drop-down element. | ||
* | ||
* @param event The mouse event | ||
*/ | ||
const dismissHandler = (event: React.FocusEvent<HTMLButtonElement>): void => { | ||
if (event.currentTarget === event.target) { | ||
setShowDropDown(false); | ||
} | ||
}; | ||
|
||
/** | ||
* Callback function to consume the | ||
* city name from the child component | ||
* | ||
* @param city The selected city | ||
*/ | ||
const Selection = (degree: string): void => { | ||
setSelect(degree); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className="border-b border-solid"></div> | ||
<button | ||
className={showDropDown ? "active" : undefined} | ||
onClick={(): void => toggleDropDown()} | ||
onBlur={(e: React.FocusEvent<HTMLButtonElement>): void => | ||
dismissHandler(e) | ||
} | ||
> | ||
<div className="border p-2 rounded-lg"> | ||
{select ? "알코올 도수: " + select : "알코올 도수"}{" "} | ||
</div> | ||
{showDropDown && ( | ||
<DropDown | ||
alcohol={degree()} | ||
showDropDown={false} | ||
toggleDropDown={(): void => toggleDropDown()} | ||
Selection={Selection} | ||
/> | ||
)} | ||
</button> | ||
</> | ||
); | ||
}; | ||
|
||
export default Menu; |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { SetStateAction } from "react"; | ||
import Display from "../atom/Display"; | ||
import RatingSection from "../atom/RatingSection"; | ||
import OrderSection from "../organisms/OrderSection"; | ||
import AlcoholTitle from "../atom/Title"; | ||
import Elements from "../atom/Elements"; | ||
import Searchbar from "../molecule/Searchbar"; | ||
import { HiSearch } from "react-icons/hi"; | ||
import Menu from "../atom/Menu"; | ||
|
||
function AlcoholSearchPage() { | ||
return ( | ||
<div className=""> | ||
<div className="flex justify-center mt-10"> | ||
<input className='rounded-2xl w-80 p-2 | ||
text-base font-semibold outline-1 outline-[#cdcdcd]' | ||
type="search" placeholder="주류를 검색해보세요!"></input> | ||
|
||
<HiSearch className="m-2"size="30px" /> | ||
</div> | ||
<Menu/> | ||
|
||
</div> | ||
); | ||
} | ||
|
||
export default AlcoholSearchPage; |
Oops, something went wrong.