11import Layout from '@/components/Layout' ;
2- import { ShareIcon , SymbolTwoIcon , SymbolThreeIcon } from '@/assets/icons' ;
2+ import { ShareIcon , SymbolTwoIcon } from '@/assets/icons' ;
33import { nativeBridge } from '@/utils/bridge' ;
44import * as S from './MemeDetailPage.styles' ;
55import { useTheme } from '@emotion/react' ;
66import { useRef } from 'react' ;
7- import { useScroll , useTransform , useSpring , anticipate } from 'motion/react' ;
7+ import { useScroll , useTransform , useSpring } from 'motion/react' ;
88
99const DUMMY_DATA = {
1010 resultType : 'SUCCESS' ,
@@ -28,33 +28,31 @@ const MemeDetailPage = () => {
2828 const containerRef = useRef < HTMLDivElement > ( null ) ;
2929 const { scrollY } = useScroll ( { container : containerRef } ) ;
3030
31- const isMobile = window . innerWidth <= 768 ;
32- const heightRange = isMobile ? [ 300 , 150 ] : [ 400 , 200 ] ;
33- const scrollRange = isMobile ? [ 0 , 50 ] : [ 0 , 100 ] ;
34-
35- const height = useTransform ( scrollY , scrollRange , heightRange ) ;
31+ const height = useTransform ( scrollY , [ 0 , 200 ] , [ 400 , 200 ] ) ;
3632 const smoothHeight = useSpring ( height , {
3733 stiffness : 200 ,
38- damping : 30 ,
34+ damping : 20 ,
35+ mass : 0.5 ,
3936 } ) ;
4037
41- const threshold = isMobile ? 15 : 30 ;
42-
43- const isTextVisible = useTransform ( scrollY , [ 0 , threshold ] , [ 1 , 0 ] , {
44- clamp : true ,
45- ease : anticipate ,
38+ const textWidth = useTransform ( scrollY , [ 0 , 50 ] , [ 100 , 0 ] ) ;
39+ const smoothTextWidth = useSpring ( textWidth , {
40+ stiffness : 300 ,
41+ damping : 30 ,
4642 } ) ;
4743
48- const padding = useTransform ( scrollY , [ 0 , threshold ] , [ 10 , 5 ] ) ;
44+ const padding = useTransform ( scrollY , [ 0 , 50 ] , [ 16 , 10 ] ) ;
4945 const smoothPadding = useSpring ( padding , {
50- stiffness : 200 ,
46+ stiffness : 300 ,
5147 damping : 30 ,
5248 } ) ;
5349
5450 return (
5551 < Layout
5652 layoutStyle = { {
5753 backgroundColor : theme . palette . gray [ 'gray-10' ] ,
54+ height : '100vh' ,
55+ overflow : 'hidden' ,
5856 } }
5957 >
6058 < S . Container ref = { containerRef } >
@@ -73,15 +71,9 @@ const MemeDetailPage = () => {
7371 } }
7472 >
7573 < ShareIcon width = { 24 } height = { 24 } />
76- < S . ShareTextWrapper
77- style = { {
78- display : useTransform ( isTextVisible , ( v ) =>
79- v > 0.01 ? 'flex' : 'none' ,
80- ) ,
81- } }
82- >
83- < S . ShareButtonText > 공유하기</ S . ShareButtonText >
84- </ S . ShareTextWrapper >
74+ < S . ShareButtonText style = { { maxWidth : smoothTextWidth } } >
75+ 공유하기
76+ </ S . ShareButtonText >
8577 </ S . ShareButton >
8678 </ S . ImageContainer >
8779 < S . ContentContainer >
@@ -98,7 +90,7 @@ const MemeDetailPage = () => {
9890 </ S . SectionTitle >
9991 < S . SectionText > { DUMMY_DATA . success . usage } </ S . SectionText >
10092 < S . SectionTitle >
101- < SymbolThreeIcon width = { 18 } height = { 18 } />
93+ < SymbolTwoIcon width = { 18 } height = { 18 } />
10294 유래
10395 </ S . SectionTitle >
10496 < S . SectionText > { DUMMY_DATA . success . origin } </ S . SectionText >
0 commit comments