Update buttons styles

This commit is contained in:
Hazem Krimi
2021-01-08 19:05:27 +01:00
parent 0e174d3278
commit f4286faef3
2 changed files with 11 additions and 8 deletions
+8 -4
View File
@@ -12,7 +12,6 @@ const Btn = styled.button<Props>`
display: inline; display: inline;
cursor: pointer; cursor: pointer;
background: none; background: none;
outline: none;
color: ${({ dark, theme }) => (dark ? theme.colors.dark.text : theme.colors.light.text)}; color: ${({ dark, theme }) => (dark ? theme.colors.dark.text : theme.colors.light.text)};
padding: 1rem; padding: 1rem;
border: ${({ variant, dark, theme }) => border: ${({ variant, dark, theme }) =>
@@ -23,7 +22,7 @@ const Btn = styled.button<Props>`
font-size: ${({ variant }) => (variant === 'outline' ? '1.05rem' : 'inherit')}; font-size: ${({ variant }) => (variant === 'outline' ? '1.05rem' : 'inherit')};
text-transform: ${({ variant }) => (variant === 'outline' ? 'uppercase' : 'inherit')}; text-transform: ${({ variant }) => (variant === 'outline' ? 'uppercase' : 'inherit')};
padding: ${({ variant }) => (variant === 'outline' ? '.5rem 1rem' : '0rem')}; padding: ${({ variant }) => (variant === 'outline' ? '.5rem 1rem' : '0rem')};
text-align: left;
transition: color 250ms ease-in-out; transition: color 250ms ease-in-out;
z-index: 1; z-index: 1;
@@ -73,11 +72,16 @@ const Btn = styled.button<Props>`
} }
`; `;
const Button: FC<Props> = ({ variant = 'text', onClick, children }) => { const Button: FC<Props & { className?: string }> = ({
variant = 'text',
onClick,
children,
className
}) => {
const { dark } = useContext(DarkModeContext); const { dark } = useContext(DarkModeContext);
return ( return (
<Btn variant={variant} dark={dark} onClick={onClick}> <Btn variant={variant} dark={dark} onClick={onClick} className={className}>
{children} {children}
</Btn> </Btn>
); );
+3 -4
View File
@@ -12,13 +12,12 @@ const Btn = styled.button`
background: none; background: none;
border: none; border: none;
color: none; color: none;
outline: none;
`; `;
const IconButton: FC<Props> = ({ icon, onClick }) => { const IconButton: FC<Props & { className?: string }> = ({ icon, onClick, className }) => {
return ( return (
<Btn onClick={onClick}> <Btn onClick={onClick} className={className}>
<Image src={icon} alt='Icon Button' width={24} height={24} /> <Image src={icon} width={24} height={24} />
</Btn> </Btn>
); );
}; };