Update icon button component

This commit is contained in:
Hazem Krimi
2021-04-28 21:30:33 +01:00
parent 74d184e20b
commit f49b38dddd
2 changed files with 18 additions and 24 deletions
+4 -14
View File
@@ -1,25 +1,15 @@
import { Wrapper } from './styles'; import { Wrapper } from './styles';
type IconButtonProps = Omit< type IconButtonProps = {
React.AllHTMLAttributes<HTMLButtonElement>, color?: 'client' | 'productOwner' | 'developer' | 'admin';
'size' size?: 'small' | 'medium' | 'big';
> & {
color:
| 'client'
| 'productOwner'
| 'developer'
| 'admin'
| 'success'
| 'warning'
| 'error';
size?: 'small' | 'big';
icon?: React.SVGProps<SVGSVGElement>; icon?: React.SVGProps<SVGSVGElement>;
onClick: () => void; onClick: () => void;
}; };
const IconButton = ({ const IconButton = ({
color, color,
size = 'small', size = 'medium',
icon, icon,
onClick, onClick,
}: IconButtonProps) => { }: IconButtonProps) => {
+14 -10
View File
@@ -1,15 +1,8 @@
import styled, { css } from 'styled-components'; import styled, { css } from 'styled-components';
type WrapperProps = { type WrapperProps = {
color: color?: 'client' | 'productOwner' | 'developer' | 'admin';
| 'client' size?: 'small' | 'medium' | 'big';
| 'productOwner'
| 'developer'
| 'admin'
| 'success'
| 'warning'
| 'error';
size?: 'small' | 'big';
icon?: React.SVGProps<SVGSVGElement>; icon?: React.SVGProps<SVGSVGElement>;
}; };
@@ -20,7 +13,8 @@ export const Wrapper = styled.button<WrapperProps>`
border-radius: 50%; border-radius: 50%;
background: none; background: none;
font-weight: bold; font-weight: bold;
background: ${({ theme, color }) => theme.colors[color].main}; background: ${({ theme, color }) =>
color ? theme.colors[color].main : theme.colors.client.main};
display: grid; display: grid;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@@ -46,6 +40,16 @@ export const Wrapper = styled.button<WrapperProps>`
height: 12.5px; height: 12.5px;
} }
`; `;
case 'medium':
return css`
width: 35px;
height: 35px;
svg {
width: 17.5px;
height: 17.5px;
}
`;
case 'big': case 'big':
return css` return css`
width: 50px; width: 50px;