-
Notifications
You must be signed in to change notification settings - Fork 0
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 #51 from KNU-AEYE/38-search-page-too-slow
38 search page too slow
- Loading branch information
Showing
4 changed files
with
49 additions
and
4 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
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,33 @@ | ||
import { Chip, Stack } from "@mui/material"; | ||
import { selectedTagsState } from "@/app/recoil-states"; | ||
import { useRecoilState } from "recoil"; | ||
|
||
const tags = ["새 객체", "넘어짐", "화재", "자동차", "도로"]; | ||
|
||
export default function SearchTagList() { | ||
const [selectedTags, setSelectedTags] = useRecoilState(selectedTagsState); | ||
|
||
const handleChipClick = (tag: string) => { | ||
setSelectedTags((prevSelectedTags) => { | ||
if (prevSelectedTags.includes(tag)) { | ||
return prevSelectedTags.filter((t) => t !== tag); | ||
} else { | ||
return [...prevSelectedTags, tag]; | ||
} | ||
}); | ||
}; | ||
return ( | ||
<Stack flexDirection="row" mb="15px"> | ||
{tags.map((tag, index) => ( | ||
<Chip | ||
label={tag} | ||
key={index} | ||
variant={selectedTags.includes(tag) ? "filled" : "outlined"} | ||
sx={{ margin: "0.5vh" }} | ||
color={selectedTags.includes(tag) ? "primary" : "default"} | ||
onClick={() => handleChipClick(tag)} | ||
/> | ||
))} | ||
</Stack> | ||
); | ||
} |
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