mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-01 18:20:28 +00:00
Complete modal component
This commit is contained in:
@@ -1,7 +1,54 @@
|
|||||||
|
import { theme } from '../../themes';
|
||||||
|
import { Box, Button, Text } from '..';
|
||||||
import { Wrapper } from './styles';
|
import { Wrapper } from './styles';
|
||||||
|
|
||||||
const Modal = () => {
|
type ModalProps = {
|
||||||
return <Wrapper></Wrapper>;
|
color: 'client' | 'productOwner' | 'developer' | 'admin';
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
children?: React.ReactNode | JSX.Element | string;
|
||||||
|
onConfirm: () => void;
|
||||||
|
onClose: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const Modal = ({
|
||||||
|
color,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
children,
|
||||||
|
onConfirm,
|
||||||
|
onClose,
|
||||||
|
}: ModalProps) => {
|
||||||
|
return (
|
||||||
|
<Wrapper>
|
||||||
|
<Box
|
||||||
|
background={theme.colors.white.main}
|
||||||
|
borderRadius='10px'
|
||||||
|
padding='20px'
|
||||||
|
display='grid'
|
||||||
|
gridTemplateRows='auto'
|
||||||
|
alignItems='center'
|
||||||
|
rowGap='1rem'
|
||||||
|
>
|
||||||
|
<Text variant='headline' weight='bold' color={color}>
|
||||||
|
{title}
|
||||||
|
</Text>
|
||||||
|
<Text variant='body' color={theme.colors.black.main}>
|
||||||
|
{description}
|
||||||
|
</Text>
|
||||||
|
{children}
|
||||||
|
<Box
|
||||||
|
display='grid'
|
||||||
|
gridTemplateColumns='repeat(2, auto)'
|
||||||
|
justifyContent='flex-end'
|
||||||
|
columnGap='1rem'
|
||||||
|
>
|
||||||
|
<Button color={color} text='Confirm' onClick={onConfirm} />
|
||||||
|
<Button color={color} text='Cancel' onClick={onClose} />
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</Wrapper>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Modal;
|
export default Modal;
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
export const Wrapper = styled.div``;
|
export const Wrapper = styled.div`
|
||||||
|
position: fixed;
|
||||||
|
z-index: 200;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.15);
|
||||||
|
display: grid;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
`;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import Sidebar from './Sidebar';
|
|||||||
import ProtectedRoute from './ProtectedRoute';
|
import ProtectedRoute from './ProtectedRoute';
|
||||||
import AuthRoute from './AuthRoute';
|
import AuthRoute from './AuthRoute';
|
||||||
import SectionSelector from './SectionSelector';
|
import SectionSelector from './SectionSelector';
|
||||||
|
import Modal from './Modal';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Button,
|
Button,
|
||||||
@@ -40,4 +41,5 @@ export {
|
|||||||
ProtectedRoute,
|
ProtectedRoute,
|
||||||
AuthRoute,
|
AuthRoute,
|
||||||
SectionSelector,
|
SectionSelector,
|
||||||
|
Modal,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user