Skip to content

Commit

Permalink
feat(Subnav): pass ctalinks onclick through to cta buttons (#900)
Browse files Browse the repository at this point in the history
* pass onlick through ctalinks

* add changeset

* update docs
  • Loading branch information
alexcarpenter committed Mar 9, 2023
1 parent a5be4e8 commit 9822d78
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-bags-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hashicorp/react-subnav': patch
---

pass onclick handler through ctalink
1 change: 1 addition & 0 deletions packages/subnav/partials/CtaLinks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function CtaLinks({ links, product, isInDropdown, hideGithubStars, theme }) {
title={link.text}
url={link.url}
icon={isDownload ? iconDownload : isGithub ? iconGithub : undefined}
onClick={link.onClick}
theme={{
brand: product,
variant: isLastButton ? 'primary' : 'secondary',
Expand Down
5 changes: 5 additions & 0 deletions packages/subnav/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ module.exports = {
description:
'An optional theme object, which will be passed to the Button element for this link, and will override and default settings in the component.',
},
onClick: {
type: 'function',
description:
'Optional function that will be called when the button is clicked.',
},
},
},
],
Expand Down

1 comment on commit 9822d78

@vercel
Copy link

@vercel vercel bot commented on 9822d78 Mar 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.