Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 42 additions & 25 deletions components/headline-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
import { useEffect, useState } from 'react'
import Link from 'next/link'

type HeadlineMessage = { label: string; text: string; href: string; /** Shown instead of `text` on phones, where the bar has one line */ shortText?: string }
type HeadlineMessage = {
label: string
text: string
href: string
/** Shown instead of `text` on phones, where the bar has one line */
shortText?: string
/** A second link beside the message, for example the partner's own page */
secondary?: { label: string; href: string }
}

// Add an entry here to show a banner. Leave the array empty to hide the bar.
// Past entries, for reference:
Expand All @@ -15,9 +23,40 @@ const messages: HeadlineMessage[] = [
text: 'Qantara, the Palestinian AI Fellowship, is coming. We are excited to be a partner.',
shortText: "Qantara is coming. We're excited!",
href: '/qantara',
secondary: { label: 'EmpactUs', href: 'https://empactus.org.uk/qantara-the-palestinian-ai-fellowship/' },
},
]

/** One banner message: the main link, and an optional second link beside it */
function Row({ message, animation }: { message: HeadlineMessage; animation: string }) {
return (
<div
className="absolute inset-x-4 flex items-center justify-center gap-3"
style={{ animation: `${animation} 650ms ease-out both` }}
>
<Link href={message.href} className="flex items-center justify-center gap-2">
<span
className={`whitespace-nowrap rounded-full bg-white px-2.5 py-0.5 uppercase text-[10px] sm:text-[11px] font-bold tracking-[0.16em] text-[#0A4A1D] shadow-sm ${message.secondary ? 'hidden sm:inline-block' : ''}`}
>
{message.label}
</span>
<span className="hidden lg:inline">{message.text}</span>
<span className="whitespace-nowrap lg:hidden">{message.shortText ?? message.text}</span>
</Link>
{message.secondary && (
<a
href={message.secondary.href}
target="_blank"
rel="noopener"
className="whitespace-nowrap font-bold underline underline-offset-4 decoration-white/60 hover:decoration-white"
>
{message.secondary.label} <span aria-hidden="true">↗</span>
</a>
)}
</div>
)
}

export function HeadlineBar() {
const [activeIndex, setActiveIndex] = useState(0)
const [leavingIndex, setLeavingIndex] = useState<number | null>(null)
Expand Down Expand Up @@ -54,32 +93,10 @@ export function HeadlineBar() {
<div className="container mx-auto px-4 sm:px-6 lg:px-8">
<div className="relative flex min-h-10 items-center justify-center overflow-hidden py-2 text-center text-[11px] sm:text-sm font-semibold tracking-wide">
{leavingMessage && (
<Link
key={`leaving-${leavingIndex}`}
href={leavingMessage.href}
className="absolute inset-x-4 flex items-center justify-center gap-2"
style={{ animation: `${leavingAnimation} 650ms ease-out both` }}
>
<span className="whitespace-nowrap rounded-full bg-white px-2.5 py-0.5 uppercase text-[10px] sm:text-[11px] font-bold tracking-[0.16em] text-[#0A4A1D] shadow-sm">
{leavingMessage.label}
</span>
<span className="hidden sm:inline">{leavingMessage.text}</span>
<span className="whitespace-nowrap sm:hidden">{leavingMessage.shortText ?? leavingMessage.text}</span>
</Link>
<Row key={`leaving-${leavingIndex}`} message={leavingMessage} animation={leavingAnimation} />
)}

<Link
key={`active-${activeIndex}`}
href={activeMessage.href}
className="absolute inset-x-4 flex items-center justify-center gap-2"
style={{ animation: `${enteringAnimation} 650ms ease-out both` }}
>
<span className="whitespace-nowrap rounded-full bg-white px-2.5 py-0.5 uppercase text-[10px] sm:text-[11px] font-bold tracking-[0.16em] text-[#0A4A1D] shadow-sm">
{activeMessage.label}
</span>
<span className="hidden sm:inline">{activeMessage.text}</span>
<span className="whitespace-nowrap sm:hidden">{activeMessage.shortText ?? activeMessage.text}</span>
</Link>
<Row key={`active-${activeIndex}`} message={activeMessage} animation={enteringAnimation} />
</div>
</div>
<style jsx global>{`
Expand Down
1 change: 1 addition & 0 deletions components/home/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export const partners: Org[] = [
{ name: "Hoopo", href: "https://www.gohoopo.com", logo: "/logos/hoopo.svg" },
{ name: "Cyberiad Labs", href: "https://cyberiadlabs.com", logo: "/logos/cyberiad-labs.svg", iconOnly: true },
{ name: "Edorax", href: "https://www.edorax.com", logo: "/logos/edorax.svg" },
{ name: "Major League Hacking", href: "https://mlh.io", logo: "/logos/mlh.svg", tall: true },
]
export const communityPartners: Org[] = [
{ name: "MLSA COMSATS", href: "https://mvp.microsoft.com/studentambassadors", logo: null },
Expand Down
1 change: 1 addition & 0 deletions components/home/logo-mark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const LOGO_SIZES: Record<string, [number, number]> = {
"/logos/linux-foundation.svg": [500, 500],
"/logos/max.png": [217, 168],
"/logos/microsoft.svg": [338, 72],
"/logos/mlh.svg": [343, 145],
"/logos/microtechx.png": [730, 108],
"/logos/nectar-social.svg": [66, 16],
"/logos/olostep.svg": [341, 102],
Expand Down
11 changes: 11 additions & 0 deletions public/logos/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,5 +287,16 @@
"width": 4260,
"height": 860,
"notes": "Navy wordmark with blue, navy and yellow X mark, transparent background."
},
{
"name": "Major League Hacking",
"slug": "mlh",
"website": "https://mlh.io/",
"file": "mlh.svg",
"format": "svg",
"source": "Official brand guidelines download (https://static.mlh.io/brand-assets/logo/official/mlh-logo-black.svg), approved black variant",
"width": 343,
"height": 145,
"notes": "Black logo on transparent. Shown as a single-tone black mark like the other partner logos."
}
]
Loading
Loading