Skip to content

Commit 2945c95

Browse files
committed
feat: 밈 상세 화면 비율 수정
1 parent 0fc9755 commit 2945c95

File tree

2 files changed

+24
-52
lines changed

2 files changed

+24
-52
lines changed

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

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import styled from '@emotion/styled';
22
import { motion } from 'motion/react';
33

44
const Container = styled.div`
5+
width: 100%;
6+
height: 100%;
57
overflow-y: auto;
8+
background-color: ${({ theme }) => theme.palette.gray['gray-10']};
69
&::-webkit-scrollbar {
710
display: none;
811
}
@@ -14,13 +17,9 @@ const ImageContainer = styled(motion.div)`
1417
width: 100%;
1518
position: sticky;
1619
top: 0;
20+
z-index: 10;
1721
padding: 14px;
18-
max-height: 70vh;
19-
20-
@media (max-width: 768px) {
21-
padding: 10px;
22-
max-height: 50vh;
23-
}
22+
background-color: ${({ theme }) => theme.palette.gray['gray-10']};
2423
`;
2524

2625
const Image = styled.img`
@@ -43,36 +42,18 @@ const ShareButton = styled(motion.button)`
4342
border-radius: 10px;
4443
cursor: pointer;
4544
color: ${({ theme }) => theme.palette.common.white};
46-
width: fit-content;
47-
min-width: 44px;
48-
min-height: 44px;
49-
justify-content: center;
50-
51-
@media (max-width: 768px) {
52-
bottom: 16px;
53-
padding: 8px 12px;
54-
}
5545
`;
5646

57-
const ShareTextWrapper = styled(motion.div)`
58-
display: flex;
59-
align-items: center;
60-
`;
61-
62-
const ShareButtonText = styled.span`
47+
const ShareButtonText = styled(motion.span)`
6348
${({ theme }) => theme.typography.body.body1};
6449
color: ${({ theme }) => theme.palette.common.white};
50+
overflow: hidden;
6551
white-space: nowrap;
6652
`;
6753

6854
const ContentContainer = styled.div`
6955
padding: 20px 14px;
7056
background-color: ${({ theme }) => theme.palette.gray['gray-10']};
71-
margin-top: 40px;
72-
73-
@media (max-width: 768px) {
74-
margin-top: 32px;
75-
}
7657
`;
7758

7859
const YearBadge = styled.div`
@@ -127,7 +108,6 @@ export {
127108
Image,
128109
ContentContainer,
129110
ShareButton,
130-
ShareTextWrapper,
131111
ShareButtonText,
132112
YearBadge,
133113
YearText,

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

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import Layout from '@/components/Layout';
2-
import { ShareIcon, SymbolTwoIcon, SymbolThreeIcon } from '@/assets/icons';
2+
import { ShareIcon, SymbolTwoIcon } from '@/assets/icons';
33
import { nativeBridge } from '@/utils/bridge';
44
import * as S from './MemeDetailPage.styles';
55
import { useTheme } from '@emotion/react';
66
import { useRef } from 'react';
7-
import { useScroll, useTransform, useSpring, anticipate } from 'motion/react';
7+
import { useScroll, useTransform, useSpring } from 'motion/react';
88

99
const 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

Comments
 (0)