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

[Feat/#23] Tab & TextBox & BottomSheet & FilterBottomSheet #34

Merged
merged 22 commits into from
Jan 15, 2025

Conversation

ocahs9
Copy link
Collaborator

@ocahs9 ocahs9 commented Jan 13, 2025

๐Ÿ”ฅ Related Issues

โœ… ์ž‘์—… ๋ฆฌ์ŠคํŠธ

  • Tab ๊ตฌํ˜„
  • CheckBoxText ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„ (์ฒดํฌ ์—ฌ๋ถ€์— ๋”ฐ๋ผ ์ƒ‰ ๋‹ฌ๋ผ์ง)
  • DropDownText ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„ (๋‚ด๋ถ€์ ์œผ๋กœ ๋ฐ์ดํ„ฐ ๊ฐ€์ง€๊ณ  ์žˆ์Œ)
  • BottomSheet ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„ (๋ฐ”ํ…€์‹œํŠธ ํ‹€ ์—ญํ• )
  • FilterBottomSheet ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„ (๊ฒŒ์‹œ๊ธ€ ํ•„ํ„ฐ, ๋งˆ์ดํŽ˜์ด์ง€ ๋™๋ฌผ์ •๋ณด ์ˆ˜์ • ํ•„ํ„ฐ)
  • FilterBottomSheet ์ „์—ญ ์ƒํƒœ๋กœ ๋ฆฌํŒฉํ† ๋ง ์ง„ํ–‰ -> Zustand ์ ์šฉ

๐Ÿ”ง ์ž‘์—… ๋‚ด์šฉ

์ปค๋ฎค๋‹ˆํ‹ฐ ๊ฒŒ์‹œ๊ธ€ ์กฐํšŒ, ๊ฒŒ์‹œ๊ธ€ ์ž‘์„ฑ์—์„œ ์‚ฌ์šฉํ•˜๋Š” (+ ๋งˆ์ดํŽ˜์ด์ง€์—์„œ๋„ ์‚ฌ์šฉํ•˜๋Š”) ๋ฐ”ํ…€์‹œํŠธ ํ•„ํ„ฐ๊ฐ€ ์ฃผ ์ž‘์—… ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค!
์ตœ๋Œ€ํ•œ ๋‹จ์ˆœํ•˜๊ฒŒ ๋ฐ์ดํ„ฐ๋ฅผ ์ „๋‹ฌ๋ฐ›๊ฒŒ ํ•˜๊ณ  ์‹ถ์–ด์„œ ๋ฆฌํŒฉํ† ๋ง์— ์š•์‹ฌ๋‚ด๋‹ค๊ฐ€ ์˜คํžˆ๋ ค ๋ณต์žกํ•œ ์ฝ”๋“œ๊ฐ€ ๋˜์–ด๋ฒ„๋ ธ๋„ค์š”..
ํ™•์žฅ์„ฑ์ด ๋งŽ์ด ๋–จ์–ด์ง€๋Š” ๊ฒƒ ๊ฐ™์€๋ฐ, ์ถ”ํ›„ ์Šคํ”„๋ฆฐํŠธ (ํ˜น์€ ์•ฑ์žผ ๋๋‚˜๊ณ ) ๋•Œ ๋ฆฌํŒฉํ† ๋งํ•˜๋Š” ์‹œ๊ฐ„์„ ๊ฐ–๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

์‚ฌ์šฉ ๋ฐฉ๋ฒ•์€ ๋‹จ์ˆœํ•ฉ๋‹ˆ๋‹ค !

  1. ์‚ฌ์šฉํ•˜๊ณ ์ž ํ•˜๋Š” ๊ณณ์—์„œ ๋ฅผ import ํ•ด์„œ ์‚ฌ์šฉํ•œ๋‹ค.
  2. useFilterStore()๋ฅผ import ํ›„ ์‚ฌ์šฉํ•˜์—ฌ setOpen, toggleOpen ์„ ๋ถ„ํ•  ํ• ๋‹น ๋ฐ›์•„ ์‚ฌ์šฉํ•œ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ๋ฐ”ํ…€์‹œํŠธ๋ฅผ open/close ํ•œ๋‹ค.
    (์ฐธ๊ณ ๋กœ, setOpen์€ ์ธ์ž๊ฐ’์œผ๋กœ boolean์„ ์ฃผ์–ด ์กฐ์ ˆํ•˜๋Š” ํ•จ์ˆ˜, toggleOpen์€ ์ธ์ž ์—†์ด ์‹คํ–‰๋˜์–ด open -> close, close -> open ์œผ๋กœ ์ƒํƒœ๋ฅผ ๋ฐ”๊ฟ”์ฃผ๋Š” ํ•จ์ˆ˜ ์ž…๋‹ˆ๋‹ค.)
  3. ์ถ”ํ›„ API ์š”์ฒญ์œผ๋กœ ๋ฐ›์•„์˜จ ๋ฐ์ดํ„ฐ๋Š” useFilterStore() ์—์„œ ๋ถ„ํ•  ํ• ๋‹น ๋ฐ›์•„ ์‚ฌ์šฉํ•˜๋Š” setCategoryData๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ๊ฐ์˜ ํ•„๋“œ์— ์•Œ๋งž์€ ๋ฐ์ดํ„ฐ๋ฅผ ํ• ๋‹นํ•œ๋‹ค. -> ๊ทธ๋ž˜์•ผ ํ•„ํ„ฐ ๋ฐ”ํ…€ ์‹œํŠธ์˜ ๋‚ด์šฉ์ด ๋ Œ๋”๋ง ๋จ (๋ฐ์ดํ„ฐ ํ˜•์‹์€ api์—์„œ ๋ฐ›์•„์˜จ ํ˜•์‹๋งŒ ์ง€ํ‚ค๋ฉด ๋ฉ๋‹ˆ๋‹ค)
image image

์‚ฌ์šฉ ๋ฐฉ๋ฒ•์ด ์ž˜ ์ดํ•ด๊ฐ€ ์•ˆ๊ฐ€๋ฉด, ์–ธ์ œ๋“ ์ง€ ์งˆ๋ฌธ ์ฃผ์„ธ์š”!

๐Ÿ“ฃ ๋ฆฌ๋ทฐ์–ด์—๊ฒŒ ์–ด๋– ์‹ ๊ฐ€์š”?

๏ฟฝapi ๋กœ ๋ฐ›์•„์˜ค๋Š” ๋ฐ์ดํ„ฐ ํ˜•์‹์— ๋งž์ถฐ ์ž‘์—…์„ ์ง„ํ–‰ํ–ˆ๋Š”๋ฐ, ๊ทธ๋Ÿฌ๋‹ค๋ณด๋‹ˆ ํƒ€์ž… ์ •์˜๊ฐ€ ๋งŽ์ด ๊ผฌ์˜€๋˜ ๊ฒƒ๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
์ด๊ฒƒ ๋–„๋ฌธ์— ์ž‘์—… ์‹œ๊ฐ„์ด ๋งŽ์ด ์†Œ์š”๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ, ๋‚˜์ค‘์— ์ƒˆ๋กœ์šด ํ•„๋“œ๊ฐ€ ์ƒ๊ฒผ์„ ๋•Œ ์ผ์ผํžˆ ์ž…๋ ฅํ•ด์ฃผ์–ด์•ผํ•˜๋Š” ๋ถˆํŽธํ•จ์ด ์žˆ๋Š”๋ฐ ์ด๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ์•„์ด๋””์–ด๊ฐ€ ๋– ์˜ค๋ฅด์‹œ๋Š” ๋ถ„์ด ์žˆ๋‹ค๋ฉด ์˜๊ฒฌ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค ~!

๐Ÿ“ธ ์Šคํฌ๋ฆฐ์ƒท / GIF / Link

์˜์ƒ์œผ๋กœ ์ฒจ๋ถ€ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

2025-01-15.6.17.32.1.mov

@ocahs9 ocahs9 self-assigned this Jan 13, 2025
ocahs9 added 13 commits January 14, 2025 06:03
@ocahs9 ocahs9 added ๐Ÿž fix ๋ฒ„๊ทธ๋ฅผ ๊ณ ์นœ ๊ฒฝ์šฐ ๐ŸŽจ design ์‚ฌ์šฉ์ž UI ๋””์ž์ธ ๋ณ€๊ฒฝ - ex) CSS โœจ feat ๊ธฐ๋Šฅ ๊ตฌํ˜„ โ™ป๏ธ refactor ํ”„๋กœ๋•์…˜ ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋ง labels Jan 14, 2025
Copy link
Collaborator

@yarimu yarimu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ง์”€ํ•ด์ฃผ์‹ ๋Œ€๋กœ ์‚ฌ์šฉ๋ฒ• ํ™•์ธ ์™„๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค! ์˜ค๋žœ์‹œ๊ฐ„ ๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค๐Ÿ”†

Copy link
Collaborator

@Leeyoonji23 Leeyoonji23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์‚ฌ์šฉ๋ฒ• ์ˆ™์ง€ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ˆ˜๊ณ ํ•˜์…จ์–ด์š”!!!!

@ocahs9 ocahs9 merged commit dded531 into develop Jan 15, 2025
1 check passed
@@ -31,6 +36,7 @@ const Chip = ({ label, icon = false, color = "blue", onClick }: CombinedChipProp
{label}
{icon && (
<IcDelete
onClick={() => console.log("first")}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2) ์—ฌ๊ธฐ ํ™•์ธํ•ด์ฃผ์„ธ์š”!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฐ”๋กœ ๋ฐ˜์˜ํ–ˆ์Šต๋‹ˆ๋‹ค !

const renderDropDownData = () => {
if (content) {
return content.map((data) => (
//todo: ์นฉ์œผ๋กœ ๋ณ€๊ฒฝ, selected ์ƒํƒœ์ผ ๋•Œ ๋ชจ์Šต๋„ ๋ฐ˜์˜(selectedFilters ์ด์šฉ)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3) ์ด TODO ๋Š” ์ˆ˜์ • ์ ์šฉ ๋œ ์‚ฌํ•ญ์ผ๊นŒ์š”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋„ต ๋ฐ˜์˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค ! ์ถ”ํ›„ ์ง€์šธ๊ฒŒ์šฉ

Comment on lines +31 to +33
useEffect(() => {
console.log(categoryData);
}, [categoryData]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2) useEffect ์— ์ฝœ์†” ๋กœ๊ทธ ์ ์–ด๋‘์‹  ๊ฑฐ ํ•œ๋ฒˆ ํ™•์ธํ•ด์ฃผ์„ธ์š”!!!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋„ต ํ™•์ธํ• ๊ฒŒ์š”!

Comment on lines +37 to +71
(ids as number[]).map((id) => {
const categoryData = useFilterStore.getState().categoryData;
const keyMap: Record<keyof SelectedChips, CategoryType> = {
breedId: "kind",
diseaseIds: "disease",
symptomIds: "symptoms",
} as const;

const category = keyMap[key as keyof SelectedChips];

// ์ค‘์ฒฉ ๋ฐ์ดํ„ฐ ํƒ์ƒ‰
const getNameById = (id: number, category: CategoryType): string | undefined => {
if (category === "kind") {
return categoryData.kind.find((item) => item.id === id)?.name;
}
if (category === "disease") {
return categoryData.disease.flatMap((group) => group.diseases).find((item) => item.id === id)?.name;
}
if (category === "symptoms") {
return categoryData.symptoms.flatMap((group) => group.symptoms).find((item) => item.id === id)
?.name;
}
return undefined;
};

const name = getNameById(id, category);

return (
<Chip
key={`filter-${key}-${id}`}
label={name || "Unknown"}
icon={true}
onClick={() => toggleChips({ id, category: key as keyof SelectedChips })}
/>
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3) return ๋ Œ๋” ์„น์…˜์—์„œ ๋ณ€์ˆ˜ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์ด ์‚ด์ง์€ ์ฝ”๋“œ ๊ฐ€๋…์„ฑ, ๊ตฌ์กฐ ์ƒ ๊ดœ์ฐฎ์€์ง€ ๋ชจ๋ฅด๊ฒ ๋Š”๋ฐ, ํ˜น์‹œ ์ด๋ ‡๊ฒŒ ๊ตฌํ˜„ํ•˜์‹  ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฐ›์•„์˜ค๋Š” ๋ฐ์ดํ„ฐ์˜ depth๊ฐ€ ๊นŠ์–ด์„œ, ํƒ€์ž…์— ๋งž๊ฒŒ ๋ณ€ํ™˜ํ•˜๋Š” ๊ณผ์ •์—์„œ ์ฝ”๋“œ๊ฐ€ ์กฐ๊ธˆ ์ง€์ €๋ถ„ํ•ด์ง€๊ณ  ๊ธธ์–ด์กŒ์Šต๋‹ˆ๋‹ค ใ…œใ…œ
์ถ”ํ›„ ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ์œผ๋ฉด ๊ฐœ์„ ํ•ด๋ณผ๊ฒŒ์š”! ํ˜น์‹œ ์ข‹์€ ๋ฐฉ๋ฒ• ๋– ์˜ค๋ฅด๋ฉด ์ œ์•ˆ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๐ŸŽจ design ์‚ฌ์šฉ์ž UI ๋””์ž์ธ ๋ณ€๊ฒฝ - ex) CSS โœจ feat ๊ธฐ๋Šฅ ๊ตฌํ˜„ ๐Ÿž fix ๋ฒ„๊ทธ๋ฅผ ๊ณ ์นœ ๊ฒฝ์šฐ โ™ป๏ธ refactor ํ”„๋กœ๋•์…˜ ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋ง
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ Feat ] Tab, FilterBottomSheet ๊ตฌํ˜„
4 participants