import React, { forwardRef } from 'react'; import { SegmentedButton, SegmentedButtonsProps, } from './segmented-buttons.types'; import { string } from 'prop-types'; import { ButtonLayout } from '../../components'; import { ButtonLayoutProps } from '../button-layout/button-layout.types'; import { IconWrapper } from '../../icon/icon-wrapper'; export const SegmentButton = forwardRef< HTMLButtonElement, ButtonLayoutProps & SegmentedButton >(({ centralRipple = false, iconPlace = 'left', icon, ...props }, ref) => { const classes = `m3-button-segment ${props.className ?? ''}`.trimEnd(); return ( {props.children} ); }); SegmentButton.propTypes = { children: string, }; export const SegmentedButtons = forwardRef< HTMLDivElement, SegmentedButtonsProps >(({ children, ...props }, ref) => { if (children.length <= 1) { throw 'You must build segmented button with 2 or more buttton'; } return (
{children}
); });