Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[염성진] Sprint5 #166

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor. DropDown 버튼 이름 결정 방식 변경
* useState값에 불필요한 값 삭제

* DropDown버튼의 이름을 props로 받아온 값을 참조하여 표시되게 변경
MELATONIN99 committed Jun 23, 2024
commit 9f28da58e85986136948c868bc38b1d53c3e6af6
4 changes: 2 additions & 2 deletions src/components/DropDown/DropDown.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ export default function DropDown(props) {
console.log(props.orderBy);
const nowType = props.orderBy;
const [isOpen, setIsOpen] = useState(false);
const [select, setSelect] = useState(`${nowType}`);
const [select, setSelect] = useState(nowType);
const toggle = () => setIsOpen(!isOpen);
const optionClick = (option) => {
setSelect(option);
@@ -22,7 +22,7 @@ export default function DropDown(props) {

return (
<div className="select-options" onClick={toggle}>
<div className="select-text">{nowType === 'recent' ? '최신순' : '좋아요순'}</div>
<div className="select-text">{select === 'recent' ? '최신순' : '좋아요순'}</div>
{isOpen && (
<ul className="select-options-box">
<li