11import React from 'react' ;
2- import Image from 'next/image' ;
2+ import Image , { StaticImageData } from 'next/image' ;
33
4+ import withWindowSize , { DeviceProps } from '@/hocs/withWindowSize' ;
45import { Button } from '@/components/Common/Button' ;
5- import useWindowSize from '@/hooks/useWindowSize' ;
6- import { RESPONSIVE_VARIABLE } from '@/constants/objects/responsive' ;
76
87import textLogo from '../../../public/static/images/text-logo.webp' ;
98import playstoreLogo from '../../../public/static/images/playstore.webp' ;
109import appstoreLogo from '../../../public/static/images/appstore.webp' ;
11- import mockupPCSrc from '../../../public/static/images/mockup-main-lg.webp' ;
12- import mockupTabletSrc from '../../../public/static/images/mockup-main-md.webp' ;
13- import mockupMobileSrc from '../../../public/static/images/mockup-main-sm.webp' ;
10+ import mockupLgSrc from '../../../public/static/images/mockup-main-lg.webp' ;
11+ import mockupMdSrc from '../../../public/static/images/mockup-main-md.webp' ;
12+ import mockupSmSrc from '../../../public/static/images/mockup-main-sm.webp' ;
1413
1514import Styles from './Main.module.scss' ;
1615
17- export default function Main ( ) : JSX . Element {
18- const { width } = useWindowSize ( ) ;
16+ function Main ( props : DeviceProps ) : JSX . Element {
17+ const { isPc , isTablet , isMobile } = props ;
1918
20- const mockupSrc =
21- width >= RESPONSIVE_VARIABLE [ 'pc' ]
22- ? mockupPCSrc
23- : width < RESPONSIVE_VARIABLE [ 'tablet' ]
24- ? mockupMobileSrc
25- : mockupTabletSrc ;
19+ const mockupSrc = ( ) : StaticImageData => {
20+ if ( isPc ) return mockupLgSrc ;
21+ else if ( isTablet ) return mockupMdSrc ;
22+ else return mockupSmSrc ;
23+ } ;
2624
2725 return (
2826 < div className = { Styles . Main } >
29- { width > RESPONSIVE_VARIABLE [ 'tablet' ] ? (
27+ { isMobile ? (
3028 < div className = { Styles . Main__title } >
31- 기억하고 싶은 모든 콘텐츠를 내 손안에
29+ < div > 기억하고 싶은</ div >
30+ < div > 모든 콘텐츠를 내 손안에</ div >
3231 </ div >
3332 ) : (
3433 < div className = { Styles . Main__title } >
35- < div > 기억하고 싶은</ div >
36- < div > 모든 콘텐츠를 내 손안에</ div >
34+ 기억하고 싶은 모든 콘텐츠를 내 손안에
3735 </ div >
3836 ) }
3937 < Image
@@ -42,14 +40,7 @@ export default function Main(): JSX.Element {
4240 alt = "havit text logo"
4341 priority
4442 />
45- { width > RESPONSIVE_VARIABLE [ 'tablet' ] ? (
46- < div className = { Styles . Main__introText } >
47- 그때 봤던 그 콘텐츠 어디있지?
48- < span className = { Styles [ 'Main__introText--strong' ] } >
49- 콘텐츠 저장, 해빗에서 쉽고 간편하게
50- </ span >
51- </ div >
52- ) : (
43+ { isMobile ? (
5344 < >
5445 < div className = { Styles . Main__introText } >
5546 그때 봤던 그 콘텐츠 어디있지?
@@ -58,6 +49,13 @@ export default function Main(): JSX.Element {
5849 콘텐츠 저장, 해빗에서 쉽고 간편하게
5950 </ div >
6051 </ >
52+ ) : (
53+ < div className = { Styles . Main__introText } >
54+ 그때 봤던 그 콘텐츠 어디있지?
55+ < span className = { Styles [ 'Main__introText--strong' ] } >
56+ 콘텐츠 저장, 해빗에서 쉽고 간편하게
57+ </ span >
58+ </ div >
6159 ) }
6260 < div className = { Styles . Main__store } >
6361 < Button type = "google" text = "Google Play" imageSrc = { playstoreLogo } />
@@ -69,12 +67,14 @@ export default function Main(): JSX.Element {
6967 </ div >
7068 < div className = { Styles . Main__image } >
7169 < Image
72- src = { mockupSrc }
70+ src = { mockupSrc ( ) }
7371 alt = "havit mockup main"
74- style = { { width : 'auto ' , height : 'auto' } }
72+ style = { { width : '100% ' , height : 'auto' } }
7573 priority
7674 />
7775 </ div >
7876 </ div >
7977 ) ;
8078}
79+
80+ export default withWindowSize ( Main ) ;
0 commit comments