2019-09-12 12:15:22 +00:00
|
|
|
import React from "react";
|
2020-02-10 14:34:56 +00:00
|
|
|
import styled from "styled-components";
|
2019-12-23 13:41:52 +00:00
|
|
|
import { utils } from "asc-web-components";
|
2020-08-11 12:35:24 +00:00
|
|
|
import isEqual from "lodash/isEqual";
|
|
|
|
|
2019-12-23 13:41:52 +00:00
|
|
|
const { tablet } = utils.device;
|
2019-07-20 09:48:29 +00:00
|
|
|
|
|
|
|
const StyledSectionHeader = styled.div`
|
2019-09-12 12:15:22 +00:00
|
|
|
border-bottom: 1px solid #eceef1;
|
2020-10-26 10:53:42 +00:00
|
|
|
height: 55px;
|
2019-12-23 13:41:52 +00:00
|
|
|
margin-right: 24px;
|
2020-11-06 13:15:03 +00:00
|
|
|
margin-top: -1px;
|
2019-12-23 13:41:52 +00:00
|
|
|
|
|
|
|
@media ${tablet} {
|
|
|
|
margin-right: 16px;
|
2020-08-18 14:02:20 +00:00
|
|
|
border-bottom: none;
|
2020-10-27 12:15:57 +00:00
|
|
|
${(props) =>
|
|
|
|
props.borderBottom &&
|
|
|
|
`
|
|
|
|
border-bottom: 1px solid #eceef1;
|
|
|
|
padding-bottom: 16px
|
|
|
|
`};
|
2020-10-26 10:53:42 +00:00
|
|
|
height: 49px;
|
2019-12-23 13:41:52 +00:00
|
|
|
}
|
2020-01-15 12:58:57 +00:00
|
|
|
|
|
|
|
.section-header {
|
|
|
|
width: calc(100% - 76px);
|
|
|
|
|
|
|
|
@media ${tablet} {
|
2020-10-16 12:38:04 +00:00
|
|
|
width: 100%;
|
2020-10-26 10:53:42 +00:00
|
|
|
padding-top: 4px;
|
2020-01-15 12:58:57 +00:00
|
|
|
}
|
2020-01-16 09:25:28 +00:00
|
|
|
|
2020-10-16 12:38:04 +00:00
|
|
|
h1,
|
|
|
|
h2,
|
|
|
|
h3,
|
|
|
|
h4,
|
|
|
|
h5,
|
|
|
|
h6 {
|
2020-01-16 09:25:28 +00:00
|
|
|
max-width: calc(100vw - 435px);
|
|
|
|
|
|
|
|
@media ${tablet} {
|
2020-10-16 12:38:04 +00:00
|
|
|
max-width: ${(props) =>
|
|
|
|
props.isArticlePinned ? `calc(100vw - 320px)` : `calc(100vw - 96px)`};
|
2020-01-16 09:25:28 +00:00
|
|
|
}
|
|
|
|
}
|
2020-01-15 12:58:57 +00:00
|
|
|
}
|
2019-07-20 09:48:29 +00:00
|
|
|
`;
|
|
|
|
|
2020-08-11 12:35:24 +00:00
|
|
|
class SectionHeader extends React.Component {
|
|
|
|
shouldComponentUpdate(nextProps) {
|
|
|
|
return !isEqual(this.props, nextProps);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
//console.log("PageLayout SectionHeader render");
|
|
|
|
// eslint-disable-next-line react/prop-types
|
2020-10-27 12:15:57 +00:00
|
|
|
const { isArticlePinned, borderBottom, ...rest } = this.props;
|
|
|
|
|
2020-08-11 12:35:24 +00:00
|
|
|
return (
|
2020-10-27 12:15:57 +00:00
|
|
|
<StyledSectionHeader
|
|
|
|
isArticlePinned={isArticlePinned}
|
|
|
|
borderBottom={borderBottom}
|
|
|
|
>
|
2020-08-11 12:35:24 +00:00
|
|
|
<div className="section-header" {...rest} />
|
|
|
|
</StyledSectionHeader>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-07-20 09:48:29 +00:00
|
|
|
|
2019-09-12 12:15:22 +00:00
|
|
|
SectionHeader.displayName = "SectionHeader";
|
|
|
|
|
|
|
|
export default SectionHeader;
|