Merged in feat/sw-2873-move-backtotopbutton-to-design-system (pull request #2593)
feat(SW-2873): Move BackToTopButton to design-system * Remove dependency on i18n in BackToTopButton * Move BackToTopButton to design-system Approved-by: Hrishikesh Vaipurkar
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
'use client'
|
||||
|
||||
import { type Button, Button as ButtonRAC } from 'react-aria-components'
|
||||
|
||||
import { MaterialIcon } from '../Icons/MaterialIcon'
|
||||
import { Typography } from '../Typography'
|
||||
|
||||
import { backToTopButtonVariants } from './variants'
|
||||
|
||||
import styles from './backToTopButton.module.css'
|
||||
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import type { ComponentProps } from 'react'
|
||||
|
||||
interface BackToTopButtonProps
|
||||
extends ComponentProps<typeof Button>,
|
||||
VariantProps<typeof backToTopButtonVariants> {
|
||||
label: string
|
||||
}
|
||||
|
||||
export function BackToTopButton({
|
||||
position,
|
||||
label,
|
||||
...props
|
||||
}: BackToTopButtonProps) {
|
||||
return (
|
||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||
<ButtonRAC
|
||||
className={backToTopButtonVariants({ position })}
|
||||
aria-label={label}
|
||||
{...props}
|
||||
>
|
||||
<MaterialIcon icon="arrow_upward" color="CurrentColor" size={20} />
|
||||
<span className={styles.text}>{label}</span>
|
||||
</ButtonRAC>
|
||||
</Typography>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user