import { forwardRef, type ElementType } from 'react'; import styled, { AnyStyledComponent, css } from 'styled-components'; import { ButtonShape, ButtonSize } from '@/constants/buttons'; import { Button, type ButtonProps } from '@/components/Button'; import { Icon, IconName } from '@/components/Icon'; import { ToggleButton, type ToggleButtonProps } from '@/components/ToggleButton'; type ElementProps = { isToggle?: boolean; iconName?: IconName; iconComponent?: ElementType; }; export type IconButtonProps = ElementProps & ButtonProps & ToggleButtonProps; export const IconButton = forwardRef( ( { size = ButtonSize.XSmall, shape = ButtonShape.Circle, href, isToggle, iconName, iconComponent, onClick, onPressedChange, className, ...otherProps }, ref ) => { return isToggle ? ( ) : ( ); } ); const Styled: Record = {}; const buttonMixin = css` // Params --button-icon-size: 1.125em; // Rules > * { font-size: var(--button-icon-size); } `; Styled.IconButton = styled(Button)` ${buttonMixin} `; Styled.IconToggleButton = styled(ToggleButton)` ${buttonMixin} `;