import React, { forwardRef } from 'react'; import { useIsDesktop } from '@alfalab/core-components-mq'; import { ButtonDesktop } from './desktop'; import { ButtonMobile } from './mobile'; import { type ButtonProps } from './typings'; export const Button = forwardRef( ( { children, breakpoint, client, defaultMatchMediaValue = client === undefined ? undefined : client === 'desktop', ...restProps }, ref, ) => { const isDesktop = useIsDesktop(breakpoint, defaultMatchMediaValue); const Component = isDesktop ? ButtonDesktop : ButtonMobile; return ( {children} ); }, ); Button.displayName = 'Button';