mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-02 02:30:29 +00:00
Update icon button component
This commit is contained in:
@@ -1,25 +1,15 @@
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
type IconButtonProps = Omit<
|
||||
React.AllHTMLAttributes<HTMLButtonElement>,
|
||||
'size'
|
||||
> & {
|
||||
color:
|
||||
| 'client'
|
||||
| 'productOwner'
|
||||
| 'developer'
|
||||
| 'admin'
|
||||
| 'success'
|
||||
| 'warning'
|
||||
| 'error';
|
||||
size?: 'small' | 'big';
|
||||
type IconButtonProps = {
|
||||
color?: 'client' | 'productOwner' | 'developer' | 'admin';
|
||||
size?: 'small' | 'medium' | 'big';
|
||||
icon?: React.SVGProps<SVGSVGElement>;
|
||||
onClick: () => void;
|
||||
};
|
||||
|
||||
const IconButton = ({
|
||||
color,
|
||||
size = 'small',
|
||||
size = 'medium',
|
||||
icon,
|
||||
onClick,
|
||||
}: IconButtonProps) => {
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
import styled, { css } from 'styled-components';
|
||||
|
||||
type WrapperProps = {
|
||||
color:
|
||||
| 'client'
|
||||
| 'productOwner'
|
||||
| 'developer'
|
||||
| 'admin'
|
||||
| 'success'
|
||||
| 'warning'
|
||||
| 'error';
|
||||
size?: 'small' | 'big';
|
||||
color?: 'client' | 'productOwner' | 'developer' | 'admin';
|
||||
size?: 'small' | 'medium' | 'big';
|
||||
icon?: React.SVGProps<SVGSVGElement>;
|
||||
};
|
||||
|
||||
@@ -20,7 +13,8 @@ export const Wrapper = styled.button<WrapperProps>`
|
||||
border-radius: 50%;
|
||||
background: none;
|
||||
font-weight: bold;
|
||||
background: ${({ theme, color }) => theme.colors[color].main};
|
||||
background: ${({ theme, color }) =>
|
||||
color ? theme.colors[color].main : theme.colors.client.main};
|
||||
display: grid;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
@@ -46,6 +40,16 @@ export const Wrapper = styled.button<WrapperProps>`
|
||||
height: 12.5px;
|
||||
}
|
||||
`;
|
||||
case 'medium':
|
||||
return css`
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
|
||||
svg {
|
||||
width: 17.5px;
|
||||
height: 17.5px;
|
||||
}
|
||||
`;
|
||||
case 'big':
|
||||
return css`
|
||||
width: 50px;
|
||||
|
||||
Reference in New Issue
Block a user