Makes form components more customizable for easier reuse

This commit is contained in:
Alicia Sykes
2023-07-07 20:58:25 +01:00
parent c9c462f2a1
commit b5e53a33b0
3 changed files with 20 additions and 8 deletions

View File

@@ -8,6 +8,8 @@ interface ButtonProps {
size?: InputSize,
bgColor?: string,
fgColor?: string,
styles?: string,
title?: string,
};
const StyledButton = styled.button<ButtonProps>`
@@ -31,16 +33,19 @@ const StyledButton = styled.button<ButtonProps>`
${(props) => props.fgColor ?
`color: ${props.fgColor};` : `color: ${colors.background};`
}
${props => props.styles}
`;
const Button = (props: ButtonProps): JSX.Element => {
const { children, size, bgColor, fgColor, onClick } = props;
const { children, size, bgColor, fgColor, onClick, styles, title } = props;
return (
<StyledButton
onClick={onClick || (() => null) }
size={size}
bgColor={bgColor}
fgColor={fgColor}
styles={styles}
title={title?.toString()}
>
{children}
</StyledButton>