Files
twenty/packages/twenty-ui/src/input/button/components/InsideButton.tsx
T
Félix Malfait 8b4b9ef8da Change type import rule (#13751)
Forcing "type" to be explicit, works best will rollup on the frontend to
exclude depdendencies
2025-08-08 01:27:05 +02:00

48 lines
1.2 KiB
TypeScript

import { type IconComponent } from '@ui/display';
import styled from '@emotion/styled';
import React from 'react';
import { useTheme } from '@emotion/react';
export type InsideButtonProps = {
className?: string;
Icon?: IconComponent;
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
disabled?: boolean;
};
const StyledButton = styled.button`
align-items: center;
border: none;
background-color: transparent;
border-radius: ${({ theme }) => theme.border.radius.xs};
color: ${({ theme }) => theme.font.color.tertiary};
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
display: flex;
flex-direction: row;
height: 20px;
justify-content: center;
padding: 0;
white-space: nowrap;
min-width: 20px;
transition: background-color 0.1s ease;
&:hover {
background-color: ${({ theme }) => theme.background.transparent.light};
}
`;
export const InsideButton = ({
className,
Icon,
onClick,
disabled = false,
}: InsideButtonProps) => {
const theme = useTheme();
return (
<StyledButton className={className} onClick={onClick} disabled={disabled}>
{Icon && <Icon size={theme.icon.size.sm} />}
</StyledButton>
);
};