mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-02 10:40:29 +00:00
Complete avatar component
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
const Avatar = () => {
|
||||
return <Wrapper></Wrapper>;
|
||||
type AvatarProps = {
|
||||
color?: 'client' | 'productOwner' | 'developer' | 'admin' | string;
|
||||
size?: 'small' | 'big';
|
||||
text: string;
|
||||
};
|
||||
|
||||
const Avatar = ({ color, size = 'small', text }: AvatarProps) => {
|
||||
return (
|
||||
<Wrapper color={color} size={size}>
|
||||
{text}
|
||||
</Wrapper>
|
||||
);
|
||||
};
|
||||
|
||||
export default Avatar;
|
||||
|
||||
@@ -1,3 +1,40 @@
|
||||
import styled from 'styled-components';
|
||||
import styled, { css } from 'styled-components';
|
||||
|
||||
export const Wrapper = styled.div``;
|
||||
type WrapperProps = {
|
||||
color?: 'client' | 'productOwner' | 'developer' | 'admin' | string;
|
||||
size?: 'small' | 'big';
|
||||
};
|
||||
|
||||
export const Wrapper = styled.div<WrapperProps>`
|
||||
border-radius: 50%;
|
||||
background: ${({ theme, color }) =>
|
||||
color ? theme.colors[color].main : theme.colors.client.main};
|
||||
color: ${({ theme }) => theme.colors.white.main};
|
||||
display: grid;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
|
||||
${({ size }) => {
|
||||
switch (size) {
|
||||
case 'small':
|
||||
return css`
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
font-size: 12px;
|
||||
`;
|
||||
case 'big':
|
||||
return css`
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
font-size: 24px;
|
||||
`;
|
||||
default:
|
||||
return css`
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
font-size: 12px;
|
||||
`;
|
||||
}
|
||||
}}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user