From 8750d24971fda519e02fc5aa442f25690ac87ef1 Mon Sep 17 00:00:00 2001 From: hookor Date: Mon, 3 Jun 2024 18:30:34 +0900 Subject: [PATCH] Refactor: home --- src/components/home/CaffeineFilter.tsx | 16 +++- src/components/home/CoffeeMenuSelection.tsx | 29 ++++--- src/components/home/TodayCaffeineInfo.tsx | 16 +++- src/components/home/TodayCaffeineText.tsx | 66 ++++++++------- src/components/home/WaterPerCoffee.tsx | 91 +++++++++++---------- src/pages/Page-Home.tsx | 29 +++++-- 6 files changed, 139 insertions(+), 108 deletions(-) diff --git a/src/components/home/CaffeineFilter.tsx b/src/components/home/CaffeineFilter.tsx index e9f8bdbb..849e992d 100644 --- a/src/components/home/CaffeineFilter.tsx +++ b/src/components/home/CaffeineFilter.tsx @@ -1,6 +1,5 @@ +import { lazy, Suspense } from 'react'; import Button from '@/components/common/Button'; -import CaffeineInfo from '@/components/home/CaffeineInfo'; -import CoffeeSelection from '@/components/home/CoffeeSelection'; import { BUTTON_TEXTS } from '@/constants/common'; import { useNavigateTo } from '@/hooks/useNavigateTo'; import { styled } from 'styled-system/jsx'; @@ -8,14 +7,23 @@ import { RegistBtn } from '@/styles/styles'; import { css, cx } from 'styled-system/css'; import { useGetSignedIn } from '@/hooks/useGetSignedIn'; +const CaffeineInfo = lazy(() => import('@/components/home/CaffeineInfo')); +const CoffeeSelection = lazy(() => import('@/components/home/CoffeeSelection')); + const CaffeineFilter = () => { const registPage = useNavigateTo('/post/register'); const { signedIn } = useGetSignedIn(); return ( - - + + + + + + + + {signedIn && (