mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-04 16:07:43 +00:00
eff0cb4afb
This new ui implement the new sketches and also enables the usage of virtual background in a nice way.
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import {
|
|
ToggleButton as RACToggleButton,
|
|
ToggleButtonProps as RACToggleButtonProps,
|
|
} from 'react-aria-components'
|
|
import { type ButtonRecipeProps, buttonRecipe } from './buttonRecipe'
|
|
import { TooltipWrapper, TooltipWrapperProps } from './TooltipWrapper'
|
|
import { ReactNode } from 'react'
|
|
|
|
export type ToggleButtonProps = RACToggleButtonProps &
|
|
ButtonRecipeProps &
|
|
TooltipWrapperProps & {
|
|
// Use tooltip as description below the button.
|
|
description?: boolean
|
|
}
|
|
|
|
/**
|
|
* React aria ToggleButton with our button styles, that can take a tooltip if needed
|
|
*/
|
|
export const ToggleButton = ({
|
|
tooltip,
|
|
tooltipType,
|
|
...props
|
|
}: ToggleButtonProps) => {
|
|
const [variantProps, componentProps] = buttonRecipe.splitVariantProps(props)
|
|
|
|
return (
|
|
<TooltipWrapper tooltip={tooltip} tooltipType={tooltipType}>
|
|
<RACToggleButton
|
|
{...componentProps}
|
|
className={[buttonRecipe(variantProps), props.className].join(' ')}
|
|
>
|
|
<>
|
|
{componentProps.children as ReactNode}
|
|
{props.description && <span>{tooltip}</span>}
|
|
</>
|
|
</RACToggleButton>
|
|
</TooltipWrapper>
|
|
)
|
|
}
|