Files
gridpilot.gg/apps/website/ui/FloatingAction.tsx
2026-01-18 23:24:30 +01:00

26 lines
705 B
TypeScript

import { Button, ButtonProps } from './Button';
export interface FloatingActionProps extends ButtonProps {
position?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
title?: string;
}
export const FloatingAction = ({
position = 'bottom-left',
title,
...props
}: FloatingActionProps) => {
const positionMap = {
'bottom-left': { bottom: '1rem', left: '1rem' },
'bottom-right': { bottom: '1rem', right: '1rem' },
'top-left': { top: '1rem', left: '1rem' },
'top-right': { top: '1rem', right: '1rem' },
};
return (
<Box position="fixed" style={{ ...positionMap[position], zIndex: 100 }}>
<Button rounded title={title} {...props} />
</Box>
);
};