Skip to content

Commit 4b1c0dc

Browse files
committed
Migrate ButtonLink to Astro
1 parent c6dd397 commit 4b1c0dc

File tree

11 files changed

+48
-62
lines changed

11 files changed

+48
-62
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
import type React from 'react';
3+
4+
export interface Props {
5+
url: string;
6+
children: React.ReactNode;
7+
className?: string;
8+
secondary?: boolean;
9+
isExternal?: boolean;
10+
}
11+
12+
const { url, className = "", secondary = false, isExternal } = Astro.props;
13+
const resolvedIsExternal = isExternal !== undefined ? isExternal : url.startsWith("http");
14+
---
15+
16+
<a
17+
class={`font-bold text-lg px-4 py-4 bg-button rounded-[60px] inline-block leading-4 hover:bg-button-hover not-prose
18+
${secondary ? "bg-primary text-white hover:bg-primary-hover" : "text-text-inverted"}
19+
${secondary ? "text-text" : ""}
20+
${className || ""}`}
21+
href={url}
22+
>
23+
<slot />
24+
25+
{resolvedIsExternal && (
26+
<span class="inline-block ml-1 font-system text-lg leading-4">
27+
28+
</span>
29+
)}
30+
</a>

src/components/button-link/button-link.tsx

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/components/button-link/index.tsx

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/button-with-title/button-with-title.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ButtonLink } from "../button-link";
1+
import ButtonLink from "../button-link/button-link.astro";
22
import { Title } from "../typography/title";
33

44
type Props = {
@@ -15,7 +15,7 @@ export const ButtonWithTitle = ({ title, href, text }: Props) => {
1515
</Title>
1616

1717
<div>
18-
<ButtonLink href={href}>{text}</ButtonLink>
18+
<ButtonLink url={href}>{text}</ButtonLink>
1919
</div>
2020
</div>
2121
);

src/components/card/card.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import type { ImageMetadata } from "astro";
33
import { Image } from "astro:assets";
4-
import { ButtonLink } from "../button-link/button-link";
4+
import ButtonLink from "../button-link/button-link.astro";
55
66
export interface Props {
77
title: string;
@@ -28,7 +28,7 @@ const { title, subtitle, url, image } = Astro.props;
2828
<h3 class="text-3xl font-bold mt-2 mb-4 text-primary">{title}</h3>
2929
</a>
3030
<ButtonLink
31-
href={url}
31+
url={url}
3232
className="mb-4"
3333
isExternal={false}
3434
>

src/components/header/header-actions.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { ButtonLink } from "../button-link";
2+
import ButtonLink from "../button-link/button-link.astro";
33
import HeaderButton from "./header-button.astro";
44
55
export interface Props {
@@ -15,17 +15,17 @@ const IS_LIVE = false;
1515
{
1616
!mobile ? (
1717
<>
18-
<ButtonLink secondary href="https://www.europython-society.org/coc/">
18+
<ButtonLink secondary url="https://www.europython-society.org/coc/">
1919
<abbr title="Code of Conduct" class="no-underline md:hidden">
2020
CoC
2121
</abbr>
2222
<span class="hidden md:inline">Code of Conduct</span>
2323
</ButtonLink>
24-
<ButtonLink href="https://voting.europython.eu" className="hidden md:block">
24+
<ButtonLink url="https://voting.europython.eu" className="hidden md:block">
2525
<span>Community vote</span>
2626
</ButtonLink>
2727
{IS_LIVE && (
28-
<ButtonLink href="/live">
28+
<ButtonLink url="/live">
2929
Live
3030
<span class="hidden md:inline"> 📺</span>
3131
</ButtonLink>

src/components/hero-section/prague.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
import Prose from "../prose/prose.astro";
3-
import { ButtonLink } from "../button-link";
3+
import ButtonLink from "../button-link/button-link.astro";
44
import { Title } from "../typography/title";
55
import { Image } from "astro:assets";
66
@@ -31,12 +31,12 @@ import venueImage from "./prague.png";
3131
</Prose>
3232

3333
<div class="space-x-4 mb-5">
34-
<ButtonLink href="/where">
34+
<ButtonLink url="/where">
3535
Where is EuroPython?
3636
</ButtonLink>
3737
</div>
3838
<div class="space-x-12">
39-
<ButtonLink href="/explore">
39+
<ButtonLink url="/explore">
4040
Explore Prague
4141
</ButtonLink>
4242
</div>

src/components/keynoters/keynoters.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { ButtonLink } from "../button-link/button-link";
2+
import ButtonLink from "../button-link/button-link.astro";
33
import { Title } from "../typography/title";
44
import Keynoter from "./keynoter.astro";
55
@@ -120,7 +120,7 @@ const placeholders = Math.max(0, 6 - keynoters.length);
120120
<span class="text-body-light inline-block mr-2">#</span>
121121
See other sessions
122122
</h3>
123-
<ButtonLink href="/sessions">List of Sessions</ButtonLink>
123+
<ButtonLink url="/sessions">List of Sessions</ButtonLink>
124124
</div>
125125
</div>
126126
</section>

src/components/sponsors/sponsors.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Separator } from "../separator/separator";
44
import { Fragment } from "react";
55
import { Fullbleed } from "../layout/fullbleed";
66
7-
import { ButtonLink } from "../button-link";
7+
import ButtonLink from "../button-link/button-link.astro";
88
import { Title } from "../typography/title";
99
1010
import SponsorTier from "./sponsor-tier.astro";
@@ -70,7 +70,7 @@ const topTier = sponsorTiers.find((tier) => tier.name === "Keystone");
7070
}
7171

7272
<div class="mt-4">
73-
<ButtonLink href="/sponsor">Become a sponsor</ButtonLink>
73+
<ButtonLink url="/sponsor">Become a sponsor</ButtonLink>
7474
</div>
7575
</div>
7676
</div>

src/content/pages/programme/voting.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ from Wednesday, 5 February 23:00:00 UTC
2020

2121
until Monday, 17 February 23:59:59 UTC
2222

23-
<ButtonLink href="https://voting.europython.eu">Cast your votes now!</ButtonLink>
23+
<ButtonLink url="https://voting.europython.eu">Cast your votes now!</ButtonLink>
2424
</div>
2525

2626

@@ -94,7 +94,7 @@ of the major factors upon which they rely, will be the preferences of the
9494
community through this voting process.
9595

9696
<div style={{textAlign: "center", marginBottom: 10}}>
97-
<ButtonLink href="https://voting.europython.eu">Go to the community voting</ButtonLink>
97+
<ButtonLink url="https://voting.europython.eu">Go to the community voting</ButtonLink>
9898
</div>
9999

100100

0 commit comments

Comments
 (0)