11import Layout from '@/components/Layout' ;
2- import { ShareIcon , SymbolTwoIcon } from '@/assets/icons' ;
2+ import { ShareIcon , SymbolThreeIcon , SymbolTwoIcon } from '@/assets/icons' ;
33import { nativeBridge } from '@/utils/bridge' ;
44import * as S from './MemeDetailPage.styles' ;
55import { 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