Skip to content

Commit

Permalink
♻️ refactor : 북마크 버튼
Browse files Browse the repository at this point in the history
  • Loading branch information
seondal committed Jan 9, 2024
1 parent fc0654c commit 81c3c47
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
22 changes: 22 additions & 0 deletions src/components/Feed/BookmarkButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use client';

import { Icon } from '../Button/Icon';
import { PreparingModal } from '@/components/Modal';
import { useOverlay } from '@/components/Overlay/useOverlay';
import { ICON } from '@/constants/icon';

export default function BookmarkButton() {
const { open } = useOverlay();

return (
<div
className="absolute bottom-6 right-6 h-36 w-36 rounded-24 bg-[#141218] bg-opacity-30 p-6"
onClick={(e) => {
e.preventDefault();
open(({ exit }) => <PreparingModal onClose={exit} />);
}}
>
<Icon icon={ICON.bookmark.white.empty} />
</div>
);
}
17 changes: 2 additions & 15 deletions src/components/Feed/Photo.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
'use client';
import Link from 'next/link';

import { Icon } from '../Button/Icon';
import { PreparingModal } from '@/components/Modal';
import { useOverlay } from '@/components/Overlay/useOverlay';
import { ICON } from '@/constants/icon';
import BookmarkButton from './BookmarkButton';

interface Photo {
imageKey?: string;
Expand All @@ -13,22 +9,13 @@ interface Photo {
}

export default function Photo({ imageKey, source, id }: Photo) {
const { open } = useOverlay();
return (
<Link href={`detail/${id}`} scroll={false}>
<div className="relative mb-16 inline-block h-fit w-full rounded-8">
{imageKey && (
<>
<img src={imageKey} alt={source || ''} className="rounded-8" />
<div
className="absolute bottom-6 right-6 h-36 w-36 rounded-24 bg-white bg-opacity-30 p-6"
onClick={(e) => {
e.preventDefault();
open(({ exit }) => <PreparingModal onClose={exit} />);
}}
>
<Icon icon={ICON.bookmark.white.empty} />
</div>
<BookmarkButton />
</>
)}
</div>
Expand Down

0 comments on commit 81c3c47

Please sign in to comment.