import { ActionIcon, Button, useMantineTheme } from "@mantine/core" import { useMediaQuery } from "@mantine/hooks" import { forwardRef } from "react" interface ActionButtonProps { className?: string icon?: React.ReactNode label?: string onClick?: React.MouseEventHandler } /** * Switches between Button with label (desktop) and ActionIcon (mobile) */ export const ActionButton = forwardRef((props: ActionButtonProps, ref) => { const theme = useMantineTheme() const mobile = !useMediaQuery(`(min-width: ${theme.breakpoints.lg}px)`) return mobile ? ( {props.icon} ) : ( ) }) ActionButton.displayName = "HeaderButton"