mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-02 02:30:29 +00:00
Complete alert component
This commit is contained in:
@@ -1,7 +1,20 @@
|
||||
import { Wrapper } from './styles';
|
||||
|
||||
const Alert = () => {
|
||||
return <Wrapper></Wrapper>;
|
||||
type AlertProps = {
|
||||
className?: string;
|
||||
color:
|
||||
| 'client'
|
||||
| 'productOwner'
|
||||
| 'developer'
|
||||
| 'admin'
|
||||
| 'success'
|
||||
| 'warning'
|
||||
| 'error';
|
||||
text: string;
|
||||
};
|
||||
|
||||
const Alert = ({ text, ...props }: AlertProps) => {
|
||||
return <Wrapper {...props}>{text}</Wrapper>;
|
||||
};
|
||||
|
||||
export default Alert;
|
||||
|
||||
@@ -1,3 +1,72 @@
|
||||
import styled from 'styled-components';
|
||||
import styled, { css } from 'styled-components';
|
||||
|
||||
export const Wrapper = styled.div``;
|
||||
type WrapperProps = {
|
||||
color:
|
||||
| 'client'
|
||||
| 'productOwner'
|
||||
| 'developer'
|
||||
| 'admin'
|
||||
| 'success'
|
||||
| 'warning'
|
||||
| 'error';
|
||||
};
|
||||
|
||||
export const Wrapper = styled.div<WrapperProps>`
|
||||
width: 100%;
|
||||
height: auto;
|
||||
padding: 0.938rem;
|
||||
border-radius: 10px;
|
||||
|
||||
${({ color, theme }) => {
|
||||
switch (color) {
|
||||
case 'client':
|
||||
return css`
|
||||
border: 1px solid ${theme.colors.client.main};
|
||||
color: ${theme.colors.client.main};
|
||||
background: ${theme.colors.client.light};
|
||||
`;
|
||||
case 'productOwner':
|
||||
return css`
|
||||
border: 1px solid ${theme.colors.productOwner.main};
|
||||
color: ${theme.colors.productOwner.main};
|
||||
background: ${theme.colors.productOwner.light};
|
||||
`;
|
||||
case 'developer':
|
||||
return css`
|
||||
border: 1px solid ${theme.colors.developer.main};
|
||||
color: ${theme.colors.developer.main};
|
||||
background: ${theme.colors.developer.light};
|
||||
`;
|
||||
case 'admin':
|
||||
return css`
|
||||
border: 1px solid ${theme.colors.admin.main};
|
||||
color: ${theme.colors.admin.main};
|
||||
background: ${theme.colors.admin.light};
|
||||
`;
|
||||
case 'success':
|
||||
return css`
|
||||
border: 1px solid ${theme.colors.success.main};
|
||||
color: ${theme.colors.success.main};
|
||||
background: ${theme.colors.success.light};
|
||||
`;
|
||||
case 'warning':
|
||||
return css`
|
||||
border: 1px solid ${theme.colors.warning.main};
|
||||
color: ${theme.colors.warning.main};
|
||||
background: ${theme.colors.warning.light};
|
||||
`;
|
||||
case 'error':
|
||||
return css`
|
||||
border: 1px solid ${theme.colors.error.main};
|
||||
color: ${theme.colors.error.main};
|
||||
background: ${theme.colors.error.light};
|
||||
`;
|
||||
default:
|
||||
return css`
|
||||
border: 1px solid ${theme.colors.client.main};
|
||||
color: ${theme.colors.client.main};
|
||||
background: ${theme.colors.client.light};
|
||||
`;
|
||||
}
|
||||
}}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user