import React from 'react' import { Children } from 'react' import { useResponsiveTokens } from '../../hooks/useResponsiveTokens' import Block from '../Primitives/Block/Block' import type { ButtonGroupTokensType } from './buttonGroup.tokens' import type { ButtonGroupProps } from './types' const ButtonGroup: React.FC = ({ stacked = false, children, }) => { const tokens = useResponsiveTokens('BUTTON_GROUP') const totalChildren = Children.count(children) const gap = stacked ? tokens.gap.stacked : tokens.gap.default if (!stacked) { return ( {children} ) } return ( {Children.map(children, (child, index) => { const position = index === 0 ? 'left' : index === totalChildren - 1 ? 'right' : 'center' return ( {index > 0 && ( ) })} ) } export default ButtonGroup