Skip to content

Commit 8d9118c

Browse files
committed
Fix paths.
1 parent 3c10d4a commit 8d9118c

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

src/components/SocialMediaSponsorCard.astro

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
---
22
import { getEntry } from "astro:content";
3-
import SponsorLogo from "@components/SponsorLogo.astro";
4-
import { Image } from "astro:assets";
53
import { sponsorLogos } from "@data/sponsorLogos";
6-
import { ta } from "date-fns/locale";
74
8-
const { slug:sponsorId } = Astro.props;
9-
10-
const sponsor = await getEntry("sponsors", sponsorId);
11-
12-
if (!sponsor) {
13-
throw new Error(`Sponsor with ID "${sponsorId}" not found`);
14-
}
5+
const { sponsor } = Astro.props;
156
167
const {
178
name: title,
@@ -25,7 +16,7 @@ const logo = sponsorLogos[sponsor.id];
2516
const targetWidth = 400;
2617
const aspectRatio = logo.width / logo.height;
2718
const targetHeight = targetWidth / aspectRatio;
28-
const maxHeight = 240;
19+
const maxHeight = 220;
2920
const realHeight = targetHeight < maxHeight? targetHeight : maxHeight;
3021
3122
const x = 650 - targetWidth/ 2;
@@ -50,6 +41,8 @@ const y = 650 - realHeight / 2;
5041
m 885 885 l -240 0 a 240 240 0 0 1 -240 -240 a 240 240 0 0 1 240 -240 a 240 240 0 0 1 240 240 z
5142
"
5243
fill="white"
44+
stroke="#F5B91A"
45+
stroke-width="8"
5346
/>
5447

5548
<image

src/pages/media/social_media_sponsor_cards.astro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import { getCollection, type CollectionEntry } from "astro:content";
33
import SocialMediaSponsorCard from "@components/SocialMediaSponsorCard.astro";
4+
import { slugify } from "@utils/content";
45
56
67
const sponsors = await getCollection("sponsors");
@@ -19,10 +20,10 @@ type Sponsor = CollectionEntry<"sponsors">;
1920
</head>
2021
<body class="overflow-auto">
2122
{
22-
sponsors.map((entry: Sponsor) => (
23-
<a href=`/media/card/${entry.data.slug}`>
24-
<div class="social relative w-[900px] h-[900px] overflow-hidden" data-slug={entry.data.slug}>
25-
<SocialMediaSponsorCard slug={entry.id} />
23+
sponsors.map((sponsor: Sponsor) => (
24+
<a href=`/media/sponsor/${sponsor.id}`>
25+
<div class="social relative w-[900px] h-[900px] overflow-hidden" data-slug={sponsor.id}>
26+
<SocialMediaSponsorCard {sponsor} />
2627
</div>
2728
</a>
2829
))

src/pages/media/sponsor/[slug].astro

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
---
2-
import { getCollection} from "astro:content";
2+
import { getEntry, getCollection} from "astro:content";
33
import SocialMediaSponsorCard from "@components/SocialMediaSponsorCard.astro";
4-
import { slugify } from "@utils/content";
5-
6-
74
85
export async function getStaticPaths() {
96
const entries = await getCollection("sponsors");
107
return entries.map((entry) => ({
11-
params: { slug: slugify(entry.data.name)},
8+
params: { slug: entry.id},
129
props: { entry },
1310
}));
1411
}
1512
16-
const { entry } = Astro.props;
13+
const { entry:sponsor } = Astro.props;
14+
1715
---
1816
<!DOCTYPE html>
1917
<html lang="en">
@@ -28,9 +26,9 @@ const { entry } = Astro.props;
2826
</head>
2927
<body class="overflow-auto">
3028
{
31-
entry &&
29+
sponsor &&
3230
<div class="social relative w-[900px] h-[900px] overflow-hidden">
33-
<SocialMediaSponsorCard entry={entry} slug={slugify(entry.data.name)} />
31+
<SocialMediaSponsorCard {sponsor} />
3432
</div>
3533
}
3634

@@ -87,7 +85,7 @@ fitAllText();
8785
window.addEventListener('resize', fitAllText);
8886
</script>
8987

90-
<script is:inline define:vars={{slug: entry.data.slug}}>
88+
<script is:inline define:vars={{slug: sponsor.id}}>
9189
document.addEventListener('DOMContentLoaded', () => {
9290
document.querySelectorAll('.social').forEach((socialDiv, index) => {
9391

0 commit comments

Comments
 (0)