Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] v2.1.4 배포 #811

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net" />
<link href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" rel="stylesheet" />
<link
rel="preload"
as="style"
href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css"
onload="this.rel='stylesheet'"
/>
</head>
<body>
<div id="root"></div>
Expand Down
2 changes: 0 additions & 2 deletions client/src/GlobalStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('ErrorCatcher', () => {
});

await waitFor(() => {
expect(screen.getByText('알 수 없는 오류입니다.')).toBeInTheDocument();
expect(screen.getByText('알 수 없는 오류가 발생했습니다.')).toBeInTheDocument();
});
});
});
16 changes: 16 additions & 0 deletions client/src/hooks/useMainSection.ts
Original file line number Diff line number Diff line change
@@ -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;
28 changes: 0 additions & 28 deletions client/src/hooks/useMainSectionBackgroundScroll.ts

This file was deleted.

22 changes: 22 additions & 0 deletions client/src/hooks/usePageBackground.ts
Original file line number Diff line number Diff line change
@@ -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;
24 changes: 19 additions & 5 deletions client/src/pages/ErrorPage/ErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
import Top from '@components/Design/components/Top/Top';
import Image from '@components/Design/components/Image/Image';

import {MainLayout} from '@HDesign/index';
import {Flex, MainLayout, Text} from '@HDesign/index';

import getImageUrl from '@utils/getImageUrl';

const ErrorPage = () => {
return (
<MainLayout>
<Top>
<Top.Line text="알 수 없는 오류입니다." emphasize={['알 수 없는 오류입니다.']} />
</Top>
<Flex
justifyContent="center"
alignItems="center"
flexDirection="column"
gap="1rem"
height="80vh"
css={{alignContent: 'center'}}
>
<Image src={getImageUrl('cryingDog', 'webp')} fallbackSrc={getImageUrl('cryingDog', 'png')} width="160px" />
<Text size="subTitle">알 수 없는 오류가 발생했습니다.</Text>
<Text size="body" css={{textAlign: 'center'}}>
계속 발생한다면 잠시 후 다시 시도해주세요. <br />
인터넷 연결 상태가 좋지 않으면 발생할 수 있습니다.
</Text>
</Flex>
</MainLayout>
);
};
Expand Down
18 changes: 18 additions & 0 deletions client/src/pages/MainPage/MainPage.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
18 changes: 16 additions & 2 deletions client/src/pages/MainPage/MainPage.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
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 (
<div css={mainContainer}>
<Nav trackStartCreateEvent={trackStartCreateEvent} />
<MainSection trackStartCreateEvent={trackStartCreateEvent} />
<DescriptionSection />
<FeatureSection />
<CreatorSection />

<div css={backgroundStyle}>
<Image
css={backgroundImageStyle(isVisible)}
src={getImageUrl('mainSectionBackground', 'webp')}
alt=""
fallbackSrc={getImageUrl('mainSectionBackground', 'png')}
/>
</div>
</div>
);
};
Expand Down
24 changes: 3 additions & 21 deletions client/src/pages/MainPage/Section/MainSection/MainSection.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div css={mainSectionStyle}>
<div css={backgroundStyle}>
<Image
css={backgroundImageStyle(isVisible)}
src={getImageUrl('mainSectionBackground', 'webp')}
alt=""
fallbackSrc={getImageUrl('mainSectionBackground', 'png')}
/>
</div>
<div css={sectionStyle}>
<Text css={animateWithDelay(0)} textColor="white" style={{textAlign: 'left'}} size="title">{`행동대장으로
간편하게 정산하세요
Expand Down
Loading