diff options
author | HiDeoo | 2024-09-02 14:59:42 +0200 |
---|---|---|
committer | GitHub | 2024-09-02 14:59:42 +0200 |
commit | 72bc76a28f5c1b050d8125d80c6146526b699600 (patch) | |
tree | 497918968bdecce9288bc5ed859d84d70404601c | |
parent | 746e0cd301f4ac4a182e8c45b36865c61d208b77 (diff) | |
download | IT.starlight-72bc76a28f5c1b050d8125d80c6146526b699600.tar.gz IT.starlight-72bc76a28f5c1b050d8125d80c6146526b699600.tar.bz2 IT.starlight-72bc76a28f5c1b050d8125d80c6146526b699600.zip |
Support the `class` attribute for hero action link buttons (#2253)
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
-rw-r--r-- | .changeset/ten-rats-accept.md | 5 | ||||
-rw-r--r-- | packages/starlight/components/Hero.astro | 14 |
2 files changed, 13 insertions, 6 deletions
diff --git a/.changeset/ten-rats-accept.md b/.changeset/ten-rats-accept.md new file mode 100644 index 00000000..8fb0c418 --- /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 51be009a..0d184d40 100644 --- a/packages/starlight/components/Hero.astro +++ b/packages/starlight/components/Hero.astro @@ -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> ) } |