Skip to content

Commit c526c6c

Browse files
authored
Merge pull request #221 from manNomi/refactor/home-code-spliting
Refactor/home code spliting
2 parents 72d5ef9 + 45073d2 commit c526c6c

File tree

18 files changed

+69
-484
lines changed

18 files changed

+69
-484
lines changed

src/app/_home/_ui/PopularUniversitySection/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ const PopularUniversitySection = ({ universities }: PopularUniversitySectionProp
2727
alt={`${university.koreanName || "대학교"} 배경 이미지`}
2828
priority={index < 3} // 상위 3개는 우선 로딩
2929
loading={index >= 3 ? "lazy" : "eager"}
30-
fetchPriority={index < 3 ? "high" : "auto"}
30+
fetchPriority={index === 0 ? "high" : index < 3 ? "high" : "auto"}
31+
sizes="153px"
32+
unoptimized={false}
3133
/>
3234
</div>
3335
<div className="absolute bottom-[9px] left-[10px] z-10 text-sm font-semibold leading-[160%] tracking-[0.15px] text-white">

src/app/_home/index.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,18 @@ import Link from "next/link";
44
import FindLastYearScoreBar from "./_ui/FindLastYearScoreBar";
55
import NewsSectionSkeleton from "./_ui/NewsSection/skeleton";
66
import PopularUniversitySection from "./_ui/PopularUniversitySection";
7-
import UniversityListSkeleton from "./_ui/UniversityList/skeleton";
7+
import UniversityList from "./_ui/UniversityList";
88

99
import getRecommendedUniversity from "@/api/university/server/getRecommendedUniversity";
1010
import { getAllRegionsUniversityList } from "@/api/university/server/getSearchUniversityList";
1111
import { fetchAllNews } from "@/lib/firebaseNews";
1212
import { IconIdCard, IconMagnifyingGlass, IconMuseum, IconPaper } from "@/public/svgs/home";
1313

14-
const NewsSection = dynamic(() => import("./_ui/NewsSection"), {
14+
const NewsSectionDynamic = dynamic(() => import("./_ui/NewsSection"), {
1515
ssr: false,
1616
loading: () => <NewsSectionSkeleton />,
1717
});
1818

19-
const UniversityListDynamic = dynamic(() => import("./_ui/UniversityList"), {
20-
ssr: false,
21-
loading: () => <UniversityListSkeleton />,
22-
});
23-
2419
const Home = async () => {
2520
const newsList = await fetchAllNews();
2621
const { data } = await getRecommendedUniversity();
@@ -82,10 +77,10 @@ const Home = async () => {
8277
</div>
8378

8479
<div className="p-5">
85-
<UniversityListDynamic allRegionsUniversityList={allRegionsUniversityList} />
80+
<UniversityList allRegionsUniversityList={allRegionsUniversityList} />
8681
</div>
8782

88-
<NewsSection newsList={newsList} />
83+
<NewsSectionDynamic newsList={newsList} />
8984
</>
9085
);
9186
};

src/app/community/[boardCode]/PostWriteButton.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import { useEffect, useState } from "react";
44

5-
import styles from "./post-write-button.module.css";
6-
75
import { IconObjectsAndTools } from "@/public/svgs";
86

97
type PostWriteButtonProps = {
@@ -30,9 +28,16 @@ const PostWriteButton = ({ onClick }: PostWriteButtonProps) => {
3028
}, [lastScrollY]);
3129

3230
return (
33-
<div className={`${styles["button-wrapper"]} ${isVisible ? styles["button-visible"] : styles["button-hidden"]}`}>
34-
<button className={styles.button} onClick={onClick} type="button" aria-label="글쓰기">
35-
<div className={styles.icon}>
31+
<div
32+
className={`fixed bottom-16 flex w-full max-w-[600px] flex-col items-center transition-transform duration-300 ease-in-out ${isVisible ? "translate-y-0" : "translate-y-[calc(100%+66px)]"} `}
33+
>
34+
<button
35+
className="relative flex h-14 w-14 cursor-pointer items-center justify-center rounded-full bg-primary shadow-[0px_4px_30px_rgba(0,0,0,0.15)]"
36+
onClick={onClick}
37+
type="button"
38+
aria-label="글쓰기"
39+
>
40+
<div className="absolute -top-2 flex items-center justify-center">
3641
<IconObjectsAndTools />
3742
</div>
3843
</button>

src/app/community/[boardCode]/post-write-button.module.css

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ declare global {
5454
export const viewport: Viewport = {
5555
width: "device-width",
5656
initialScale: 1,
57-
maximumScale: 1,
58-
userScalable: false,
57+
maximumScale: 5,
58+
userScalable: true,
5959
};
6060

6161
const RootLayout = ({ children }: { children: React.ReactNode }) => (

src/app/score/submit/gpa/page.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Metadata } from "next";
22
import Link from "next/link";
33

44
import TopDetailNavigation from "@/components/layout/TopDetailNavigation";
5-
import tabStyles from "@/components/ui/Tab/tab.module.css";
65

76
import GpaSubmitForm from "./GpaSubmitForm";
87

@@ -36,15 +35,18 @@ const Tab = ({ color }: TabProps) => {
3635
};
3736
const combinedColor = { ...defaultColor, ...color };
3837
return (
39-
<div className={tabStyles.tabContainer}>
38+
<div className="flex h-9 w-full cursor-pointer flex-row text-sm font-medium">
4039
<Link
4140
href="/score/submit/language-test"
4241
style={{ color: combinedColor.deactiveBtnFont }}
43-
className={tabStyles.tabButton}
42+
className="flex w-full items-center justify-center bg-white"
4443
>
4544
<div>공인어학</div>
4645
</Link>
47-
<span style={{ color: combinedColor.activeBtnFont }} className={tabStyles.tabButtonActive}>
46+
<span
47+
style={{ color: combinedColor.activeBtnFont }}
48+
className="flex w-full items-center justify-center border-b-2 border-secondary bg-white"
49+
>
4850
<div>학점</div>
4951
</span>
5052
</div>

src/app/score/submit/language-test/page.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Metadata } from "next";
22
import Link from "next/link";
33

44
import TopDetailNavigation from "@/components/layout/TopDetailNavigation";
5-
import tabStyles from "@/components/ui/Tab/tab.module.css";
65

76
import LanguageTestSubmitForm from "./LanguageTestSubmitForm";
87

@@ -36,11 +35,18 @@ const Tab = ({ color }: TabProps) => {
3635
};
3736
const combinedColor = { ...defaultColor, ...color };
3837
return (
39-
<div className={tabStyles.tabContainer}>
40-
<span style={{ color: combinedColor.activeBtnFont }} className={tabStyles.tabButtonActive}>
38+
<div className="flex h-9 w-full cursor-pointer flex-row text-sm font-medium">
39+
<span
40+
style={{ color: combinedColor.activeBtnFont }}
41+
className="flex w-full items-center justify-center border-b-2 border-secondary bg-white"
42+
>
4143
<div>공인어학</div>
4244
</span>
43-
<Link href="/score/submit/gpa" style={{ color: combinedColor.deactiveBtnFont }} className={tabStyles.tabButton}>
45+
<Link
46+
href="/score/submit/gpa"
47+
style={{ color: combinedColor.deactiveBtnFont }}
48+
className="flex w-full items-center justify-center bg-white"
49+
>
4450
<div>학점</div>
4551
</Link>
4652
</div>

src/components/button/BlockToggleBtn.tsx

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type BlockToggleBtnProps = {
1212

1313
const BlockToggleBtn = ({
1414
children,
15-
className,
15+
className = "",
1616
style,
1717
backgroundColor,
1818
textColor,
@@ -21,34 +21,24 @@ const BlockToggleBtn = ({
2121
onClick,
2222
isToggled = true,
2323
}: BlockToggleBtnProps) => {
24-
let defaultStyle = {
25-
backgroundColor: backgroundColor || "var(--primary-1, #6F90D1)",
26-
color: textColor || "white",
24+
// CSS 변수 대신 Tailwind 클래스 사용
25+
const baseClasses =
26+
"w-full h-11 border-none rounded-lg cursor-pointer transition-all duration-500 font-medium text-base font-serif";
27+
const enabledClasses = isToggled ? "bg-primary text-white" : "bg-gray-200 text-gray-500";
2728

28-
width: "100%",
29-
height: "44px",
30-
border: "none",
31-
borderRadius: "8px",
32-
cursor: "pointer",
33-
transition: "background-color 0.5s, color 0.5s",
34-
35-
fontFamily: "Pretendard",
36-
fontSize: "16px",
37-
fontStyle: "normal",
38-
fontWeight: 500,
39-
lineHeight: "normal",
29+
const customStyles = {
30+
backgroundColor: isToggled ? backgroundColor : disableBackgroundColor,
31+
color: isToggled ? textColor : disableTextColor,
32+
...style,
4033
};
4134

42-
if (!isToggled) {
43-
defaultStyle = {
44-
...defaultStyle,
45-
backgroundColor: disableBackgroundColor || "#EDEDED",
46-
color: disableTextColor || "#888",
47-
};
48-
}
49-
5035
return (
51-
<button className={className} style={{ ...defaultStyle, ...style }} onClick={onClick} type="button">
36+
<button
37+
className={`${baseClasses} ${enabledClasses} ${className}`}
38+
style={customStyles}
39+
onClick={onClick}
40+
type="button"
41+
>
5242
{children}
5343
</button>
5444
);

src/components/layout/GlobalLayout/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import dynamic from "next/dynamic";
22
import React from "react";
33

4+
import BottomNavigation from "./ui/BottomNavigation";
45
import ServerModal from "./ui/ServerModal";
56

6-
const BottomNavigation = dynamic(() => import("./ui/BottomNavigation"), { ssr: false, loading: () => null });
7+
// const BottomNavigationDynamic = dynamic(() => import("./ui/BottomNavigation"), { ssr: false, loading: () => null });
78
const ClientModal = dynamic(() => import("./ui/ClientModal"), { ssr: false, loading: () => null });
89

910
type LayoutProps = {

0 commit comments

Comments
 (0)