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

Archive Page Markup #67

Merged
merged 71 commits into from
Jan 10, 2024
Merged

Archive Page Markup #67

merged 71 commits into from
Jan 10, 2024

Conversation

Jungjjeong
Copy link
Member

[32/feature/archive-page] Archive Page Markup


๐Ÿ™‹โ€ Summary (์š”์•ฝ)

  1. archive page Markup
  • preview
  • marble-canvas
  • marble-grid

์ฐธ๊ณ 

  • ์ž„์‹œ appBar ํฌํ•จ
  • canvas์˜ ๊ธ€์ž ์ƒ‰์ƒ, ์ด๋ฏธ์ง€๊ฐ€ ์‚ด์ง ๊นจ์ ธ ๋ณด์—ฌ ์ถ”ํ›„ ํฌ๊ธฐ ๋ณ€๊ฒฝ์„ ๊ณ ๋ ค์ค‘์ž…๋‹ˆ๋‹ค.
  • ์ด๋ฏธ ํ™•์ธํ•œ ๊ตฌ์Šฌ / ํ™•์ธํ•˜์ง€ ์•Š์€ ๊ตฌ์Šฌ ๋ฆฌ์ŠคํŠธ ์ƒํƒœ๊ฐ’์˜ ๊ฒฝ์šฐ, ์ถ”ํ›„ archive page ์ตœ์ƒ๋‹จ์—์„œ ๊ด€๋ฆฌํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.
  • fab-button ์˜ addAfterStyle variable
    • text๊ฐ€ ์‚ฝ์ž…๋˜์–ด๋„ tailwind์—์„œ content๊ฐ’์ด ์ธ์‹๋˜์ง€ ์•Š๋Š” ์ด์Šˆ
    • useMemo ์‚ฌ์šฉํ•˜์—ฌ isOverflow ๊ฐ’์— ๋”ฐ๋ฅธ ๋ฆฌ๋ Œ๋”๋ง๊ณผ ์ƒ๊ด€ ์—†์ด ๊ฐ’์ด ์œ ์ง€๋˜๊ฒŒ ๋ณ€๊ฒฝ
    • after ์Šคํƒ€์ผ ์‚ฝ์ž… ์ˆœ์„œ ์กฐ์ •์„ ์œ„ํ•ด after ๊ฐ€์ƒ ์„ ํƒ์ž ๊ด€๋ จ ์Šคํƒ€์ผ ์ „๋ถ€ ๋ณ€์ˆ˜๋กœ ๋ฌถ์–ด ์‚ฝ์ž…

๐Ÿค” Describe your Change (๋ณ€๊ฒฝ์‚ฌํ•ญ)

1. priview Page

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-01-07 แ„‹แ…ฉแ„’แ…ฎ 6 44 09

related Components

  • marble-card

related Assets

  • marble-bg image
  • arrow icon


2. marble canvas Page

2024-01-07.6.47.12.1.mov

related Components

  • archive-title
  • fab-button
  • marble-modal

related Assets

  • marble 01, 02 images
  • marble-detail(-bg) image
  • bars icon
  • Back icon


3. marble Grid page

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-01-07 แ„‹แ…ฉแ„’แ…ฎ 6 52 17

related Components

  • archive-title
  • fab-button
  • marble-modal
  • marble-grid-item
  • switch

related Assets

  • marble icon
  • marble-detail(-bg) image


4. Common Components

  • Confirm
แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-01-07 แ„‹แ…ฉแ„’แ…ฎ 6 56 39

usage

// === EX) Child Component : Pages

const { confirm } = useContext(ConfirmContext);
const result = await confirm(
  {
    title: "์นญ์ฐฌ๋ฐ˜์‘์„ ์‚ญ์ œํ• ๊นŒ์š”?",
    description: "์‚ญ์ œ๋œ ์นญ์ฐฌ๋ฐ˜์‘์€ ๋ณต๊ตฌํ•  ์ˆ˜ ์—†์–ด์š”.",
  },
  {
    text: "์‚ญ์ œ",
    // or add another button props
  },
  {
    text: "์ทจ์†Œ",
    // or add another button props
  },
);

// ...


// === EX) Parent Render Components

import { ConfirmDialog } from "@/components/common/confirm/confirm-dialog";
return (
  <ConfirmDialog>
    {/* Child Render Components */}
    <Pages />
  </ConfirmDialog>
)   

๐Ÿ”— Issue number and link (์ฐธ๊ณ )


TODO

1. preview page

  • Add scroll event + Rendering marble-canvas page

2. marble-canvas page

  • Calculate canvas height value
  • Add fab-button function

3. marble-grid page

  • Add detect document.body scroll value
  • Add fab-button function

Jungjjeong and others added 30 commits December 27, 2023 19:06
@Jungjjeong Jungjjeong added the ๐Ÿš€ Feature ์ƒˆ๋กญ๊ฒŒ ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ•ด์š” label Jan 7, 2024
@Jungjjeong Jungjjeong requested a review from klmhyeonwoo January 7, 2024 10:18
@Jungjjeong Jungjjeong self-assigned this Jan 7, 2024
@Jungjjeong Jungjjeong requested review from Chaemin-L and 2-NOW and removed request for klmhyeonwoo and Chaemin-L January 7, 2024 10:19
@klmhyeonwoo
Copy link
Member

๊ตฌ์Šฌ ์•„์ด์Šคํฌ๋ฆผ ํผ ๋ฏธ์ณค๋„ค์š”,,

@Jungjjeong Jungjjeong changed the title [32/feature/archive-page] Archive Page Markup Archive Page Markup Jan 7, 2024
@Jungjjeong Jungjjeong changed the base branch from main to dev January 7, 2024 13:51
Copy link
Member

@2-NOW 2-NOW left a comment

Choose a reason for hiding this comment

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

๋„ˆ๋ฌด ๊ณ ์ƒ๋งŽ์œผ์…จ์Šต๋‹ˆ๋‹ค !!! ๐ŸŽ‰

src/hooks/useWindowScrollY.ts Outdated Show resolved Hide resolved
src/components/common/confirm/confirm.tsx Outdated Show resolved Hide resolved

interface Props {
isOpen: boolean;
setIsOpen: Dispatch<SetStateAction<boolean>>;
Copy link
Member

Choose a reason for hiding this comment

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

ํ˜น์‹œ setIsOpen์œผ๋กœ setState๋ฅผ ์ง์ ‘ ์ฃผ์ž…๋ฐ›๊ธฐ๋ณด๋‹ค๋Š”
onBackClick ๋“ฑ ์ด๋ฒคํŠธ ๋ฐœ์ƒ ์‹œ callback์„ ์ฃผ์ž…๋ฐ›์•„์„œ back button์— ๋„ฃ์–ด์ฃผ๋Š”๊ฑด ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์š” ?
์ง์ ‘ ์ฃผ์ž…๋ฐ›๋Š” ๊ฒƒ์— ๋น„ํ•ด์„œ ์˜์กด์„ฑ์„ ๋œ์–ด๋‚ผ ์ˆ˜ ์žˆ๋‹ค๋Š” ์žฅ์ ์ด ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์„œ์š”..!

Comment on lines +66 to +74
useEffect(() => {
if (activeMarbleIdx === -1) return;

const activeMarbleId = marbleList[activeMarbleIdx].id;
const updatedIsViewedMarbleList = [
...new Set([...isViewedMarbleList, activeMarbleId]),
];
setIsViewedMarbleList(updatedIsViewedMarbleList);
}, [activeMarbleIdx]);
Copy link
Member

@2-NOW 2-NOW Jan 7, 2024

Choose a reason for hiding this comment

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

์—ฌ๊ธฐ useEffect๋Š” ํ•จ์ˆ˜๋กœ ์น˜ํ™˜ํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š” ..!
์—ฌ๊ธฐ์„œ useEffect๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š๋‹ค๊ณ  ๋Š๋ผ๋Š” ์ด์œ ๋Š”, ์ƒํƒœ์˜ ํŒŒ์ƒํšจ๊ณผ๋ฅผ ์ผ์œผํ‚ค๊ธฐ์œ„ํ•ด ์‚ฌ์šฉ๋˜๋Š” useEffect๋Š” ์ง€์–‘ํ•˜๋Š”๊ฒŒ ์ข‹๋‹ค๊ณ  ๊ฐœ์ธ์ ์œผ๋กœ๋Š” ์ƒ๊ฐํ•˜๊ณ ์žˆ์–ด์„œ์ž…๋‹ˆ๋‹ค !
์ƒํƒœ๊ฐ€ ๋งŽ๊ณ  ๋ณต์žกํ•ด์งˆ ๊ฒฝ์šฐ ์ƒํƒœ๋ณ€๊ฒฝ์œผ๋กœ ์ธํ•œ ๋ถ€์ˆ˜ํšจ๊ณผ๋ฅผ ๋””๋ฒ„๊น…ํ•˜๊ธฐ๊ฐ€ ์–ด๋ ค์› ๋˜ ๊ฒฝํ—˜์ด ์žˆ์–ด์„œ
๊ฐœ์ธ์ ์œผ๋กœ๋Š” ์ตœ๋Œ€ํ•œ handler, ํ˜น์€ ๋ณ€๊ฒฝ์ด trigger ๋˜๋Š” ์ชฝ์œผ๋กœ ์ƒํƒœ๋ณ€๊ฒฝ์„ ์ž‘์„ฑํ•ด์ฃผ๊ณ ์žˆ์–ด์š” !

const removeDupItem = <T>(arr: T[], item: T) => {
  return Array.from(new Set([...arr, item]));
}

// ...
{
  onSlideChange: ({ realIndex: activeMarbleIdx }: SwiperCore) => {
    if (activeMarbleIdx === -1) return;
    const _id = marbleList[activeMarbleIdx].id;
    const newList = removeDupItem(isViewedMarbleList, _id);
    setIsViewedMarbleList(newList);
  }
}

์กฐ๊ธˆ ๋” ๋ณ€๊ฒฝํ•˜์ž๋ฉด setIsViewedMarbleList ์ฃผ์ž…๋„ ์ธํ„ฐํŽ˜์ด์Šค๋กœ ๋Œ์–ด์˜ฌ๋ ค์ค„ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค..!

{
// ...props
onIdChange: (updatedId) => void;
}
// ...

{
  onSlideChange: ({ realIndex: activeMarbleIdx }: SwiperCore) => 
    onIdChange(activeMarbleIdx);
}

// ์ปดํฌ๋„ŒํŠธ ์‚ฌ์šฉ์ฒ˜
<MarbleModal
  onIdChange={(updatedId) => {
    const _id = marbleList[activeMarbleIdx].id;
    const newList = removeDupItem(isViewedMarbleList, _id);
    setIsViewedMarbleList(newList);
  }}
/>

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด MarbleModal์— isViewedMarbleList, setIsViewedMarbleList prop์„ ์ฃผ์ž…ํ•˜์ง€์•Š๊ณ  ์˜์กด์„ฑ์„ ๋œ์–ด๋‚ผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”..!

Copy link
Member Author

Choose a reason for hiding this comment

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

@2-NOW
์š” ๋ถ€๋ถ„์€ description์— ์ ์–ด๋†จ๋˜ ๊ฒƒ๊ณผ ๊ฐ™์ด archive page ์ตœ์ƒ๋‹จ์—์„œ ์ƒํƒœ๋ฅผ ๊ด€๋ฆฌํ•  ์ƒ๊ฐ์ž…๋‹ˆ๋‹ค.
์ž‘์„ฑํ•ด์ฃผ์‹  ๋ฆฌ๋ทฐ ์ฐธ๊ณ ํ•ด์„œ modal open state์™€ viewedList ์ƒํƒœ ๊ด€๋ฆฌ๋ฅผ ๋Œ์–ด์˜ฌ๋ ค ๋ณด๋„๋ก ํ• ๊ฒŒ์š”
์ตœ๊ณ ์˜ ๋ฆฌ๋ทฐ์–ด ๋„˜ ๊ฐ์‚ฌํ•ฉ๋‹น ๐Ÿ’ช๐Ÿป

tailwind.config.js Outdated Show resolved Hide resolved
src/types/archive.d.ts Outdated Show resolved Hide resolved
src/types/common.d.ts Outdated Show resolved Hide resolved
@Chaemin-L
Copy link
Collaborator

์ด๊ฒƒ์ด ์ฝ”๋“œ๋‹ค ๐Ÿ‘
"์™„๋ฒฝ"

@2-NOW
Copy link
Member

2-NOW commented Jan 9, 2024

conflict ํ•ด๊ฒฐํ•˜๊ณ  ๋ณ‘ํ•ฉํ•˜๋ฉด ๋ ๊ฒƒ๊ฐ™์Šต๋‹ˆ๋‹ค ..! @Jungjjeong

@Jungjjeong Jungjjeong merged commit 85fc0a8 into dev Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๐Ÿš€ Feature ์ƒˆ๋กญ๊ฒŒ ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ•ด์š”
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants