Skip to content

Commit 8676120

Browse files
authored
feat: 신규 홈화면 컴포넌트 2개 추가 (#132)
* design: 홈 화면 아이콘 색상 변경 * feat: 홈화면 대학 리스트 디자인 추가
1 parent 3a14852 commit 8676120

13 files changed

Lines changed: 223 additions & 48 deletions

File tree

.env.development

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ NEXT_PUBLIC_WEB_URL=http://localhost:3000
55
# NEXT_PUBLIC_WEB_URL=https://www.stage.solid-connection.com
66

77
# api server
8-
NEXT_PUBLIC_API_SERVER_URL=https://api.solid-connection.com
9-
# NEXT_PUBLIC_API_SERVER_URL=https://api.stage.solid-connection.com
8+
NEXT_PUBLIC_API_SERVER_URL=https://api.stage.solid-connection.com
109

1110
# kakao
1211
NEXT_PUBLIC_KAKAO_JS_KEY=c080f1d215a69b47401cda1d7528418a

public/svgs/home/id-card.svg

Lines changed: 5 additions & 5 deletions
Loading
Lines changed: 3 additions & 3 deletions
Loading

public/svgs/home/museum.svg

Lines changed: 9 additions & 9 deletions
Loading

public/svgs/home/paper.svg

Lines changed: 6 additions & 6 deletions
Loading

src/app/Home.tsx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import { getRecommendedUniversitiesApi } from "@/services/university";
88

99
import HomeCollegeCards from "./HomeCollegeCards";
1010
import NewsCards from "./NewsCards";
11+
import UniversityList from "./UniversityList";
1112

1213
import { News } from "@/types/news";
1314
import { ListUniversity } from "@/types/university";
1415

15-
import { IconApplicantBanner, IconScoreBanner, IconSearchBanner, IconSpeaker, IconTablerSearch } from "@/public/svgs";
16+
import { IconSpeaker, IconTablerSearch } from "@/public/svgs";
1617
import {
1718
IconGraduationCap,
1819
IconIdCard,
@@ -66,43 +67,42 @@ const Home = ({ newsList }: HomeProps) => {
6667

6768
<div className="flex flex-col gap-2.5 px-5 py-3.5">
6869
<div className="flex gap-[7px]">
69-
<Link className="flex h-[102px] flex-1 flex-col gap-2 rounded-lg bg-k-50 p-2.5" href="/university">
70+
<Link className="flex h-[102px] flex-1 flex-col gap-2 rounded-lg bg-[#F0F5FF] p-2.5" href="/university">
7071
<div className="flex flex-col">
7172
<span className="text-sm font-bold text-primary-900">학교 검색하기</span>
72-
<span className="text-[11px] font-medium leading-[14px] text-primary-700">
73-
모든 학교 목록을 확인해보세요
74-
</span>
73+
<span className="text-[11px] font-medium leading-[14px] text-k-700">모든 학교 목록을 확인해보세요</span>
7574
</div>
7675
<div className="flex justify-end">
7776
<IconMagnifyingGlass />
7877
</div>
7978
</Link>
80-
<Link className="flex h-[102px] flex-1 flex-col gap-2 rounded-lg bg-k-50 p-2.5" href="/score">
79+
<Link className="flex h-[102px] flex-1 flex-col gap-2 rounded-lg bg-[#E5F9FF] p-2.5" href="/score">
8180
<div className="flex flex-col">
8281
<span className="text-sm font-bold text-primary-900">성적 입력하기</span>
83-
<span className="text-[11px] font-medium leading-[14px] text-primary-700">성적을 입력해보세요</span>
82+
<span className="text-[11px] font-medium leading-[14px] text-k-700">성적을 입력해보세요</span>
8483
</div>
8584
<div className="flex justify-end">
8685
<IconPaper />
8786
</div>
8887
</Link>
8988
</div>
9089
<div className="flex gap-[7px]">
91-
<Link className="flex h-[102px] flex-1 flex-col gap-2 rounded-lg bg-k-50 p-2.5" href="/application/apply">
90+
<Link
91+
className="flex h-[102px] flex-1 flex-col gap-2 rounded-lg bg-[#FFF3E5] p-2.5"
92+
href="/application/apply"
93+
>
9294
<div className="flex flex-col">
9395
<span className="text-sm font-bold text-primary-900">학교 지원하기</span>
94-
<span className="text-[11px] font-medium leading-[14px] text-primary-700">학교를 지원해주세요</span>
96+
<span className="text-[11px] font-medium leading-[14px] text-k-700">학교를 지원해주세요</span>
9597
</div>
9698
<div className="flex justify-end">
9799
<IconMuseum />
98100
</div>
99101
</Link>
100-
<Link className="flex h-[102px] flex-1 flex-col gap-2 rounded-lg bg-k-50 p-2.5" href="/application">
102+
<Link className="flex h-[102px] flex-1 flex-col gap-2 rounded-lg bg-[#E9F7EC] p-2.5" href="/application">
101103
<div className="flex flex-col">
102104
<span className="text-sm font-bold text-primary-900">지원자 현황 확인</span>
103-
<span className="text-[11px] font-medium leading-[14px] text-primary-700">
104-
경쟁률을 바로 분석해드려요
105-
</span>
105+
<span className="text-[11px] font-medium leading-[14px] text-k-700">경쟁률을 바로 분석해드려요</span>
106106
</div>
107107
<div className="flex justify-end">
108108
<IconIdCard />
@@ -111,15 +111,19 @@ const Home = ({ newsList }: HomeProps) => {
111111
</div>
112112
</div>
113113

114-
<div className="border-t-[5px] border-k-50 pl-5 pt-[15px]">
115-
<div className="mb-2 flex items-center gap-[6px] font-serif text-[16px] font-semibold text-[#44413d]">
114+
<div className="border-t-[5px] border-k-50 py-5 pl-5">
115+
<div className="mb-2 flex items-center gap-[6px] font-serif text-[16px] font-semibold text-[#44413D]">
116116
실시간 인기있는 파견학교
117117
</div>
118118
<HomeCollegeCards colleges={recommendedColleges} />
119119
</div>
120120

121+
<div className="p-5">
122+
<UniversityList />
123+
</div>
124+
121125
<div className="mt-6 pl-5">
122-
<div className="mb-[10px] flex items-center gap-[6px] font-serif text-[16px] font-semibold text-[#44413d]">
126+
<div className="mb-[10px] flex items-center gap-[6px] font-serif text-[16px] font-semibold text-[#44413D]">
123127
솔커에서 맛보는 소식
124128
<IconSpeaker />
125129
</div>

src/app/UniversityList.tsx

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
"use client";
2+
3+
import Image from "next/image";
4+
import Link from "next/link";
5+
import { useEffect, useState } from "react";
6+
7+
import { getUniversityListPublicApi } from "@/services/university";
8+
import { shortenLanguageTestName } from "@/utils/universityUtils";
9+
10+
import ButtonTab from "@/components/ui/ButtonTab";
11+
import CheveronRightFilled from "@/components/ui/icon/ChevronRightFilled";
12+
13+
import { languageTestShortMapping } from "@/types/score";
14+
import { ListUniversity, regionMapping } from "@/types/university";
15+
16+
const UniversityList = () => {
17+
const [region, setRegion] = useState<"전체" | "영미권" | "유럽권" | "아시아권">("전체");
18+
const [universities, setUniversities] = useState<ListUniversity[]>([]);
19+
20+
useEffect(() => {
21+
const fetchUniversities = async () => {
22+
try {
23+
const response = await getUniversityListPublicApi(regionMapping[region]);
24+
setUniversities(response.data.slice(0, 3));
25+
} catch {
26+
setUniversities([]);
27+
}
28+
};
29+
30+
fetchUniversities();
31+
}, [region]);
32+
33+
return (
34+
<div className="flex flex-col gap-2">
35+
<div className="flex justify-between">
36+
<span className="text-lg font-semibold leading-snug text-[#44413D]">전체 학교 리스트</span>
37+
<Link href="/university">
38+
<span className="text-[13px] font-semibold leading-snug text-[#76797D] underline decoration-solid decoration-auto underline-offset-auto">
39+
더보기
40+
</span>
41+
</Link>
42+
</div>
43+
<div className="">
44+
<ButtonTab // TODO: 디자인 변경
45+
choices={["전체", "영미권", "유럽권", "아시아권", "중국권"]}
46+
choice={region}
47+
setChoice={setRegion}
48+
color={{
49+
activeBtn: "bg-primary-100",
50+
deactiveBtn: "bg-k-50",
51+
activeBtnFont: "text-primary",
52+
deactiveBtnFont: "text-k-300",
53+
background: "white",
54+
}}
55+
/>
56+
</div>
57+
<UniversityCards colleges={universities} />
58+
</div>
59+
);
60+
};
61+
62+
export default UniversityList;
63+
64+
type UniversityCardsProps = {
65+
colleges: ListUniversity[];
66+
style?: React.CSSProperties;
67+
};
68+
69+
const UniversityCards = ({ colleges, style }: UniversityCardsProps) => (
70+
<div className="flex flex-col gap-2" style={style}>
71+
{colleges.map((university) => (
72+
<UniversityCard key={university.id} university={university} />
73+
))}
74+
</div>
75+
);
76+
77+
type UniversityCardProps = {
78+
university: ListUniversity;
79+
};
80+
81+
const UniversityCard = ({ university }: UniversityCardProps) => {
82+
const convertedKoreanName =
83+
university.term !== process.env.NEXT_PUBLIC_CURRENT_TERM
84+
? `${university.koreanName}(${university.term})`
85+
: university.koreanName;
86+
return (
87+
<Link
88+
className="relative flex h-[91px] gap-5 overflow-hidden rounded-lg bg-k-50 p-5 no-underline"
89+
href={`/university/${university.id}`}
90+
>
91+
<div className="flex items-center">
92+
<Image
93+
className="h-[55px] w-[55px] rounded-full object-cover"
94+
src={`${process.env.NEXT_PUBLIC_IMAGE_URL}/${university.logoImageUrl}`}
95+
width={55}
96+
height={55}
97+
alt={convertedKoreanName || "대학 이미지"}
98+
/>
99+
</div>
100+
101+
<div className="flex flex-1 flex-col gap-1">
102+
<div className="flex justify-between">
103+
<span className="truncate font-serif text-base font-semibold leading-normal text-black">
104+
{convertedKoreanName}
105+
</span>
106+
<div className="flex shrink-0 gap-2.5">
107+
<span className="text-sm font-semibold leading-normal text-primary">
108+
{university.country} | {university.region}
109+
</span>
110+
<svg xmlns="http://www.w3.org/2000/svg" width="21" height="20" viewBox="0 0 21 20" fill="none">
111+
<path
112+
d="M9.51953 14L13.5195 10L9.51953 6"
113+
stroke="#5F6268"
114+
stroke-linecap="round"
115+
stroke-linejoin="round"
116+
/>
117+
</svg>
118+
</div>
119+
</div>
120+
<div className="flex gap-2.5">
121+
{university.languageRequirements.slice(0, 3).map((requirement) => (
122+
<span
123+
key={requirement.languageTestType}
124+
className="whitespace-nowrap text-sm font-medium leading-normal text-[#919397]"
125+
>
126+
{languageTestShortMapping[requirement.languageTestType] || ""} {requirement.minScore || ""}
127+
</span>
128+
))}
129+
</div>
130+
</div>
131+
132+
<div className="absolute right-[9.77px] top-[38px] h-6 w-6"></div>
133+
</Link>
134+
);
135+
};

src/app/application/apply/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ const ApplyPage = () => {
9999
return;
100100
}
101101

102+
if (isSubmitting) return;
102103
setIsSubmitting(true); // TODO: 현재 임시 submit 처리, 이후에 통합 처리 추가
103104
try {
104105
await postApplicationApi({

src/app/my/favorite/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useEffect, useState } from "react";
55

66
import { getMyWishUniversityApi } from "@/services/myInfo";
77

8-
import CollegeCards from "@/components/college/UniversityCards";
8+
import UniversityCards from "@/components/college/UniversityCards";
99
import TopDetailNavigation from "@/components/layout/TopDetailNavigation";
1010
import ScrollTab from "@/components/ui/ScrollTab";
1111

@@ -58,7 +58,7 @@ const MyScrapPage = () => {
5858
case tabs[0]:
5959
return (
6060
<div className="mt-5">
61-
<CollegeCards colleges={wishColleges} />
61+
<UniversityCards colleges={wishColleges} />
6262
</div>
6363
);
6464
// case tabs[1]:

src/components/college/UniversityCards.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ type UniversityCardsProps = {
1515
const UniversityCards = ({ colleges, style }: UniversityCardsProps) => (
1616
<div className="flex flex-col gap-2" style={style}>
1717
{colleges.map((university) => (
18-
<CollegeCard key={university.id} university={university} />
18+
<UniversityCard key={university.id} university={university} />
1919
))}
2020
</div>
2121
);
2222
export default UniversityCards;
2323

24-
type CollegeCardProps = {
24+
type UniversityCardProps = {
2525
university: ListUniversity;
2626
};
2727

28-
export const CollegeCard = ({ university }: CollegeCardProps) => {
28+
export const UniversityCard = ({ university }: UniversityCardProps) => {
2929
const convertedKoreanName =
3030
university.term !== process.env.NEXT_PUBLIC_CURRENT_TERM
3131
? `${university.koreanName}(${university.term})`

0 commit comments

Comments
 (0)