import React, { forwardRef } from 'react'; import { IconWrapper, CustomToggleButton, IconAndChildrenWrapper } from './ToggleButton.styled'; import type { ToggleButtonProps } from './ToggleButton.types'; const ToggleButton = forwardRef((props, ref) => { const { kind = 'contained', size = 'small', color = 'primary', selectedColor = 'primary', className = '', icon, selected, children, ...buttonProps } = props; const hasIconOnly = Boolean(icon && !children); const excludeToggleGroupClass = className .replace('MuiToggleButtonGroup-grouped', '') .replace('MuiToggleButtonGroup-groupedHorizontal', ''); return ( <> {kind === 'contained' || kind === 'ghost' ? ( {!hasIconOnly ? ( <> {icon ? ( {icon} {children} ) : ( children )} ) : ( {icon} )} ) : ( {!hasIconOnly ? ( <> {icon ? ( {icon} {children} ) : ( children )} ) : ( {icon} )} )} ); }); export default ToggleButton;