Merged in feat/sw-3226-move-buttonlink-to-design-system (pull request #2613)
feat(SW-3226): Move ButtonLink to design-system * Move ButtonLink to design-system * Fix Button import Approved-by: Linus Flood
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
.buttonLink {
|
||||
border-radius: var(--Corner-radius-rounded);
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--Space-x05);
|
||||
}
|
||||
45
packages/design-system/lib/components/ButtonLink/index.tsx
Normal file
45
packages/design-system/lib/components/ButtonLink/index.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
'use client'
|
||||
|
||||
import Link from 'next/link'
|
||||
import { type ComponentProps, type PropsWithChildren } from 'react'
|
||||
|
||||
import { variants } from './variants'
|
||||
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
|
||||
export interface ButtonLinkProps
|
||||
extends PropsWithChildren,
|
||||
Omit<ComponentProps<typeof Link>, 'color'>,
|
||||
VariantProps<typeof variants> {}
|
||||
|
||||
export default function ButtonLink({
|
||||
variant,
|
||||
color,
|
||||
size,
|
||||
typography,
|
||||
wrapping,
|
||||
className,
|
||||
href,
|
||||
target,
|
||||
onClick = () => {},
|
||||
...props
|
||||
}: ButtonLinkProps) {
|
||||
const classNames = variants({
|
||||
variant,
|
||||
color,
|
||||
size,
|
||||
wrapping,
|
||||
typography,
|
||||
className,
|
||||
})
|
||||
|
||||
return (
|
||||
<Link
|
||||
className={classNames}
|
||||
href={href}
|
||||
target={target}
|
||||
onClick={onClick}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { cva } from 'class-variance-authority'
|
||||
|
||||
import { withButton } from '../Button'
|
||||
|
||||
import styles from './buttonLink.module.css'
|
||||
|
||||
export const variants = cva(styles.buttonLink, withButton({}))
|
||||
Reference in New Issue
Block a user