Skip to content

Commit eeb8946

Browse files
committed
design:랜덤 편지 페이지 스와이퍼 적용
1 parent 98dda5c commit eeb8946

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

src/pages/RandomLetters/index.tsx

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
11
import { useState } from 'react';
2+
import { EffectCards } from 'swiper/modules';
3+
import { Swiper, SwiperSlide } from 'swiper/react';
24
import { twMerge } from 'tailwind-merge';
35

6+
import 'swiper/swiper-bundle.css';
7+
48
import { restartIcon } from '@/assets/icons';
59
import BgItem from '@/assets/images/field-4.png';
10+
import ResultLetter from '@/components/ResultLetter';
611

712
import MatchingSelectModal from './MatchingSelectModal';
13+
814
const RandomLettersPage = () => {
915
const categoryList = ['전체', '위로와 공감', '축하와 응원', '고민 상담', '기타'];
1016
const [selectedCategory, setSelectedCategory] = useState('전체');
1117
const [openModal, setOpenModal] = useState<boolean>(false);
1218

19+
const DUMMY_LIST: { stampName: Stamp; title: string }[] = [
20+
{ stampName: '위로와 공감', title: '위로가 필요해요' },
21+
{ stampName: '축하와 응원', title: '저에게 미움받을 용기를 주세요' },
22+
{ stampName: '고민 상담', title: '삶이 무료해서 고민이에요' },
23+
{ stampName: '기타', title: '어제 꾼 꿈이 신기했어요' },
24+
{ stampName: '고민 상담', title: '삶이 유료해서 고민이에요' },
25+
{ stampName: '축하와 응원', title: '어제 취업했어요!!!!' },
26+
{ stampName: '축하와 응원', title: '어제 게임 신기록 세웠어요!!!!!' },
27+
{ stampName: '기타', title: '기타는 핑거스타일이 멋있는거 같아요' },
28+
{ stampName: '위로와 공감', title: '10년지기 친구가 이사를 가요' },
29+
{
30+
stampName: '기타',
31+
title:
32+
'햄부기햄북 햄북어 햄북스딱스 함부르크햄부가우가 햄비기햄부거 햄부가티햄부기온앤 온 을 차려오거라.',
33+
},
34+
];
35+
1336
return (
1437
<>
1538
{openModal && <MatchingSelectModal setOpenModal={setOpenModal} />}
@@ -24,10 +47,19 @@ const RandomLettersPage = () => {
2447
리스트 새로고침
2548
</span>
2649
</button>
27-
<div
28-
className="bg-accent-3 h-50 w-75 cursor-pointer"
29-
onClick={() => setOpenModal(true)}
30-
></div>
50+
<div className="mx-auto w-full max-w-75">
51+
<Swiper effect={'cards'} grabCursor={true} modules={[EffectCards]} className="mySwiper">
52+
{DUMMY_LIST.map((list, idx) => {
53+
return (
54+
<SwiperSlide key={idx}>
55+
<div className="w-full cursor-pointer" onClick={() => setOpenModal(true)}>
56+
<ResultLetter stampName={list.stampName} title={list.title} />
57+
</div>
58+
</SwiperSlide>
59+
);
60+
})}
61+
</Swiper>
62+
</div>
3163
</div>
3264
<div className="mt-11 flex w-60 flex-wrap items-center justify-center gap-2">
3365
{categoryList.map((category, idx) => {

src/pages/Write/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ const WritePage = () => {
2020
text: '요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민요롷고그런그런 고민',
2121
},
2222
]);
23-
useEffect(() => {
24-
setPrevLetter(null);
25-
});
23+
// useEffect(() => {
24+
// setPrevLetter(null);
25+
// });
2626

2727
const theme = useWrite((state) => state.theme);
2828

0 commit comments

Comments
 (0)