Skip to content

Commit aaa4f52

Browse files
authored
Add disabled prop to ButtonLink (#1008)
- Migrates ButtonLink to Astro, and adds a disabled prop to it. - Removes redundant ButtonWithTitle component. See https://add-disabled-prop.ep-preview.click/programme/mentorship/ for example Closes #978
1 parent c5f28a5 commit aaa4f52

File tree

17 files changed

+62
-128
lines changed

17 files changed

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

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

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

src/components/button/button.tsx

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

src/components/button/index.tsx

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

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/images/voting.png

5.04 KB
Loading

src/content/pages/programme/cfp.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ subtitle: A set of tips to help you put together a strong, compelling EuroPython
1010
The Call for Proposals ran from the 10th of January to the 3rd of February 2025, 23:59 UTC.
1111

1212
<div class="text-center">
13-
<ButtonWithTitle title="Call for Reviewers Now Open" href="https://forms.gle/4GTJjwZ1nHBGetM18" text="JOIN THE REVIEWER TEAM!"></ButtonWithTitle></div>
13+
### Call for Reviewers Now Open
14+
<ButtonLink url="https://forms.gle/4GTJjwZ1nHBGetM18">JOIN THE REVIEWER TEAM!</ButtonLink>
15+
</div>
1416

1517
-----
1618

src/content/pages/programme/mentorship.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mentee what their contribution should be (that's for the mentee to decide).
2727
## Mentors
2828

2929
<div class="text-center">
30-
<Button>Signup closed</Button>
30+
<ButtonLink disabled>Signup closed</ButtonLink>
3131
</div>
3232

3333
We expect mentors to have past speaking experience at conferences similar to
@@ -48,7 +48,7 @@ You will also be invited to join the panel of the Webinar Workshops.
4848
## Mentee
4949

5050
<div class="text-center">
51-
<Button>Signup closed</Button>
51+
<ButtonLink disabled>Signup closed</ButtonLink>
5252
</div>
5353

5454
If you require help contributing to EuroPython, especially if you are from an

src/content/pages/programme/voting.mdx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ title: Voting
33
subtitle: Your opinion for a great conference!
44
---
55

6+
import { Image } from "astro:assets";
7+
import voteOptions from "../images/voting.png";
8+
69
# Community Voting
710

811
Welcome to EuroPython Community Voting! We want feedback about what YOU would
@@ -20,7 +23,7 @@ from Wednesday, 5 February 23:00:00 UTC
2023

2124
until Monday, 17 February 23:59:59 UTC
2225

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

2629

@@ -67,14 +70,7 @@ to receive a new confirmation link.
6770

6871
For each submission, you can choose only one of four options
6972

70-
<div style={{textAlign: "center", marginBottom: 8}}>
71-
<Button>Must see</Button>
72-
<Button>Want to see</Button>
73-
</div>
74-
<div style={{textAlign: "center", marginBottom: 8}}>
75-
<Button>Maybe</Button>
76-
<Button>Not interested</Button>
77-
</div>
73+
<Image src={voteOptions} alt="Vote Options" width="1200" class="w-full h-auto border-4 border-white rounded-lg shadow-lg" />
7874

7975
- Your vote for each submission is automatically saved, but you can change it
8076
at any time before the voting phase ends.
@@ -93,9 +89,12 @@ programme team who curate and are responsible for the final programme, but one
9389
of the major factors upon which they rely, will be the preferences of the
9490
community through this voting process.
9591

96-
<div style={{textAlign: "center", marginBottom: 10}}>
97-
<ButtonLink href="https://voting.europython.eu">Go to the community voting</ButtonLink>
98-
</div>
92+
<ButtonLink
93+
url="https://voting.europython.eu"
94+
className="flex justify-center mb-10"
95+
>
96+
Go to the community voting
97+
</ButtonLink>
9998

10099

101100
**[Subscribe to our newsletter](https://blog.europython.eu/#/portal/signup)**

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ import { type CollectionEntry, getCollection } from "astro:content";
33
import Layout from "../layouts/Layout.astro";
44
55
import Prose from "../components/prose/prose.astro";
6-
import { ButtonLink } from "../components/button-link";
7-
import { Button } from "../components/button";
6+
import ButtonLink from "../components/button-link/button-link.astro";
87
import { Separator } from "../components/separator/separator";
98
import { Map } from "../components/map";
109
import { MapSprints } from "../components//map-for-sprints";
1110
import { YouTube } from "@astro-community/astro-embed-youtube";
1211
import BenefitsList from "../components/benefits-list/benefits-list.astro";
1312
import BenefitItem from "../components/benefits-list/benefit-item.astro";
14-
import { ButtonWithTitle } from "../components/button-with-title";
1513
import { Note } from "../components/note";
1614
import { SponsorTiers } from "../components/sponsor-tiers";
1715
@@ -38,13 +36,11 @@ const description = post.data.subtitle;
3836
<Content
3937
components={{
4038
ButtonLink,
41-
Button,
4239
Map,
4340
MapSprints,
4441
YouTube,
4542
BenefitItem,
4643
BenefitsList,
47-
ButtonWithTitle,
4844
Note,
4945
SponsorTiers,
5046
hr: Separator,

0 commit comments

Comments
 (0)