-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.tsx
More file actions
72 lines (67 loc) · 2.83 KB
/
index.tsx
File metadata and controls
72 lines (67 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import Link from "next/link";
import Image from "@/components/ui/FallbackImage";
import CheveronRightFilled from "@/components/ui/icon/ChevronRightFilled";
import type { ListUniversity } from "@/types/university";
import { convertImageUrl } from "@/utils/fileUtils";
import shortenLanguageTestName from "@/utils/universityUtils";
type UniversityCardProps = {
university: ListUniversity;
showCapacity?: boolean;
linkPrefix?: string;
};
const UniversityCard = ({ university, showCapacity = true, linkPrefix = "/university" }: UniversityCardProps) => {
const convertedKoreanName = university.koreanName;
return (
<Link
className="block"
href={`${linkPrefix}/${university.id}`}
aria-labelledby={`university-name-${university.id}`}
>
<div className="relative h-[91px] w-full overflow-hidden rounded-lg border border-solid border-k-100 hover:-translate-y-0.5 hover:shadow-md hover:shadow-black/10">
<div className="flex justify-between px-5 py-3.5">
<div className="flex gap-[23.5px]">
<div className="flex flex-shrink-0 items-center">
<Image
className="h-14 w-14 rounded-full object-cover"
src={convertImageUrl(university.logoImageUrl)}
width={56}
height={56}
alt="대학 이미지"
fallbackSrc="/svgs/placeholders/university-logo-placeholder.svg"
/>
</div>
<div className="flex flex-col">
<span
id={`university-name-${university.id}`}
className="truncate text-k-700 typo-bold-4"
title={convertedKoreanName}
>
{convertedKoreanName}
</span>
<div className="flex items-center gap-2.5">
<span className="text-k-500 typo-medium-4">
{university.country} | {university.region}
</span>
{showCapacity && <span className="text-primary typo-sb-11">모집 {university.studentCapacity}명</span>}
</div>
<div className="flex gap-4">
{university.languageRequirements.slice(0, 3).map((requirement) => {
const testName = shortenLanguageTestName(requirement.languageTestType);
return (
<span key={requirement.languageTestType} className="whitespace-nowrap text-primary typo-sb-11">
{testName ?? requirement.languageTestType} {requirement.minScore}
</span>
);
})}
</div>
</div>
</div>
<div className="flex items-center">
<CheveronRightFilled color="black" opacity="0.54" />
</div>
</div>
</div>
</Link>
);
};
export default UniversityCard;