Skip to content

Commit 7fc7bd0

Browse files
committed
refactor: accept isSecondary as direct props
1 parent 7de66c5 commit 7fc7bd0

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

src/components/ui/buttons/Button.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
109109
Button.displayName = "Button"
110110

111111
type ButtonLinkProps = Omit<LinkProps, "onClick"> &
112-
Pick<ButtonProps, "size" | "variant"> & {
112+
Pick<ButtonProps, "size" | "variant" | "isSecondary"> & {
113113
buttonProps?: Omit<ButtonProps, "size" | "variant">
114114
customEventOptions?: MatomoEventOptions
115115
}
@@ -119,6 +119,7 @@ const ButtonLink = React.forwardRef<HTMLAnchorElement, ButtonLinkProps>(
119119
{
120120
size,
121121
variant,
122+
isSecondary,
122123
buttonProps,
123124
customEventOptions,
124125
children,
@@ -131,7 +132,13 @@ const ButtonLink = React.forwardRef<HTMLAnchorElement, ButtonLinkProps>(
131132
customEventOptions && trackCustomEvent(customEventOptions)
132133
}
133134
return (
134-
<Button asChild size={size} variant={variant} {...buttonProps}>
135+
<Button
136+
asChild
137+
size={size}
138+
variant={variant}
139+
isSecondary={isSecondary}
140+
{...buttonProps}
141+
>
135142
<BaseLink
136143
ref={ref}
137144
className={cn("no-underline hover:no-underline", className)}

src/pages/what-is-ethereum.tsx

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -650,13 +650,7 @@ const WhatIsEthereumPage = ({
650650
<ButtonLink href="/smart-contracts/">
651651
{t("page-what-is-ethereum-more-on-smart-contracts")}
652652
</ButtonLink>
653-
<ButtonLink
654-
href="/dapps/"
655-
buttonProps={{
656-
variant: "outline",
657-
isSecondary: true,
658-
}}
659-
>
653+
<ButtonLink href="/dapps/" variant="outline" isSecondary>
660654
{t("page-what-is-ethereum-explore-dapps")}
661655
</ButtonLink>
662656
</ButtonRow>
@@ -679,13 +673,7 @@ const WhatIsEthereumPage = ({
679673
<ButtonLink href="/eth/">
680674
{t("page-what-is-ethereum-what-is-ether")}
681675
</ButtonLink>
682-
<ButtonLink
683-
href="/get-eth/"
684-
buttonProps={{
685-
variant: "outline",
686-
isSecondary: true,
687-
}}
688-
>
676+
<ButtonLink href="/get-eth/" variant="outline" isSecondary>
689677
{t("page-what-is-ethereum-get-eth")}
690678
</ButtonLink>
691679
</ButtonRow>
@@ -714,10 +702,8 @@ const WhatIsEthereumPage = ({
714702
</ButtonLink>
715703
<ButtonLink
716704
href="/roadmap/merge/"
717-
buttonProps={{
718-
variant: "outline",
719-
isSecondary: true,
720-
}}
705+
variant="outline"
706+
isSecondary
721707
>
722708
{t("page-what-is-ethereum-the-merge-update")}
723709
</ButtonLink>

0 commit comments

Comments
 (0)