Merged in chore/sw-3145-move-footnote (pull request #2506)
chore(SW-3145): Move Footnote to design-system * Move Footnote to design-system Approved-by: Joakim Jäderberg
This commit is contained in:
43
packages/design-system/lib/components/Footnote/index.tsx
Normal file
43
packages/design-system/lib/components/Footnote/index.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import { Slot } from '@radix-ui/react-slot'
|
||||
|
||||
import { footnoteFontOnlyVariants, footnoteVariants } from './variants'
|
||||
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
|
||||
interface FootnoteProps
|
||||
extends Omit<React.HTMLAttributes<HTMLParagraphElement>, 'color'>,
|
||||
VariantProps<typeof footnoteVariants> {
|
||||
asChild?: boolean
|
||||
fontOnly?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `@scandic-hotels/design-system/Typography` instead.
|
||||
*/
|
||||
export default function Footnote({
|
||||
asChild = false,
|
||||
className = '',
|
||||
color,
|
||||
fontOnly = false,
|
||||
textAlign,
|
||||
textTransform,
|
||||
type,
|
||||
...props
|
||||
}: FootnoteProps) {
|
||||
const Comp = asChild ? Slot : 'p'
|
||||
const classNames = fontOnly
|
||||
? footnoteFontOnlyVariants({
|
||||
className,
|
||||
textAlign,
|
||||
textTransform,
|
||||
type,
|
||||
})
|
||||
: footnoteVariants({
|
||||
className,
|
||||
color,
|
||||
textAlign,
|
||||
textTransform,
|
||||
type,
|
||||
})
|
||||
return <Comp className={classNames} {...props} />
|
||||
}
|
||||
Reference in New Issue
Block a user