Skip to content

Commit 86522c1

Browse files
committed
feat: MemeDetailPage에서 공유 및 밈 꾸미기 버튼 추가
- MemeDetailPage에 공유하기 및 밈 꾸미기 버튼을 추가하여 사용자 인터랙션을 향상시킴 - 기존의 스크롤 관련 상태 관리 로직을 제거하고, 버튼을 하단에 고정하여 접근성을 개선함 - 스타일을 수정하여 버튼 컨테이너와 액션 버튼을 새롭게 정의함
1 parent eabfa99 commit 86522c1

File tree

2 files changed

+50
-47
lines changed

2 files changed

+50
-47
lines changed

apps/web/src/pages/MemeDetailPage/MemeDetailPage.styles.ts

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const Container = styled.div`
88
}
99
scroll-behavior: smooth;
1010
-webkit-overflow-scrolling: touch;
11+
padding-bottom: 100px;
1112
`;
1213

1314
const ImageContainer = styled(motion.div)`
@@ -23,24 +24,33 @@ const Image = styled.img`
2324
border-radius: 12px;
2425
`;
2526

26-
const ShareButton = styled(motion.button)`
27-
position: absolute;
27+
const ButtonContainer = styled.div`
28+
position: fixed;
29+
max-width: 425px;
30+
left: 50%;
31+
transform: translateX(-50%);
32+
bottom: 0;
33+
width: 100%;
34+
padding: 24px 14px;
35+
background-color: ${({ theme }) => theme.palette.gray['gray-10']};
36+
border-top: 1px solid ${({ theme }) => theme.palette.gray['gray-9']};
37+
display: flex;
38+
gap: 10px;
39+
z-index: 10;
40+
`;
41+
42+
const ActionButton = styled.button`
43+
flex: 1;
2844
display: flex;
2945
align-items: center;
46+
justify-content: center;
3047
gap: 4px;
31-
background-color: rgba(0, 0, 0, 0.5);
32-
left: 50%;
33-
transform: translateX(-50%);
34-
bottom: 26px;
35-
border: 1px solid ${({ theme }) => theme.palette.common.white};
48+
background-color: ${({ theme }) => theme.palette.gray['gray-9']};
49+
border: 1px solid ${({ theme }) => theme.palette.gray['gray-8']};
3650
border-radius: 10px;
3751
cursor: pointer;
38-
color: ${({ theme }) => theme.palette.common.white};
39-
padding: 10px 12px;
40-
`;
41-
42-
const ShareButtonText = styled(motion.span)`
43-
${({ theme }) => theme.typography.body.body1};
52+
padding: 14px;
53+
${({ theme }) => theme.typography.title.subhead2};
4454
color: ${({ theme }) => theme.palette.common.white};
4555
`;
4656

@@ -99,12 +109,12 @@ export {
99109
ImageContainer,
100110
Image,
101111
ContentContainer,
102-
ShareButton,
103-
ShareButtonText,
112+
ButtonContainer,
113+
ActionButton,
104114
YearBadge,
105115
YearText,
106116
Title,
107117
HashTags,
108118
SectionTitle,
109119
SectionText,
110-
};
120+
};

apps/web/src/pages/MemeDetailPage/index.tsx

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import Layout from '@/components/Layout';
2-
import { ShareIcon, SymbolThreeIcon, SymbolTwoIcon } from '@/assets/icons';
2+
import {
3+
MemeDesignPenIcon,
4+
ShareIcon,
5+
SymbolThreeIcon,
6+
SymbolTwoIcon,
7+
} from '@/assets/icons';
38
import { nativeBridge } from '@/utils/bridge';
49
import * as S from './MemeDetailPage.styles';
510
import { useTheme } from '@emotion/react';
6-
import { useRef, useState, useEffect } from 'react';
7-
import { useScroll, useTransform, useSpring } from 'motion/react';
11+
import { useRef } from 'react';
812
import { useParams } from 'react-router-dom';
913
import { useMemeDetailQuery } from '@meme_wiki/apis';
1014

@@ -14,22 +18,6 @@ const MemeDetailPage = () => {
1418

1519
const theme = useTheme();
1620
const containerRef = useRef<HTMLDivElement>(null);
17-
const { scrollY } = useScroll({ container: containerRef });
18-
19-
const height = useTransform(scrollY, [0, 60], [400, 175]);
20-
const smoothHeight = useSpring(height, {
21-
stiffness: 300,
22-
damping: 50,
23-
});
24-
25-
const [isTextVisible, setIsTextVisible] = useState(true);
26-
27-
useEffect(() => {
28-
const unsubscribe = scrollY.on('change', (latest) => {
29-
setIsTextVisible(latest < 1);
30-
});
31-
return () => unsubscribe();
32-
}, [scrollY]);
3321

3422
return (
3523
<Layout
@@ -38,22 +26,11 @@ const MemeDetailPage = () => {
3826
}}
3927
>
4028
<S.Container ref={containerRef}>
41-
<S.ImageContainer style={{ height: smoothHeight }}>
29+
<S.ImageContainer>
4230
<S.Image
4331
src={memeDetail?.success.imgUrl}
4432
alt={memeDetail?.success.title}
4533
/>
46-
<S.ShareButton
47-
onClick={() => {
48-
nativeBridge.shareMeme({
49-
title: memeDetail?.success.title ?? '',
50-
image: memeDetail?.success.imgUrl ?? '',
51-
});
52-
}}
53-
>
54-
<ShareIcon width={24} height={24} />
55-
{isTextVisible && <S.ShareButtonText>공유하기</S.ShareButtonText>}
56-
</S.ShareButton>
5734
</S.ImageContainer>
5835
<S.ContentContainer>
5936
<S.YearBadge>
@@ -75,6 +52,22 @@ const MemeDetailPage = () => {
7552
<S.SectionText>{memeDetail?.success.origin}</S.SectionText>
7653
</S.ContentContainer>
7754
</S.Container>
55+
<S.ButtonContainer>
56+
<S.ActionButton
57+
onClick={() => {
58+
nativeBridge.shareMeme({
59+
title: memeDetail?.success.title ?? '',
60+
image: memeDetail?.success.imgUrl ?? '',
61+
});
62+
}}
63+
>
64+
<ShareIcon width={24} height={24} />
65+
공유하기
66+
</S.ActionButton>
67+
<S.ActionButton>
68+
<MemeDesignPenIcon width={24} height={24} />밈 꾸미기
69+
</S.ActionButton>
70+
</S.ButtonContainer>
7871
</Layout>
7972
);
8073
};

0 commit comments

Comments
 (0)