8b4b9ef8da
Forcing "type" to be explicit, works best will rollup on the frontend to exclude depdendencies
48 lines
1.2 KiB
TypeScript
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>
|
|
);
|
|
};
|