diff --git a/client/src/GlobalStyle.ts b/client/src/GlobalStyle.ts index f2f5c3cc..e3146452 100644 --- a/client/src/GlobalStyle.ts +++ b/client/src/GlobalStyle.ts @@ -142,8 +142,6 @@ export const GlobalStyle = css` sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; - max-width: 768px; - margin: 0 auto; } scrollbar-width: none; /* Firefox */ diff --git a/client/src/hooks/useMainSection.ts b/client/src/hooks/useMainSection.ts new file mode 100644 index 00000000..9503674b --- /dev/null +++ b/client/src/hooks/useMainSection.ts @@ -0,0 +1,16 @@ +import {useNavigate} from 'react-router-dom'; + +import {ROUTER_URLS} from '@constants/routerUrls'; + +const useMainSection = (trackStartCreateEvent: () => void) => { + const navigate = useNavigate(); + + const handleClick = () => { + trackStartCreateEvent(); + navigate(ROUTER_URLS.createEvent); + }; + + return {handleClick}; +}; + +export default useMainSection; diff --git a/client/src/hooks/useMainSectionBackgroundScroll.ts b/client/src/hooks/useMainSectionBackgroundScroll.ts deleted file mode 100644 index fcc1d1e7..00000000 --- a/client/src/hooks/useMainSectionBackgroundScroll.ts +++ /dev/null @@ -1,28 +0,0 @@ -import {useEffect, useState} from 'react'; -import {useNavigate} from 'react-router-dom'; - -import {ROUTER_URLS} from '@constants/routerUrls'; - -const useMainSectionBackgroundScroll = (trackStartCreateEvent: () => void) => { - const navigate = useNavigate(); - - const handleClick = () => { - trackStartCreateEvent(); - navigate(ROUTER_URLS.createEvent); - }; - - const [isVisible, setIsVisible] = useState(true); - - useEffect(() => { - const handleScroll = () => { - setIsVisible(window.scrollY <= window.innerHeight); - }; - - window.addEventListener('scroll', handleScroll); - return () => window.removeEventListener('scroll', handleScroll); - }, [window.scrollY, window.innerHeight]); - - return {isVisible, handleClick}; -}; - -export default useMainSectionBackgroundScroll; diff --git a/client/src/hooks/usePageBackground.ts b/client/src/hooks/usePageBackground.ts new file mode 100644 index 00000000..d485a56b --- /dev/null +++ b/client/src/hooks/usePageBackground.ts @@ -0,0 +1,22 @@ +import {useEffect, useState} from 'react'; + +const usePageBackground = () => { + const [isVisible, setIsVisible] = useState(true); + + useEffect(() => { + const handleScroll = () => { + setIsVisible(window.scrollY <= window.innerHeight); + }; + + window.addEventListener('scroll', handleScroll); + window.document.body.style.maxWidth = '100vw'; + return () => { + window.removeEventListener('scroll', handleScroll); + window.document.body.style.maxWidth = '768px'; + }; + }, [window.scrollY, window.innerHeight]); + + return {isVisible}; +}; + +export default usePageBackground; diff --git a/client/src/pages/MainPage/MainPage.style.ts b/client/src/pages/MainPage/MainPage.style.ts index 91c613be..1ad03808 100644 --- a/client/src/pages/MainPage/MainPage.style.ts +++ b/client/src/pages/MainPage/MainPage.style.ts @@ -5,6 +5,24 @@ export const mainContainer = css({ flexDirection: 'column', justifyContent: 'start', alignItems: 'center', + width: '100vw', height: '850vh', overflowX: 'hidden', }); + +export const backgroundStyle = css({ + position: 'fixed', + height: '100vh', + width: '100vw', + top: 0, + zIndex: -1, + backgroundColor: '#000000', +}); + +export const backgroundImageStyle = (isVisible: boolean) => + css({ + objectFit: 'cover', + height: '100vh', + width: '100vw', + opacity: isVisible ? 1 : 0, + }); diff --git a/client/src/pages/MainPage/MainPage.tsx b/client/src/pages/MainPage/MainPage.tsx index d608eaf2..87c4ed34 100644 --- a/client/src/pages/MainPage/MainPage.tsx +++ b/client/src/pages/MainPage/MainPage.tsx @@ -1,15 +1,20 @@ +import Image from '@components/Design/components/Image/Image'; + import useAmplitude from '@hooks/useAmplitude'; +import usePageBackground from '@hooks/usePageBackground'; + +import getImageUrl from '@utils/getImageUrl'; import Nav from './Nav/Nav'; import {MainSection} from './Section/MainSection'; import {DescriptionSection} from './Section/DescriptionSection'; import {FeatureSection} from './Section/FeatureSection'; -import {mainContainer} from './MainPage.style'; +import {backgroundImageStyle, backgroundStyle, mainContainer} from './MainPage.style'; import CreatorSection from './Section/CreatorSection/CreatorSection'; const MainPage = () => { const {trackStartCreateEvent} = useAmplitude(); - + const {isVisible} = usePageBackground(); return (
); }; diff --git a/client/src/pages/MainPage/Section/MainSection/MainSection.tsx b/client/src/pages/MainPage/Section/MainSection/MainSection.tsx index a4422c4a..ed4e7619 100644 --- a/client/src/pages/MainPage/Section/MainSection/MainSection.tsx +++ b/client/src/pages/MainPage/Section/MainSection/MainSection.tsx @@ -1,39 +1,21 @@ import Button from '@HDesign/components/Button/Button'; import Text from '@HDesign/components/Text/Text'; -import Image from '@components/Design/components/Image/Image'; -import useMainSectionBackgroundScroll from '@hooks/useMainSectionBackgroundScroll'; +import useMainSection from '@hooks/useMainSection'; import {Icon} from '@components/Design'; -import getImageUrl from '@utils/getImageUrl'; - -import { - animateWithDelay, - backgroundImageStyle, - backgroundStyle, - chevronStyle, - mainSectionStyle, - sectionStyle, -} from './MainSection.style'; +import {animateWithDelay, chevronStyle, mainSectionStyle, sectionStyle} from './MainSection.style'; type MainSectionProps = { trackStartCreateEvent: () => void; }; const MainSection = ({trackStartCreateEvent}: MainSectionProps) => { - const {isVisible, handleClick} = useMainSectionBackgroundScroll(trackStartCreateEvent); + const {handleClick} = useMainSection(trackStartCreateEvent); return (
-
- -
{`행동대장으로 간편하게 정산하세요