2021-02-10 07:09:26 +00:00
|
|
|
import React from "react";
|
2022-05-05 10:13:31 +00:00
|
|
|
import styled, { css } from "styled-components";
|
2021-02-25 21:19:45 +00:00
|
|
|
import Base from "../themes/base";
|
2021-02-10 07:09:26 +00:00
|
|
|
|
2022-05-05 07:08:01 +00:00
|
|
|
import CrossIcon from "@appserver/components/public/static/images/cross.react.svg";
|
|
|
|
|
|
|
|
import { isMobile } from "react-device-detect";
|
|
|
|
|
|
|
|
import { tablet } from "@appserver/components/utils/device";
|
|
|
|
|
2021-02-10 07:09:26 +00:00
|
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
/* eslint-disable react/prop-types */
|
2021-07-30 11:18:11 +00:00
|
|
|
const Container = ({
|
|
|
|
visible,
|
|
|
|
scale,
|
|
|
|
zIndex,
|
|
|
|
contentPaddingBottom,
|
|
|
|
...props
|
|
|
|
}) => <aside {...props} />;
|
2021-02-10 07:09:26 +00:00
|
|
|
/* eslint-enable react/prop-types */
|
|
|
|
/* eslint-enable no-unused-vars */
|
|
|
|
|
|
|
|
const StyledAside = styled(Container)`
|
|
|
|
background-color: ${(props) => props.theme.aside.backgroundColor};
|
|
|
|
height: ${(props) => props.theme.aside.height};
|
2022-05-05 07:08:01 +00:00
|
|
|
|
2021-02-10 07:09:26 +00:00
|
|
|
position: fixed;
|
|
|
|
right: ${(props) => props.theme.aside.right};
|
|
|
|
top: ${(props) => props.theme.aside.top};
|
|
|
|
transform: translateX(
|
2022-05-04 15:41:57 +00:00
|
|
|
${(props) => (props.visible ? "0" : props.scale ? "100%" : "480px")}
|
2021-02-10 07:09:26 +00:00
|
|
|
);
|
|
|
|
transition: ${(props) => props.theme.aside.transition};
|
2022-05-04 15:41:57 +00:00
|
|
|
width: ${(props) => (props.scale ? "100%" : "480px")};
|
2021-02-10 07:09:26 +00:00
|
|
|
z-index: ${(props) => props.zIndex};
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
2022-05-05 07:08:01 +00:00
|
|
|
@media ${tablet} {
|
|
|
|
max-width: calc(100% - 69px);
|
|
|
|
transform: translateX(
|
2022-05-05 12:11:51 +00:00
|
|
|
${(props) => (props.visible ? "0" : props.scale ? "100%" : "480px")}
|
2022-05-05 07:08:01 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
${isMobile &&
|
|
|
|
css`
|
|
|
|
max-width: calc(100% - 69px);
|
|
|
|
transform: translateX(
|
2022-05-05 12:11:51 +00:00
|
|
|
${(props) => (props.visible ? "0" : props.scale ? "100%" : "480px")}
|
2022-05-05 07:08:01 +00:00
|
|
|
);
|
|
|
|
`}
|
|
|
|
|
|
|
|
@media (max-width: 428px) {
|
|
|
|
bottom: 0;
|
|
|
|
top: unset;
|
|
|
|
height: calc(100% - 64px);
|
|
|
|
width: 100%;
|
|
|
|
max-width: 100%;
|
|
|
|
transform: translateX(${(props) => (props.visible ? "0" : "100%")});
|
|
|
|
}
|
|
|
|
|
2021-02-10 07:09:26 +00:00
|
|
|
&.modal-dialog-aside {
|
2021-07-30 11:18:11 +00:00
|
|
|
padding-bottom: ${(props) =>
|
|
|
|
props.contentPaddingBottom
|
|
|
|
? props.contentPaddingBottom
|
|
|
|
: props.theme.aside.paddingBottom};
|
2021-02-10 07:09:26 +00:00
|
|
|
|
|
|
|
.modal-dialog-aside-footer {
|
|
|
|
position: fixed;
|
|
|
|
bottom: ${(props) => props.theme.aside.bottom};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
StyledAside.defaultProps = { theme: Base };
|
2022-05-05 07:08:01 +00:00
|
|
|
|
|
|
|
const StyledControlContainer = styled.div`
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
width: 24px;
|
|
|
|
height: 24px;
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
border-radius: 100px;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
z-index: 450;
|
|
|
|
|
|
|
|
top: 14px;
|
|
|
|
left: -34px;
|
|
|
|
|
|
|
|
${isMobile &&
|
|
|
|
css`
|
|
|
|
top: 14px;
|
|
|
|
`}
|
|
|
|
|
|
|
|
@media (max-width: 428px) {
|
|
|
|
top: -34px;
|
|
|
|
right: 10px;
|
|
|
|
left: unset;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
StyledControlContainer.defaultProps = { theme: Base };
|
|
|
|
|
|
|
|
const StyledCrossIcon = styled(CrossIcon)`
|
|
|
|
width: 17px;
|
|
|
|
height: 17px;
|
|
|
|
z-index: 455;
|
|
|
|
path {
|
|
|
|
fill: ${(props) => props.theme.catalog.control.fill};
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
StyledCrossIcon.defaultProps = { theme: Base };
|
|
|
|
|
|
|
|
export { StyledAside, StyledControlContainer, StyledCrossIcon };
|