DocSpace-buildtools/packages/asc-web-common/components/PageLayout/sub-components/section.js

117 lines
2.1 KiB
JavaScript
Raw Normal View History

import React from "react";
import styled, { css } from "styled-components";
import { tablet, size } from "@appserver/components/utils/device";
import {
isIOS,
isTablet,
isSafari,
isChrome,
isMobile,
} from "react-device-detect";
const tabletProps = css`
.section-header_filter {
display: none;
}
.section-body_filter {
display: block;
margin: 0 0 25px;
}
`;
const StyledSection = styled.section`
padding: 0 0 0 24px;
flex-grow: 1;
display: flex;
flex-direction: column;
2022-02-01 08:17:37 +00:00
.main-bar,
.main-bar--hidden {
${isMobile &&
css`
2022-03-14 10:43:42 +00:00
transition: top 0.3s cubic-bezier(0, 0, 0.5, 1);
-moz-transition: top 0.3s cubic-bezier(0, 0, 0.5, 1);
-ms-transition: top 0.3s cubic-bezier(0, 0, 0.5, 1);
-webkit-transition: top 0.3s cubic-bezier(0, 0, 0.5, 1);
-o-transition: top 0.3s cubic-bezier(0, 0, 0.5, 1);
2022-02-01 08:17:37 +00:00
`}
}
.main-bar--hidden {
${isMobile &&
css`
top: -140px;
`}
}
.layout-progress-bar {
position: fixed;
right: 15px;
bottom: 21px;
${(props) =>
!props.visible &&
css`
@media ${tablet} {
bottom: 83px;
}
`}
}
.layout-progress-second-bar {
position: fixed;
right: 15px;
bottom: 83px;
${(props) =>
!props.visible &&
css`
@media ${tablet} {
bottom: 145px;
}
`}
}
.section-header_filter {
display: block;
}
.section-body_filter {
display: none;
}
@media ${tablet} {
padding: 0 0 0 16px;
${tabletProps};
}
${isMobile &&
css`
${tabletProps};
min-width: 100px;
`}
`;
class Section extends React.Component {
/*shouldComponentUpdate() {
return false;
}*/
componentDidUpdate() {
const { pinned } = this.props;
if (
isIOS &&
isTablet &&
(isSafari || isChrome) &&
window.innerWidth <= size.smallTablet &&
pinned
) {
2020-12-18 18:24:37 +00:00
this.props.unpinArticle();
}
}
render() {
//console.log("PageLayout Section render");
return <StyledSection {...this.props} />;
}
}
export default Section;