Skip to content
Binary file added src/assets/images/Share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 18 additions & 2 deletions src/components/common/BottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,34 @@ import { motion } from 'motion/react';
import Icon from '../Icon';
import { useBottomSheet } from './hooks';

type BottomSheetAlign = 'left' | 'centered';

interface BottomSheetProps {
title: string;
align?: BottomSheetAlign;
hasCloseButton?: boolean;
children: React.ReactNode;
}

export default function BottomSheet({
title,
align = 'left',
hasCloseButton = false,
children,
}: BottomSheetProps) {
const { closeBottomSheet } = useBottomSheet();

const isCentered = align === 'centered';

const renderHeader = () =>
isCentered ? (

@YOOJS1205 YOOJS1205 Dec 15, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

기존엔
title을 받고, 나머지 컨텐츠를 children으로 전달하는 형태인데,
왜 center 케이스에는 description, topContent를 별도로 받는 형태로 설계하셨나요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

음 기존 설계와 일관성이 떨어지긴 하네요. children으로 넘기는 형태로 수정하겠습니다.

<div className="flex flex-col items-center text-center px-6">
<h1 className="text-heading-1 mb-5">{title}</h1>
</div>
) : (
<h1 className="pl-5 text-headline-1 pb-5 border-gray-400">{title}</h1>
);

return (
<motion.div
initial={{ y: '100%', opacity: 1 }}
Expand All @@ -23,7 +38,8 @@ export default function BottomSheet({
transition={{ duration: 0.4, ease: 'easeInOut' }}
className="pt-[24px] pb-[36px] rounded-t-2xl relative w-full max-w-[480px] bg-gray-100"
>
<h1 className="pl-5 text-headline-1 pb-5 border-gray-400">{title}</h1>
{renderHeader()}

{hasCloseButton && (
<button
className="absolute top-[24px] right-[24px]"
Expand All @@ -32,7 +48,7 @@ export default function BottomSheet({
<Icon name="Cross" size="large" />
</button>
)}
<hr className="border-gray-200" />

<div>{children}</div>
</motion.div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import BottomSheet from '../BottomSheet';
import { useBottomSheet } from '../BottomSheet/hooks';
import { Button } from '../Button/Button';
import useLinkShareBottomSheet from '../LinkShareBottomSheet/hooks';
import shareImage from '@/assets/images/Share.png';

interface PollCreatedShareBottomSheetProps {
shareUrl: string;
}

export default function PollCreatedShareBottomSheet({
shareUrl,
}: PollCreatedShareBottomSheetProps) {
const { handleClickKakaoShareButton } = useLinkShareBottomSheet({ shareUrl });
const { closeBottomSheet } = useBottomSheet();

return (
<BottomSheet title="투표가 만들어졌어요!" align="centered" hasCloseButton>
<div className="flex flex-col items-center text-center px-6">
<img src={shareImage} alt="Share" className="w-[90px] h-[90px] mb-4" />
<p className="text-headline-1 text-gray-500 mb-7">
투표를 공유하고 다양한 의견을 받아보세요.
</p>
<div className="flex flex-col w-full">
<Button
type="button"
variant="solid"
size="large"
buttonType="primary"
onClick={handleClickKakaoShareButton}
className="flex items-center justify-center"
>
카카오로 공유하기
</Button>
<button
onClick={closeBottomSheet}
className="text-body-1 text-gray-700 underline underline-offset-4 text-center pt-3"
>
나중에 하기
</button>
</div>
</div>
</BottomSheet>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './PollCreatedShareBottomSheet';
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import usePollForm from '../../Provider/hooks';
import useGetMyInfo from '@/api/useGetMyInfo';
import usePostRegistVote from '@/api/usePostRegistVote';
import useUpdateOnboarding from '@/api/useUpdateOnboarding';
import { useBottomSheet } from '@/components/common/BottomSheet/hooks';
import { Button } from '@/components/common/Button/Button';
import Loading from '@/components/common/Loading';
import PollCreatedShareBottomSheet from '@/components/common/PollCreatedShareBottomSheet';

export default function PollRegistButton() {
const navigate = useNavigate();
const { isValid, data: pollData } = usePollForm();
const { data: myInfo } = useGetMyInfo();
const { openBottomSheet } = useBottomSheet();
const { mutate: updateOnboarding } = useUpdateOnboarding();
const { mutate: registVote, isPending: isRegistVotePending } =
usePostRegistVote({
Expand All @@ -19,7 +22,9 @@ export default function PollRegistButton() {
onboardingStep: { ...myInfo.onboardingStep, FIRST_VOTE: false },
});
}
const shareUrl = `${window.location.origin}/posts/${data.postId}?shareUrl=${data.shareUrl}`;
navigate(`/posts/${data.postId}`);
openBottomSheet(<PollCreatedShareBottomSheet shareUrl={shareUrl} />);
},
});

Expand Down