From 0aa02f92eb67889bd4d7f2cb5fde77ec499b6766 Mon Sep 17 00:00:00 2001 From: Niko Date: Mon, 30 Jun 2025 15:05:38 +0200 Subject: [PATCH] Fix svg urls --- src/components/SocialMediaCard.astro | 8 +- src/components/SocialMediaSponsorCard.astro | 88 +++++++++++++------ .../ticket-tiers/ticket-tiers.astro | 1 + src/components/ui/Markdown.astro | 2 +- src/pages/media/speakers.astro | 11 +++ src/pages/media/sponsor/[slug].astro | 88 +++++++++++-------- src/pages/media/sponsors.astro | 11 +++ 7 files changed, 140 insertions(+), 69 deletions(-) diff --git a/src/components/SocialMediaCard.astro b/src/components/SocialMediaCard.astro index 1d149932a..ba8ab9b84 100644 --- a/src/components/SocialMediaCard.astro +++ b/src/components/SocialMediaCard.astro @@ -5,12 +5,12 @@ const { entry } = Astro.props; const sessions: CollectionEntry<"sessions">[]= await getEntries(entry.data.submissions); --- - + { entry.data.avatar ? ( - + []= await getEntries(entry.data.submi font-size: 100px; color: rgb(239, 215, 123); padding: 1rem; + position:relative; } .box2 { @@ -74,6 +75,7 @@ const sessions: CollectionEntry<"sessions">[]= await getEntries(entry.data.submi font-size: 70px; color:white; padding: 2rem; + position:relative; } .box3 { @@ -83,6 +85,7 @@ const sessions: CollectionEntry<"sessions">[]= await getEntries(entry.data.submi font-size: 100px; color: rgb(239, 215, 123); padding: 1rem; + position:relative; } .box4 { @@ -92,6 +95,7 @@ const sessions: CollectionEntry<"sessions">[]= await getEntries(entry.data.submi font-size: 70px; color:white; padding: 2rem; + position:relative; } diff --git a/src/components/SocialMediaSponsorCard.astro b/src/components/SocialMediaSponsorCard.astro index d3f58999c..c46794d6a 100644 --- a/src/components/SocialMediaSponsorCard.astro +++ b/src/components/SocialMediaSponsorCard.astro @@ -2,52 +2,84 @@ import { sponsorLogos } from "@data/sponsorLogos"; const { sponsor } = Astro.props; - const { name: title, logo_padding = false, } = sponsor.data; - const logo = sponsorLogos[sponsor.id]; -// Assuming logo.width and logo.height are known + +// Function to parse CSS padding values +function parsePadding(paddingStr: string) { + if (!paddingStr || paddingStr === "0") { + return { top: 0, right: 0, bottom: 0, left: 0 }; + } + + // Remove 'px' and split by spaces + const values = paddingStr.replace(/px/g, '').split(/\s+/).map(v => parseFloat(v) || 0); + + switch (values.length) { + case 1: + // "10px" -> all sides + return { top: values[0], right: values[0], bottom: values[0], left: values[0] }; + case 2: + // "15px 20px" -> top/bottom, left/right + return { top: values[0], right: values[1], bottom: values[0], left: values[1] }; + case 3: + // "10px 15px 20px" -> top, left/right, bottom + return { top: values[0], right: values[1], bottom: values[2], left: values[1] }; + case 4: + // "10px 15px 20px 25px" -> top, right, bottom, left + return { top: values[0], right: values[1], bottom: values[2], left: values[3] }; + default: + return { top: 0, right: 0, bottom: 0, left: 0 }; + } +} + +// Parse padding +const padding = parsePadding(logo_padding); + +// Calculate dimensions with padding const targetWidth = 400; const originalWidth = logo.width; const originalHeight = logo.height; const aspectRatio = originalWidth / originalHeight; -let width = targetWidth; +// Available space after padding +const availableWidth = targetWidth - padding.left - padding.right; +const maxHeight = 220; +const availableHeight = maxHeight - padding.top - padding.bottom; + +let width = availableWidth; let height = width / aspectRatio; -const maxHeight = 220; -if (height > maxHeight) { - height = maxHeight; - width = height * aspectRatio ; +// Check if height exceeds available space +if (height > availableHeight) { + height = availableHeight; + width = height * aspectRatio; } -const x = 450 - width / 2; -const y = 650 - height / 2; - +// Calculate position with padding offset +const x = 450 - (width + padding.left + padding.right) / 2 + padding.left; +const y = 650 - (height + padding.top + padding.bottom) / 2 + padding.top; --- - + + - - - - + +

{title} diff --git a/src/components/ticket-tiers/ticket-tiers.astro b/src/components/ticket-tiers/ticket-tiers.astro index 367fe2f92..b78cd1dd1 100644 --- a/src/components/ticket-tiers/ticket-tiers.astro +++ b/src/components/ticket-tiers/ticket-tiers.astro @@ -14,6 +14,7 @@ interface TicketTierProps { title: string; educationPrice?: number | string; personalPrice: number | string; + subtitle?: string; businessPrice: number | string; lateBusinessPrice?: number | string; latePersonalPrice?: number | string; diff --git a/src/components/ui/Markdown.astro b/src/components/ui/Markdown.astro index 076383932..61ad10804 100644 --- a/src/components/ui/Markdown.astro +++ b/src/components/ui/Markdown.astro @@ -4,7 +4,7 @@ import { replaceYouTubeLinks } from "@utils/markdown"; interface Props { content: string; - class: string; + class?: string; } const { content, class: className } = Astro.props; diff --git a/src/pages/media/speakers.astro b/src/pages/media/speakers.astro index 6ebae735f..980b60bcf 100644 --- a/src/pages/media/speakers.astro +++ b/src/pages/media/speakers.astro @@ -36,6 +36,8 @@ type Speaker = CollectionEntry<"speakers">; .social { width: 900px; height: 900px; + position: relative; + overflow: hidden; } .social svg { @@ -47,6 +49,15 @@ type Speaker = CollectionEntry<"speakers">; object-fit: contain; } +.social svg.bg { + z-index:0; +} + +.social svg.avatar { + z-index:10000; +} + + body * { font-family: Inter, sans-serif; } diff --git a/src/pages/media/sponsor/[slug].astro b/src/pages/media/sponsor/[slug].astro index 34134d013..364432db3 100644 --- a/src/pages/media/sponsor/[slug].astro +++ b/src/pages/media/sponsor/[slug].astro @@ -87,45 +87,57 @@ window.addEventListener('resize', fitAllText); diff --git a/src/pages/media/sponsors.astro b/src/pages/media/sponsors.astro index 43671e941..a41a93193 100644 --- a/src/pages/media/sponsors.astro +++ b/src/pages/media/sponsors.astro @@ -36,6 +36,8 @@ type Sponsor = CollectionEntry<"sponsors">; .social { width: 900px; height: 900px; + position: relative; + overflow: hidden; } .social svg { @@ -47,6 +49,15 @@ type Sponsor = CollectionEntry<"sponsors">; object-fit: contain; } +.social svg.bg { + z-index:0; +} + +.social svg.sponsor-logo{ + z-index:10000; +} + + body * { font-family: Inter, sans-serif; }