Skip to content

Commit

Permalink
feat: 메인 페이지 배너 클릭시 온보딩 페이지로 이동 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Leejha committed Oct 21, 2023
1 parent 21f369b commit 519379e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
27 changes: 9 additions & 18 deletions apps/jurumarble/src/app/main/components/Banner.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
'use client';

import { useEffect } from 'react';

import Path from 'lib/Path';
import userStorage from 'lib/utils/userStorage';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
import Link from 'next/link';
import { mainBanner } from 'public/images';
import styled from 'styled-components';

function Banner() {
const router = useRouter();
useEffect(() => {
if (!userStorage.get() || !!localStorage.getItem('visited_home')) {
return;
}
router.push(Path.ONBOARDING_PAGE);
localStorage.setItem('visited_home', 'false');
}, []);
return (
<Container>
<Image
alt="배너"
src={mainBanner}
fill
style={{ borderRadius: '16px' }}
/>
<Link href={Path.ONBOARDING_PAGE}>
<Image
alt="배너"
src={mainBanner}
fill
style={{ borderRadius: '16px' }}
/>
</Link>
</Container>
);
}
Expand Down
12 changes: 12 additions & 0 deletions apps/jurumarble/src/components/AuthProcess.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ function AuthProcess() {
}
}, [pathname, router]);

/**
* 온보딩 페이지로 이동 로직
* @TODO 분리 필요
*/
useEffect(() => {
if (!isLogin() || !!localStorage.getItem('visited_home')) {
return;
}
router.push(Path.ONBOARDING_PAGE);
localStorage.setItem('visited_home', 'false');
}, [router]);

return <></>;
}

Expand Down

0 comments on commit 519379e

Please sign in to comment.