From 887efa03caae76ad5773747d4a275e53937d506a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9B=90=EB=8D=94?= Date: Sat, 30 Jan 2021 12:43:07 +0900 Subject: [PATCH] feat: using Hero component --- components/Hero.tsx | 44 ++++++++++++++++++++++++++++++++++++++++++++ pages/index.tsx | 30 ++---------------------------- pages/list/votes.tsx | 29 +++++++++++++++-------------- 3 files changed, 61 insertions(+), 42 deletions(-) create mode 100644 components/Hero.tsx diff --git a/components/Hero.tsx b/components/Hero.tsx new file mode 100644 index 0000000..3970f1b --- /dev/null +++ b/components/Hero.tsx @@ -0,0 +1,44 @@ +import dynamic from 'next/dynamic' + +import { categories, categoryIcon } from '@utils/Constants' + +const Container = dynamic(()=> import('@components/Container')) +const Wave = dynamic(()=> import('@components/Wave')) +const Tag = dynamic(()=> import('@components/Tag')) +const Search = dynamic(()=> import('@components/Search')) + +const Hero = ({ header, description }:HeroProps):JSX.Element => { + return <> +
+ +

+ { header && `${header} - `}한국 디스코드봇 리스트 +

+

{description || '다양한 국내 디스코드봇을 한곳에서 확인하세요!'}

+ +
+ + 하트 랭킹 + } dark bigger href='/list/votes' /> + { categories.slice(0, 4).map(t=> + {t} + } dark bigger href={`/categories/${t}`} />) } + + 카테고리 더보기 + } dark bigger href='/categories' /> +
+
+
+ + +} + +interface HeroProps { + header?: string + description?: string +} + +export default Hero \ No newline at end of file diff --git a/pages/index.tsx b/pages/index.tsx index adc08ac..9b4d3d1 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -3,43 +3,17 @@ import dynamic from 'next/dynamic' import { BotList } from '@types' import * as Query from '@utils/Query' -import { categories, categoryIcon } from '@utils/Constants' const Advertisement = dynamic(()=> import('@components/Advertisement')) const Container = dynamic(()=> import('@components/Container')) const BotCard = dynamic(()=> import('@components/BotCard')) -const Wave = dynamic(()=> import('@components/Wave')) -const Tag = dynamic(()=> import('@components/Tag')) -const Search = dynamic(()=> import('@components/Search')) const Paginator = dynamic(()=> import('@components/Paginator')) +const Hero = dynamic(() => import('@components/Hero')) const Index: NextPage = ({ votes, newBots, trusted }) => { return ( <> -
- -

- 한국 디스코드봇 리스트 -

- -
- - 하트 랭킹 - } dark bigger href='/list/votes' /> - { categories.slice(0, 5).map(t=> - {t} - } dark bigger href={`/categories/${t}`} />) } - - 카테고리 더보기 - } dark bigger href='/categories' /> -
-
-
- - +

diff --git a/pages/list/votes.tsx b/pages/list/votes.tsx index feb9336..037dd9e 100644 --- a/pages/list/votes.tsx +++ b/pages/list/votes.tsx @@ -1,4 +1,5 @@ import { NextPage, NextPageContext } from 'next' +import { useRouter } from 'next/router' import dynamic from 'next/dynamic' import { ParsedUrlQuery } from 'querystring' @@ -7,9 +8,10 @@ import * as Query from '@utils/Query' import NotFound from '../404' import { PageCount } from '@utils/Yup' -import { useRouter } from 'next/router' +const Hero = dynamic(() => import('@components/Hero')) const Advertisement = dynamic(() => import('@components/Advertisement')) +const SEO = dynamic(() => import('@components/SEO')) const BotCard = dynamic(() => import('@components/BotCard')) const Container = dynamic(() => import('@components/Container')) const Paginator = dynamic(() => import('@components/Paginator')) @@ -17,19 +19,18 @@ const Paginator = dynamic(() => import('@components/Paginator')) const Votes:NextPage = ({ data }) => { const router = useRouter() if(!data || data.data.length === 0 || data.totalPage < Number(router.query.page)) return - return -

- 하트 랭킹 - {data.currentPage}페이지 -

-

하트를 많이 받은 봇들의 순위입니다!

- -
- { - data.data.map(bot => ) - } -
- -
+ return <> + + + + +
+ { + data.data.map(bot => ) + } +
+ +
} export const getServerSideProps = async (ctx:Context) => { let data: BotList