Skip to content

Commit 51fbdd9

Browse files
author
리니_이경린
committed
feat: 리뷰 복사 기능 추가
1 parent b3cd7cb commit 51fbdd9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/components/ReviewResult/ReviewResult.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { useEffect } from "react";
2-
32
import confetti from "canvas-confetti";
43
import type { Options as ConfettiOptions } from "canvas-confetti";
54

65
import Toast from "../ui/Toast/Toast";
7-
86
import HomeNavigateConfirmModal from "@/components/HomeNavigateConfirmModal/HomeNavigateConfirmModal";
97
import styles from "@/components/ReviewResult/ReviewResult.module.scss";
108
import Button from "@/components/ui/Button/Button";
@@ -16,9 +14,13 @@ import useToast from "@/hooks/common/useToast";
1614

1715
const ReviewResult = () => {
1816
const { isOpen, handleClose, handleOpen } = useOverlay();
19-
const { isToast, showToast } = useToast(1000); // 1초 후 사라짐
17+
const { isToast, showToast } = useToast(1000);
18+
19+
const reviewText = `오늘 처음으로 청담커피 앤 토스트에서 주문했어요.. 매장도 깔끔하고 직원들도 친절해요!
20+
음료랑 토스트 세트 시켰는데 가성비가 좋네요… 맛도 좋고 양도 많아요!! 다음에도 또 시켜먹을 거예요.`;
2021

2122
const handleCopy = () => {
23+
navigator.clipboard.writeText(reviewText);
2224
showToast();
2325
};
2426

@@ -31,9 +33,7 @@ const ReviewResult = () => {
3133
ticks: 50,
3234
};
3335

34-
confetti({
35-
...setting,
36-
});
36+
confetti(setting);
3737
};
3838

3939
useEffect(() => {
@@ -53,9 +53,7 @@ const ReviewResult = () => {
5353
</div>
5454

5555
<Text variant="bodyLg" color="primary">
56-
오늘 처음으로 청담커피 앤 토스트에서 주문했어요.. 매장도 깔끔하고 직원들도 친절해요!
57-
음료랑 토스트 세트 시켰는데 가성비가 좋네요… 맛도 좋고 양도 많아요!! 다음에도 또 시켜먹을
58-
거예요.
56+
{reviewText}
5957
</Text>
6058
<div className={styles.IconBtn}>
6159
<IconButton text="복사하기" iconName="paste" size="sm" onClick={handleCopy} />

0 commit comments

Comments
 (0)