'use client' import { forwardRef } from 'react' import { isBezierIcon } from '@channel.io/bezier-icons' import classNames from 'classnames' import { type FloatingButtonProps, type FloatingButtonSize, } from '~/src/components/AlphaFloatingButton/FloatingButton.types' import { AlphaLoader } from '~/src/components/AlphaLoader' import { BaseButton } from '~/src/components/BaseButton' import { Icon, type IconSize } from '~/src/components/Icon' import { Text } from '~/src/components/Text' import styles from './FloatingButton.module.scss' function SideContent({ size, content, }: { size: IconSize content?: FloatingButtonProps['prefixContent'] }) { return isBezierIcon(content) ? ( ) : ( content ) } function getIconSize(size: FloatingButtonSize) { return ( { xs: 'xs', s: 'xs', m: 's', l: 's', xl: 'm', } as const )[size] } function getTypography(size: FloatingButtonSize) { return ( { xs: '13', s: '13', m: '14', l: '15', xl: '18', } as const )[size] } export const FloatingButton = forwardRef< HTMLButtonElement, FloatingButtonProps >(function Button( { as = BaseButton, text, prefixContent, suffixContent, color = 'blue', variant = 'primary', size = 'm', active, className, loading = false, disabled: disabledProp = false, ...rest }, forwardedRef ) { const Comp = as as typeof BaseButton const disabled = loading || disabledProp return ( {/* TODO: use AlphaText later, add typo */} {text} {loading && ( )} ) })