DocSpace-client/packages/asc-web-components/modal-dialog/styled-modal-dialog.js

112 lines
2.6 KiB
JavaScript
Raw Normal View History

2022-04-08 22:13:08 +00:00
import styled, { css, keyframes } from "styled-components";
2021-02-25 21:19:45 +00:00
import Base from "../themes/base";
import Box from "../box";
import { smallTablet } from "../utils/device";
2022-04-08 22:13:08 +00:00
const StyledModal = styled.div.attrs((props) => ({
style: {
opacity: `${props.opacity}`,
},
}))`
.heading-aside {
margin-right: -16px;
}
.bodybox-aside {
padding-left: 16px;
}
.footer-aside {
width: 100%;
margin-bottom: -6px;
}
.aside-dialog {
padding: 0;
margin-bottom: -6px;
}
2022-03-15 15:08:32 +00:00
`;
const Dialog = styled.div`
position: relative;
display: flex;
cursor: default;
align-items: center;
2022-03-15 11:58:56 +00:00
justify-content: center;
width: auto;
margin: 0 auto;
min-height: 100%;
`;
const Content = styled.div.attrs((props) => ({
style: {
marginBottom:
props.modalSwipeOffset < 0 ? `${props.modalSwipeOffset * 1.1}px` : "0px",
},
}))`
position: relative;
box-sizing: border-box;
background-color: ${(props) => props.theme.modalDialog.backgroundColor};
color: ${(props) => props.theme.modalDialog.textColor};
height: auto;
max-height: ${(props) =>
props.displayType === "aside" ? "auto" : props.isLarge ? "400px" : "280px"};
width: ${(props) =>
props.displayType === "aside" ? "auto" : props.isLarge ? "520px" : "400px"};
border-radius: 6px;
padding: ${(props) => (props.displayType === "modal" ? "0" : "0 0 -16px")};
2022-03-15 15:08:32 +00:00
${({ displayType }) =>
displayType === "modal" &&
css`
@media ${smallTablet} {
position: absolute;
bottom: 0;
width: 100%;
border-radius: 6px 6px 0 0;
}
`}
`;
const StyledHeader = styled.div`
display: flex;
align-items: center;
border-bottom: ${(props) =>
`1px solid ${props.theme.modalDialog.headerBorderColor}`};
2022-03-15 15:08:32 +00:00
margin-bottom: 16px;
height: 52px;
display: flex;
align-items: center;
padding: 0 16px 0;
2022-03-15 15:08:32 +00:00
.heading {
font-family: "Open Sans";
color: ${(props) => props.theme.modalDialog.textColor};
font-weight: 700;
font-size: ${(props) => (props.displayType === "modal" ? "18px" : "21px")};
2022-03-15 15:08:32 +00:00
}
`;
const BodyBox = styled(Box)`
position: relative;
${(props) => props.withoutBodyScroll && `height: 100%;`}
padding-bottom: 8px;
`;
const StyledFooter = styled.div`
display: flex;
flex-direction: row;
border-top: ${(props) =>
`1px solid ${props.theme.modalDialog.footerBorderColor}`};
gap: 10px;
2022-03-15 15:08:32 +00:00
padding: 16px;
${(props) => props.displayType === "aside" && "margin-bottom: -10px"}
`;
2022-03-15 15:08:32 +00:00
Dialog.defaultProps = { theme: Base };
StyledHeader.defaultProps = { theme: Base };
Content.defaultProps = { theme: Base };
export { StyledModal, StyledHeader, Content, Dialog, BodyBox, StyledFooter };