From 72bc76a28f5c1b050d8125d80c6146526b699600 Mon Sep 17 00:00:00 2001 From: HiDeoo <494699+HiDeoo@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:59:42 +0200 Subject: [PATCH] Support the `class` attribute for hero action link buttons (#2253) Co-authored-by: Chris Swithinbank --- .changeset/ten-rats-accept.md | 5 +++++ packages/starlight/components/Hero.astro | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .changeset/ten-rats-accept.md diff --git a/.changeset/ten-rats-accept.md b/.changeset/ten-rats-accept.md new file mode 100644 index 00000000000..8fb0c418e6d --- /dev/null +++ b/.changeset/ten-rats-accept.md @@ -0,0 +1,5 @@ +--- +'@astrojs/starlight': patch +--- + +Fixes an issue preventing to use the `class` attribute in hero action link buttons. diff --git a/packages/starlight/components/Hero.astro b/packages/starlight/components/Hero.astro index 51be009ab46..0d184d40383 100644 --- a/packages/starlight/components/Hero.astro +++ b/packages/starlight/components/Hero.astro @@ -50,12 +50,14 @@ if (image) { { actions.length > 0 && (
- {actions.map(({ attrs, icon, link: href, text, variant }) => ( - - {text} - {icon?.html && } - - ))} + {actions.map( + ({ attrs: { class: className, ...attrs } = {}, icon, link: href, text, variant }) => ( + + {text} + {icon?.html && } + + ) + )}
) }