Skip to content

Commit 9a3e467

Browse files
committed
feat: 밈 상세 페이지 공유 버튼 애니메이션 및 스타일 개선
- 공유 버튼의 애니메이션을 추가하고, 버튼의 크기 및 텍스트의 투명도 조정 - 아이콘을 SymbolThreeIcon으로 변경하고, 섹션 제목을 '이럴 때 쓰세요'로 수정 - 스타일을 개선하여 레이아웃과 사용자 경험 향상
1 parent 2b58486 commit 9a3e467

File tree

2 files changed

+52
-24
lines changed

2 files changed

+52
-24
lines changed

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,20 @@ const Container = styled.div`
1111
}
1212
scroll-behavior: smooth;
1313
-webkit-overflow-scrolling: touch;
14+
position: relative;
1415
`;
1516

1617
const ImageContainer = styled(motion.div)`
1718
width: 100%;
1819
position: sticky;
1920
top: 0;
2021
z-index: 10;
21-
padding: 14px;
2222
background-color: ${({ theme }) => theme.palette.gray['gray-10']};
23+
display: flex;
24+
flex-direction: column;
25+
padding: 14px;
26+
overflow: visible;
27+
position: relative;
2328
`;
2429

2530
const Image = styled.img`
@@ -31,29 +36,39 @@ const Image = styled.img`
3136

3237
const ShareButton = styled(motion.button)`
3338
position: absolute;
34-
display: flex;
39+
display: inline-flex;
3540
align-items: center;
36-
gap: 4px;
41+
justify-content: center;
42+
gap: 8px;
3743
background-color: rgba(0, 0, 0, 0.5);
3844
left: 50%;
3945
transform: translateX(-50%);
4046
bottom: 26px;
4147
border: 1px solid ${({ theme }) => theme.palette.common.white};
4248
border-radius: 10px;
49+
height: 44px;
50+
min-width: 44px;
51+
padding: 0 12px;
4352
cursor: pointer;
4453
color: ${({ theme }) => theme.palette.common.white};
54+
transition: all 0.2s ease;
55+
z-index: 20;
56+
white-space: nowrap;
4557
`;
4658

4759
const ShareButtonText = styled(motion.span)`
4860
${({ theme }) => theme.typography.body.body1};
4961
color: ${({ theme }) => theme.palette.common.white};
50-
overflow: hidden;
51-
white-space: nowrap;
62+
display: block;
5263
`;
5364

5465
const ContentContainer = styled.div`
55-
padding: 20px 14px;
66+
padding: 0 14px 20px;
5667
background-color: ${({ theme }) => theme.palette.gray['gray-10']};
68+
margin-top: -20px;
69+
position: relative;
70+
z-index: 20;
71+
border-radius: 20px 20px 0 0;
5772
`;
5873

5974
const YearBadge = styled.div`

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

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Layout from '@/components/Layout';
2-
import { ShareIcon, SymbolTwoIcon } from '@/assets/icons';
2+
import { ShareIcon, SymbolThreeIcon, SymbolTwoIcon } from '@/assets/icons';
33
import { nativeBridge } from '@/utils/bridge';
44
import * as S from './MemeDetailPage.styles';
55
import { useTheme } from '@emotion/react';
@@ -28,31 +28,36 @@ const MemeDetailPage = () => {
2828
const containerRef = useRef<HTMLDivElement>(null);
2929
const { scrollY } = useScroll({ container: containerRef });
3030

31-
const height = useTransform(scrollY, [0, 200], [400, 200]);
31+
const height = useTransform(scrollY, [0, 200], [400, 250]);
3232
const smoothHeight = useSpring(height, {
33-
stiffness: 200,
33+
stiffness: 100,
3434
damping: 20,
35-
mass: 0.5,
3635
});
3736

38-
const textWidth = useTransform(scrollY, [0, 50], [100, 0]);
37+
// 공유하기 버튼 애니메이션
38+
const buttonWidth = useTransform(scrollY, [0, 50], [116, 44]);
39+
const textOpacity = useTransform(scrollY, [0, 30], [1, 0]);
40+
const textWidth = useTransform(scrollY, [0, 30], [68, 0]);
41+
42+
const smoothButtonWidth = useSpring(buttonWidth, {
43+
stiffness: 400,
44+
damping: 40,
45+
});
46+
3947
const smoothTextWidth = useSpring(textWidth, {
40-
stiffness: 300,
41-
damping: 30,
48+
stiffness: 400,
49+
damping: 40,
4250
});
4351

44-
const padding = useTransform(scrollY, [0, 50], [16, 10]);
45-
const smoothPadding = useSpring(padding, {
46-
stiffness: 300,
47-
damping: 30,
52+
const smoothTextOpacity = useSpring(textOpacity, {
53+
stiffness: 400,
54+
damping: 40,
4855
});
4956

5057
return (
5158
<Layout
5259
layoutStyle={{
5360
backgroundColor: theme.palette.gray['gray-10'],
54-
height: '100vh',
55-
overflow: 'hidden',
5661
}}
5762
>
5863
<S.Container ref={containerRef}>
@@ -62,7 +67,9 @@ const MemeDetailPage = () => {
6267
alt={DUMMY_DATA.success.title}
6368
/>
6469
<S.ShareButton
65-
style={{ padding: smoothPadding }}
70+
style={{
71+
width: smoothButtonWidth,
72+
}}
6673
onClick={() => {
6774
nativeBridge.shareMeme({
6875
title: DUMMY_DATA.success.title,
@@ -71,7 +78,13 @@ const MemeDetailPage = () => {
7178
}}
7279
>
7380
<ShareIcon width={24} height={24} />
74-
<S.ShareButtonText style={{ maxWidth: smoothTextWidth }}>
81+
<S.ShareButtonText
82+
style={{
83+
opacity: smoothTextOpacity,
84+
width: smoothTextWidth,
85+
overflow: 'hidden',
86+
}}
87+
>
7588
공유하기
7689
</S.ShareButtonText>
7790
</S.ShareButton>
@@ -86,12 +99,12 @@ const MemeDetailPage = () => {
8699
</S.HashTags>
87100
<S.SectionTitle>
88101
<SymbolTwoIcon width={18} height={18} />
89-
용도
102+
이럴 때 쓰세요
90103
</S.SectionTitle>
91104
<S.SectionText>{DUMMY_DATA.success.usage}</S.SectionText>
92105
<S.SectionTitle>
93-
<SymbolTwoIcon width={18} height={18} />
94-
유래
106+
<SymbolThreeIcon width={18} height={18} />
107+
이렇게 시작됐어요
95108
</S.SectionTitle>
96109
<S.SectionText>{DUMMY_DATA.success.origin}</S.SectionText>
97110
</S.ContentContainer>

0 commit comments

Comments
 (0)