chore: SW-3145 Moved Button component from TempDS to Design System package * chore: SW-3145 Moved Button compoenent from TempDS to Design System package Approved-by: Anton Gunnarsson
56 lines
1.1 KiB
TypeScript
56 lines
1.1 KiB
TypeScript
'use client'
|
|
|
|
import { Slot } from '@radix-ui/react-slot'
|
|
import { Button as ButtonRAC } from 'react-aria-components'
|
|
|
|
import { buttonVariants } from './variants'
|
|
|
|
import type { ButtonProps } from './button'
|
|
|
|
/**
|
|
* @deprecated Use `@scandic-hotels/design-system/Button` instead.
|
|
*/
|
|
export function OldDSButton(props: ButtonProps) {
|
|
const {
|
|
className,
|
|
clean,
|
|
intent,
|
|
size,
|
|
theme,
|
|
fullWidth,
|
|
wrapping,
|
|
variant,
|
|
...restProps
|
|
} = props
|
|
|
|
const classNames = buttonVariants({
|
|
className,
|
|
clean,
|
|
intent,
|
|
size,
|
|
theme,
|
|
fullWidth,
|
|
wrapping,
|
|
variant,
|
|
})
|
|
|
|
if (restProps.asChild) {
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
const { asChild, ...slotProps } = restProps
|
|
return <Slot className={classNames} {...slotProps} />
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
const { asChild, onClick, disabled, ...racProps } = restProps
|
|
return (
|
|
<ButtonRAC
|
|
className={classNames}
|
|
isDisabled={disabled}
|
|
onPress={onClick}
|
|
{...racProps}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export type { ButtonPropsRAC, ButtonProps } from './button'
|