Skip to content

Commit c2ca34a

Browse files
authored
feat: sponsor section (#199)
1 parent 8cea23e commit c2ca34a

File tree

12 files changed

+163
-13
lines changed

12 files changed

+163
-13
lines changed

apps/web/app/_components/footer.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,29 @@
33
import GlassCard from "@/components/glassCard"
44
import IconCircle from "@/components/iconCircle"
55
import { siteConfig } from "@/config/site"
6+
import { SponsorList, SponsorTiers } from "@/config/sponsors"
67
import Link from "next/link"
78

8-
interface Sponsor {
9-
name: string
10-
image_path: string
11-
}
12-
139
function Sponsor() {
14-
const SPONSOR_LIST: Sponsor[] = [
15-
/* TBA */
16-
]
17-
if (SPONSOR_LIST.length < 1) return <></>
10+
if (SponsorList.length < 1) return <></>
1811
return (
1912
<div className="flex flex-[1_0_0] flex-col items-start gap-7 self-stretch max-lg:items-center">
2013
<div className="text-body-1 text-[var(--color-gray-50)] max-2xl:text-[20px] max-lg:text-[18px]">
2114
สนับสนุนโดย
2215
</div>
2316
<div className="flex flex-wrap items-center gap-6 self-stretch max-lg:justify-center">
24-
{SPONSOR_LIST.map((s) => (
17+
{SponsorList.map((s) => (
2518
<GlassCard
2619
key={s.name}
27-
className="min-w-15 min-h-15 px-2 py-1 2xl:min-h-20 2xl:min-w-20"
20+
className="min-w-15 min-h-15 px-4 py-4 2xl:min-h-20 2xl:min-w-20"
2821
style={{ borderRadius: 24, border: "1.5px solid rgba(255, 255, 255, 0.10)" }}>
29-
<img src={s.image_path} />
22+
<img src={s.image_path} className="h-[60px] w-auto" />
3023
</GlassCard>
3124
))}
3225
</div>
3326
<div className="hidden flex-col items-start gap-3 self-stretch 2xl:flex">
3427
<div className="text-body-3 text-[var(--color-gray-50)]">
35-
เราขอขอบคุณ <span>{SPONSOR_LIST.map((s) => s.name).join(", ")}</span>
28+
เราขอขอบคุณ <span>{SponsorList.map((s) => s.name).join(", ")}</span>
3629
</div>
3730
</div>
3831
</div>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Heading } from "@/components/heading"
2+
import { SponsorList, SponsorTiers } from "@/config/sponsors"
3+
4+
import SponsorSubgrid from "./subgrid"
5+
6+
export default function Sponsors() {
7+
return (
8+
<section className="mx-auto flex min-h-screen w-full flex-col items-center justify-center gap-y-[21px] px-6 lg:px-20 lg:py-[40px] 2xl:px-40">
9+
<Heading text="Organized By" />
10+
<div className="mx-auto mb-[7rem] mt-8 flex h-[10rem]">
11+
<img
12+
height={160}
13+
src="/static/logo/kmutt65-cpe-white-160px.webp"
14+
alt="kmutt cpe logo"
15+
loading="lazy"
16+
/>
17+
</div>
18+
<Heading text="Sponsored By" />
19+
<div className="grid w-full place-content-center content-center gap-y-4">
20+
<SponsorSubgrid data={SponsorList} tier={SponsorTiers.diamond} />
21+
<SponsorSubgrid data={SponsorList} tier={SponsorTiers.platinum} />
22+
<SponsorSubgrid data={SponsorList} tier={SponsorTiers.gold} />
23+
</div>
24+
</section>
25+
)
26+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import GlassCard from "@/components/glassCard"
2+
import { Sponsor } from "@/config/sponsors"
3+
import { SponsorTiers } from "@/config/sponsors"
4+
5+
interface SponsorLogoRendererProps {
6+
data: Sponsor
7+
}
8+
9+
const SponsorLogoRenderer = ({ data: s }: SponsorLogoRendererProps) => {
10+
let h = 60
11+
12+
if (s.tier === SponsorTiers.diamond) {
13+
h = 160
14+
} else if (s.tier === SponsorTiers.platinum) {
15+
h = 100
16+
}
17+
18+
return (
19+
<div className={`flex w-full min-w-[${h * 2}] justify-center rounded-3xl px-10 py-4 align-middle`}>
20+
{/* eslint-disable-next-line @next/next/no-img-element */}
21+
<img
22+
style={{ width: "auto", height: `${h}px` }}
23+
src={s.image_path}
24+
alt={`${s.name} logo`}
25+
loading="lazy"
26+
/>
27+
</div>
28+
)
29+
}
30+
31+
export default SponsorLogoRenderer
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Sponsor } from "@/config/sponsors"
2+
import { SponsorTiers } from "@/config/sponsors"
3+
4+
import SponsorLogoRenderer from "./logo-renderer"
5+
6+
interface SponsorSubgridProps {
7+
data: Sponsor[]
8+
tier: SponsorTiers
9+
}
10+
11+
function getTierName(t: SponsorTiers): string {
12+
return t === SponsorTiers.diamond ? "Diamond" : t === SponsorTiers.platinum ? "Platinum" : "Gold"
13+
}
14+
15+
export default function SponsorSubgrid({ data, tier }: SponsorSubgridProps) {
16+
const amt = data.filter((sp) => sp.tier === tier).length
17+
const gridClass = amt === 1 ? "md:grid-cols-1" : amt === 2 ? "md:grid-cols-2" : "md:grid-cols-3"
18+
19+
if (amt === 0) return <></>
20+
21+
return (
22+
<div className="flex w-full flex-col gap-y-4">
23+
<span className="text-body-1 text-center text-gray-100">
24+
{getTierName(tier)} Sponsor{amt > 1 ? "s" : ""}
25+
</span>
26+
<div className={`grid grid-cols-1 ${gridClass} gap-x-4 gap-y-4`}>
27+
{data
28+
.filter((sp) => sp.tier === tier)
29+
.map((sp) => (
30+
<SponsorLogoRenderer data={sp} key={sp.name} />
31+
))}
32+
</div>
33+
</div>
34+
)
35+
}

apps/web/app/page.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Footer from "@/app/_components/footer"
88
import LandingSection from "@/app/_components/landing"
99
import { Navbar } from "@/app/_components/navbar"
1010
import QualificationSector from "@/app/_components/qualification"
11+
import Sponsors from "@/app/_components/sponsors"
1112
import Scope from "@/app/_components/scope"
1213
import Story from "@/app/_components/story"
1314
import Head from "next/head"
@@ -118,6 +119,9 @@ export default function Page() {
118119
<div id="story" className="flex min-h-screen items-center justify-center">
119120
<Story />
120121
</div>
122+
<div className="flex items-center justify-center">
123+
<Sponsors />
124+
</div>
121125
<div className="flex items-center justify-center">
122126
<Footer />
123127
</div>

apps/web/config/sponsors.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export enum SponsorTiers {
2+
"diamond" = 3,
3+
"platinum" = 2,
4+
"gold" = 1,
5+
}
6+
7+
export interface Sponsor {
8+
name: string
9+
tier: SponsorTiers
10+
image_path: string
11+
link?: string
12+
}
13+
14+
export const SponsorList: Sponsor[] = [
15+
{
16+
name: "IRE Learning",
17+
tier: SponsorTiers.gold,
18+
image_path: "/static/sponsors/ire-white.webp",
19+
link: "https://www.facebook.com/iretutor/",
20+
},
21+
]
5.7 KB
Loading
3.1 KB
Loading
7.96 KB
Loading

packages/ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@radix-ui/react-dropdown-menu": "^2.1.16",
1414
"@radix-ui/react-label": "^2.1.7",
1515
"@radix-ui/react-select": "^2.2.6",
16+
"@radix-ui/react-separator": "^1.1.7",
1617
"@radix-ui/react-slot": "^1.2.3",
1718
"class-variance-authority": "^0.7.1",
1819
"clsx": "^2.1.1",

0 commit comments

Comments
 (0)