Skip to content

Commit

Permalink
feat: implement landing page (#29)
Browse files Browse the repository at this point in the history
* chore: ๐Ÿค– add images

* refactor: ๐Ÿ’ก remove unused images

* feat: ๐ŸŽธ implement landing

* feat: ๐ŸŽธ implement useLogin

* feat: ๐ŸŽธ connect signin, signup route

* refactor: ๐Ÿ’ก remove export
  • Loading branch information
chaewonkong authored Aug 12, 2023
1 parent cc5c205 commit 986868d
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 43 deletions.
Binary file modified public/favicon.ico
Binary file not shown.
Binary file added public/images/onboarding1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/onboarding2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/onboarding3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion public/next.svg

This file was deleted.

1 change: 0 additions & 1 deletion public/vercel.svg

This file was deleted.

33 changes: 33 additions & 0 deletions src/components/landing/Indicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
interface IndicatorProps {
activeIndex: number;
length: number;
}

interface DotProps {
isActive: boolean;
}

const Dot = ({ isActive }: DotProps) => {
const color = isActive ? '#1B1717' : '#E8E8E8';
return (
<svg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'>
<circle cx='5.24023' cy='5.90771' r='5' fill={color} />
</svg>
);
};

export const Indicator = ({ activeIndex, length }: IndicatorProps) => {
const renderDots = (length: number, activeIndex: number) => {
const dots = [];
for (let i = 0; i < length; i++) {
dots.push(<Dot key={i} isActive={activeIndex === i} />);
}

return dots;
};
return (
<div className='tw-flex tw-flex-row tw-justify-center tw-py-10'>
<div className='tw-flex tw-flex-row tw-gap-3'>{renderDots(length, activeIndex)}</div>
</div>
);
};
13 changes: 13 additions & 0 deletions src/hooks/useLogin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useEffect, useState } from 'react';

export function useLogin() {
const [login, setLogin] = useState(false);
useEffect(() => {
const user_id = localStorage.getItem('user_id');
if (user_id) {
setLogin(true);
}
}, []);

return { login };
}
88 changes: 47 additions & 41 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
import { Icon } from '@/components/shared';
import { useRouter } from 'next/router';
import { useState } from 'react';
import { Indicator } from '@/components/landing/Indicator';
import { Button } from '@/components/shared/Button';
import { TextButton } from '@/components/shared/TextButton';
import { ItemsSlide } from '@/components/user/item/ItemsSlide';

// NOTE : ์˜จ๋ณด๋”ฉ ํŽ˜์ด์ง€
const items = [
{
id: 1,
title: '',
image: '/images/onboarding1.png',
description: '',
},
{
id: 2,
title: '',
image: '/images/onboarding2.png',
description: '',
},
{
id: 3,
title: '',
image: '/images/onboarding3.png',
description: '',
},
];
export default function Home() {
const [activeIndex, setActiveIndex] = useState<number>(1);
const router = useRouter();

return (
<main>
<p className='tw-text-main-headline'>์ด๊ฑด ๋ฉ”์ธ ํ—ค๋“œ๋ผ์ธ์ด์—์š” Pretendard</p>
<p className='tw-text-sub-headline'>์ด๊ฑด ์„œ๋ธŒ ํ—ค๋“œ๋ผ์ธ์ด์—์š” Pretendard</p>
<p className='tw-text-body1'>์ด๊ฑด ๋ณธ๋ฌธ1์ด์—์š” Pretendard</p>
<p className='tw-text-body2'>์ด๊ฑด ๋ณธ๋ฌธ2์ด์—์š” Pretendard</p>
<p className='tw-text-caption'>์ด๊ฑด ์บก์…˜์ด์—์š” Pretendard</p>
<p className='tw-text-button1'>์ด๊ฑด ๋ฒ„ํŠผ1์ด์—์š” Pretendard</p>
<p className='tw-text-button2'>์ด๊ฑด ๋ฒ„ํŠผ2์ด์—์š” Pretendard</p>
<p className='tw-text-accent-eng'>Montserrat accent</p>
<p className='tw-text-body-eng'>Montserrat body</p>
<p className='tw-text-caption-eng'>Montserrat caption</p>
<Icon iconType='Edit' />
<Icon iconType='Menu' />
<Icon iconType='Plus' />
<Icon iconType='RightArrow' />
<Button variant='primary' onClick={() => console.log('primary')}>
Primary
</Button>
<Button variant='secondary' onClick={() => console.log('secondary')} disabled>
Secondary
</Button>
<Button variant='nudge' onClick={() => console.log('nudge')}>
๊ทธ๋ผํ”ผ ์•Œ์•„๋ณด๊ธฐ
<Icon iconType='RightChevron' />
</Button>
<Button variant='link' onClick={() => console.log('link')} className='tw-w-[20rem]'>
Link
<Icon iconType='RightArrow' />
</Button>
<Button variant='rounded' onClick={() => console.log('rounded')}>
ADD
</Button>
<TextButton color='primary' onClick={() => console.log('textbutton1')}>
์ €์žฅ
</TextButton>
<TextButton color='secondary' onClick={() => console.log('textbutton2')}>
์ €์žฅ
</TextButton>
</main>
<section>
<Indicator length={items.length} activeIndex={activeIndex} />
<ItemsSlide items={items} activeIndex={activeIndex} setActiveIndex={setActiveIndex} />
<div className='tw-fixed tw-bottom-3 tw-flex tw-w-full tw-max-w-[475px] tw-flex-col tw-items-center tw-gap-3 tw-px-5'>
<Button
className='tw-flex tw-h-[50px] tw-w-full tw-flex-row tw-justify-center tw-rounded-[6px]'
variant='primary'
onClick={() => router.push('/signin')}
>
๋กœ๊ทธ์ธํ•˜๊ธฐ
</Button>
<Button
className='tw-flex tw-h-[50px] tw-w-full tw-flex-row tw-justify-center tw-rounded-[6px] tw-bg-yellow'
variant='primary'
onClick={() => router.push('/signup')}
>
ํšŒ์›๊ฐ€์ž…ํ•˜๊ธฐ
</Button>
</div>
</section>
);
}
48 changes: 48 additions & 0 deletions src/pages/sample/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Icon } from '@/components/shared';
import { Button } from '@/components/shared/Button';
import { TextButton } from '@/components/shared/TextButton';

// NOTE : ์˜จ๋ณด๋”ฉ ํŽ˜์ด์ง€
export default function Sample() {
return (
<main>
<p className='tw-text-main-headline'>์ด๊ฑด ๋ฉ”์ธ ํ—ค๋“œ๋ผ์ธ์ด์—์š” Pretendard</p>
<p className='tw-text-sub-headline'>์ด๊ฑด ์„œ๋ธŒ ํ—ค๋“œ๋ผ์ธ์ด์—์š” Pretendard</p>
<p className='tw-text-body1'>์ด๊ฑด ๋ณธ๋ฌธ1์ด์—์š” Pretendard</p>
<p className='tw-text-body2'>์ด๊ฑด ๋ณธ๋ฌธ2์ด์—์š” Pretendard</p>
<p className='tw-text-caption'>์ด๊ฑด ์บก์…˜์ด์—์š” Pretendard</p>
<p className='tw-text-button1'>์ด๊ฑด ๋ฒ„ํŠผ1์ด์—์š” Pretendard</p>
<p className='tw-text-button2'>์ด๊ฑด ๋ฒ„ํŠผ2์ด์—์š” Pretendard</p>
<p className='tw-text-accent-eng'>Montserrat accent</p>
<p className='tw-text-body-eng'>Montserrat body</p>
<p className='tw-text-caption-eng'>Montserrat caption</p>
<Icon iconType='Edit' />
<Icon iconType='Menu' />
<Icon iconType='Plus' />
<Icon iconType='RightArrow' />
<Button variant='primary' onClick={() => console.log('primary')}>
Primary
</Button>
<Button variant='secondary' onClick={() => console.log('secondary')} disabled>
Secondary
</Button>
<Button variant='nudge' onClick={() => console.log('nudge')}>
๊ทธ๋ผํ”ผ ์•Œ์•„๋ณด๊ธฐ
<Icon iconType='RightChevron' />
</Button>
<Button variant='link' onClick={() => console.log('link')} className='tw-w-[20rem]'>
Link
<Icon iconType='RightArrow' />
</Button>
<Button variant='rounded' onClick={() => console.log('rounded')}>
ADD
</Button>
<TextButton color='primary' onClick={() => console.log('textbutton1')}>
์ €์žฅ
</TextButton>
<TextButton color='secondary' onClick={() => console.log('textbutton2')}>
์ €์žฅ
</TextButton>
</main>
);
}
1 change: 1 addition & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
primary: '#202020',
nudge: '#19F1CA',
danger: '#F40000',
yellow: '#FACB2E',
grayscale: {
100: '#F3F3F3',
200: '#E8E8E8',
Expand Down

0 comments on commit 986868d

Please sign in to comment.