Skip to content

Commit

Permalink
Support the class attribute for hero action link buttons (#2253)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
  • Loading branch information
HiDeoo and delucis authored Sep 2, 2024
1 parent 746e0cd commit 72bc76a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/ten-rats-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/starlight': patch
---

Fixes an issue preventing to use the `class` attribute in hero action link buttons.
14 changes: 8 additions & 6 deletions packages/starlight/components/Hero.astro
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ if (image) {
{
actions.length > 0 && (
<div class="sl-flex actions">
{actions.map(({ attrs, icon, link: href, text, variant }) => (
<LinkButton {href} {variant} icon={icon?.name} {...attrs}>
{text}
{icon?.html && <Fragment set:html={icon.html} />}
</LinkButton>
))}
{actions.map(
({ attrs: { class: className, ...attrs } = {}, icon, link: href, text, variant }) => (
<LinkButton {href} {variant} icon={icon?.name} class:list={[className]} {...attrs}>
{text}
{icon?.html && <Fragment set:html={icon.html} />}
</LinkButton>
)
)}
</div>
)
}
Expand Down

0 comments on commit 72bc76a

Please sign in to comment.