'use client' import { forwardRef } from 'react' import { isBezierIcon } from '@channel.io/bezier-icons' import * as TogglePrimitive from '@radix-ui/react-toggle' import classNames from 'classnames' import { useToggleButtonContext } from '~/src/components/AlphaToggleButton/ToggleButtonContext' import { BaseButton } from '~/src/components/BaseButton' import { Icon, type IconSize } from '~/src/components/Icon' import { Text } from '~/src/components/Text' import { type ToggleButtonProps } from './ToggleButton.types' import styles from './ToggleButton.module.scss' function SideContent({ size, content, }: { size: IconSize content?: ToggleButtonProps['prefixContent'] }) { return isBezierIcon(content) ? ( ) : ( content ) } export const ToggleButton = forwardRef( function ToggleButton( { as = BaseButton, text, prefixContent, suffixContent, variant = 'primary', shape: shapeProps, size = 'm', className, onSelectedChange, ...rest }, forwardedRef ) { const { shape: shapeContext } = useToggleButtonContext() const shape = shapeProps ?? shapeContext ?? 'capsule' const Comp = as as typeof BaseButton const ICON_SIZE = 's' return (
{/* TODO: use AlphaText later, add typo */} {text}
) } )