Skip to content

Commit 417c803

Browse files
refactor: connect ShadCN Link to ShadCN ButtonLink
1 parent 9361453 commit 417c803

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

src/components/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import Translation from "@/components/Translation"
99
import { cn } from "@/lib/utils/cn"
1010
import { scrollIntoView } from "@/lib/utils/scrollIntoView"
1111

12-
import { BaseLink } from "../../tailwind/Link"
1312
import { Button } from "../../tailwind/ui/buttons/Button"
13+
import { BaseLink } from "../../tailwind/ui/Link"
1414

1515
import { List, ListItem } from "./ui/list"
1616

src/components/SkipLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useTranslation } from "next-i18next"
22

33
import { MAIN_CONTENT_ID } from "@/lib/constants"
44

5-
import { BaseLink } from "../../tailwind/Link"
5+
import { BaseLink } from "../../tailwind/ui/Link"
66

77
export const SkipLink = () => {
88
const { t } = useTranslation()
File renamed without changes.

tailwind/ui/__stories__/Button.stories.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import type { Meta, StoryObj } from "@storybook/react"
44
import Translation from "@/components/Translation"
55

66
import { HStack, VStack } from "../../../src/components/ui/flex"
7-
import { Button, type ButtonVariantProps } from "../buttons/Button"
8-
import { ButtonLink } from "../buttons/Button"
7+
import { Button, ButtonLink, type ButtonVariantProps } from "../buttons/Button"
98

109
const meta = {
1110
title: "Atoms / Form / ShadCn Buttons",
@@ -118,7 +117,7 @@ export const OverrideStyles: Story = {
118117
<MdNightlight />
119118
</Button>
120119
<ButtonLink
121-
className="rounded-full px-0 py-0"
120+
className="min-h-0 rounded-full px-0 py-0"
122121
linkProps={{ href: "#" }}
123122
>
124123
<Translation id="get-involved" />

tailwind/ui/buttons/Button.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import * as React from "react"
22
import { cva, type VariantProps } from "class-variance-authority"
33
import { Slot } from "@radix-ui/react-slot"
44

5-
import { BaseLink, type LinkProps } from "@/components/Link"
6-
75
import { cn } from "@/lib/utils/cn"
86
import { type MatomoEventOptions, trackCustomEvent } from "@/lib/utils/matomo"
97
import { scrollIntoView } from "@/lib/utils/scrollIntoView"
108

9+
import { BaseLink, type LinkProps } from "../Link"
10+
1111
const buttonVariants = cva(
1212
"pointer inline-flex gap-2 items-center justify-center rounded border border-solid border-current text-primary transition focus-visible:outline focus-visible:outline-4 focus-visible:outline-primary-hover focus-visible:-outline-offset-1 disabled:text-disabled disabled:pointer-events-none hover:text-primary-hover [&[data-secondary='true']]:text-body [&>svg]:flex-shrink-0",
1313
{
1414
variants: {
1515
variant: {
1616
solid:
17-
"!text-background bg-primary border-transparent disabled:bg-disabled disabled:text-background hover:text-background hover:bg-primary-hover hover:shadow-button-hover active:shadow-none",
17+
"text-background bg-primary border-transparent disabled:bg-disabled disabled:text-background hover:text-background hover:bg-primary-hover hover:shadow-button-hover active:shadow-none",
1818
outline: "hover:shadow-button-hover active:shadow-none",
1919
ghost: "border-transparent",
2020
link: "border-transparent font-bold underline py-0 px-1 active:text-primary",
@@ -120,15 +120,8 @@ const ButtonLink = React.forwardRef<HTMLAnchorElement, ButtonLinkProps>(
120120
<Button asChild {...buttonProps}>
121121
<BaseLink
122122
ref={ref}
123-
activeStyle={{}}
124-
// TODO: Redress this override when migrating the link component
125-
color={
126-
buttonProps.variant === "solid" ? "background.base" : undefined
127-
}
128-
textDecor="none"
129-
_hover={{
130-
textDecor: "none",
131-
}}
123+
className="no-underline hover:no-underline"
124+
activeClassName=""
132125
{...linkProps}
133126
onClick={handleClick}
134127
>

0 commit comments

Comments
 (0)