2019-09-12 12:15:22 +00:00
|
|
|
import React from "react";
|
2020-08-31 07:03:19 +00:00
|
|
|
import styled, { css } from "styled-components";
|
2022-02-01 10:44:49 +00:00
|
|
|
import { tablet, size, mobile } from "@appserver/components/utils/device";
|
2021-01-20 18:04:00 +00:00
|
|
|
import {
|
|
|
|
isIOS,
|
|
|
|
isTablet,
|
|
|
|
isSafari,
|
|
|
|
isChrome,
|
2022-02-01 10:44:49 +00:00
|
|
|
isMobileOnly,
|
2021-01-20 18:04:00 +00:00
|
|
|
isMobile,
|
|
|
|
} from "react-device-detect";
|
2022-03-30 08:17:43 +00:00
|
|
|
import { Base } from "@appserver/components/themes";
|
2019-07-20 09:48:29 +00:00
|
|
|
|
2020-08-31 07:03:19 +00:00
|
|
|
const tabletProps = css`
|
2022-03-29 11:35:55 +00:00
|
|
|
.section-body_header {
|
|
|
|
display: block;
|
|
|
|
position: sticky;
|
|
|
|
top: 0;
|
2022-03-30 08:17:43 +00:00
|
|
|
background: ${(props) => props.theme.section.header.background};
|
2022-05-12 08:46:36 +00:00
|
|
|
z-index: 202;
|
2022-03-29 11:35:55 +00:00
|
|
|
|
|
|
|
${isMobileOnly &&
|
|
|
|
css`
|
|
|
|
padding: 0 16px;
|
2022-04-07 14:27:48 +00:00
|
|
|
margin: 0 0 0 -16px;
|
2022-03-29 11:35:55 +00:00
|
|
|
`}
|
2022-05-04 14:51:44 +00:00
|
|
|
|
|
|
|
${(props) =>
|
|
|
|
props.settingsStudio &&
|
|
|
|
isMobileOnly &&
|
|
|
|
css`
|
|
|
|
background: ${(props) => props.theme.section.header.backgroundColor};
|
|
|
|
`}
|
2022-03-29 11:35:55 +00:00
|
|
|
}
|
2020-08-31 07:03:19 +00:00
|
|
|
.section-body_filter {
|
|
|
|
display: block;
|
2022-03-29 11:35:55 +00:00
|
|
|
margin: ${(props) =>
|
|
|
|
props.viewAs === "tile" ? "4px 0 18px" : "4px 0 30px"};
|
2020-08-31 07:03:19 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2022-03-16 12:22:48 +00:00
|
|
|
const StyledSectionContainer = styled.section`
|
2022-03-03 07:04:54 +00:00
|
|
|
padding: 0 0 0 20px;
|
2019-07-20 09:48:29 +00:00
|
|
|
flex-grow: 1;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2022-02-01 08:17:37 +00:00
|
|
|
|
2022-04-20 11:22:46 +00:00
|
|
|
width: 100%;
|
|
|
|
max-width: 100%;
|
2022-03-18 10:43:16 +00:00
|
|
|
|
2022-03-31 10:31:38 +00:00
|
|
|
@media ${tablet} {
|
2022-04-04 15:23:01 +00:00
|
|
|
width: 100%;
|
|
|
|
max-width: 100vw !important;
|
2022-04-01 09:41:48 +00:00
|
|
|
padding: 0 0 0 16px;
|
2022-03-31 10:31:38 +00:00
|
|
|
}
|
2022-03-18 10:43:16 +00:00
|
|
|
|
2022-03-31 10:31:38 +00:00
|
|
|
${isMobile &&
|
|
|
|
css`
|
2022-04-04 15:23:01 +00:00
|
|
|
width: 100% !important;
|
2022-04-20 11:02:20 +00:00
|
|
|
max-width: 100vw !important;
|
2022-04-01 09:41:48 +00:00
|
|
|
padding: 0 0 0 16px;
|
|
|
|
${tabletProps};
|
|
|
|
min-width: 100px;
|
2022-03-31 10:31:38 +00:00
|
|
|
`}
|
2022-03-18 10:43:16 +00:00
|
|
|
|
2022-03-31 10:31:38 +00:00
|
|
|
@media ${mobile} {
|
2022-03-31 11:04:03 +00:00
|
|
|
width: 100vw !important;
|
|
|
|
max-width: 100vw !important;
|
2022-03-31 10:31:38 +00:00
|
|
|
}
|
2022-03-18 10:43:16 +00:00
|
|
|
|
2022-03-31 10:31:38 +00:00
|
|
|
${isMobileOnly &&
|
|
|
|
css`
|
2022-03-31 11:04:03 +00:00
|
|
|
width: 100vw !important;
|
|
|
|
max-width: 100vw !important;
|
2022-04-01 09:41:48 +00:00
|
|
|
margin-top: 48px !important;
|
2022-03-31 10:31:38 +00:00
|
|
|
`}
|
2022-03-18 10:43:16 +00:00
|
|
|
|
2020-04-28 14:41:34 +00:00
|
|
|
.layout-progress-bar {
|
2020-11-24 14:04:42 +00:00
|
|
|
position: fixed;
|
|
|
|
right: 15px;
|
|
|
|
bottom: 21px;
|
2020-11-19 13:12:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.layout-progress-second-bar {
|
2020-11-24 14:04:42 +00:00
|
|
|
position: fixed;
|
|
|
|
right: 15px;
|
|
|
|
bottom: 83px;
|
2020-10-16 12:38:04 +00:00
|
|
|
}
|
2022-04-01 14:39:06 +00:00
|
|
|
|
|
|
|
${(props) =>
|
|
|
|
!props.isSectionHeaderAvailable &&
|
|
|
|
css`
|
|
|
|
width: 100vw !important;
|
|
|
|
max-width: 100vw !important;
|
|
|
|
box-sizing: border-box;
|
|
|
|
`}
|
2019-07-20 09:48:29 +00:00
|
|
|
`;
|
|
|
|
|
2022-03-30 08:17:43 +00:00
|
|
|
StyledSectionContainer.defaultProps = { theme: Base };
|
|
|
|
|
2022-03-16 12:22:48 +00:00
|
|
|
class SectionContainer extends React.Component {
|
2019-07-28 20:39:59 +00:00
|
|
|
/*shouldComponentUpdate() {
|
|
|
|
return false;
|
|
|
|
}*/
|
2020-12-18 17:16:13 +00:00
|
|
|
componentDidUpdate() {
|
|
|
|
const { pinned } = this.props;
|
|
|
|
|
2020-12-21 07:44:40 +00:00
|
|
|
if (
|
2020-12-21 08:13:56 +00:00
|
|
|
isIOS &&
|
2020-12-21 07:46:35 +00:00
|
|
|
isTablet &&
|
2020-12-21 07:44:40 +00:00
|
|
|
(isSafari || isChrome) &&
|
|
|
|
window.innerWidth <= size.smallTablet &&
|
|
|
|
pinned
|
|
|
|
) {
|
2020-12-18 18:24:37 +00:00
|
|
|
this.props.unpinArticle();
|
2020-12-18 17:16:13 +00:00
|
|
|
}
|
|
|
|
}
|
2019-07-28 20:39:59 +00:00
|
|
|
render() {
|
2019-08-13 11:21:28 +00:00
|
|
|
//console.log("PageLayout Section render");
|
2020-12-18 17:16:13 +00:00
|
|
|
|
2022-03-16 12:22:48 +00:00
|
|
|
return <StyledSectionContainer id="section" {...this.props} />;
|
2019-09-10 07:03:36 +00:00
|
|
|
}
|
|
|
|
}
|
2019-07-20 09:48:29 +00:00
|
|
|
|
2022-03-16 12:22:48 +00:00
|
|
|
export default SectionContainer;
|