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

90 lines
2.2 KiB
JavaScript
Raw Normal View History

import React from "react";
import styled, { css } from "styled-components";
import classnames from "classnames";
import PropTypes from "prop-types";
2021-03-03 09:47:28 +00:00
import { LayoutContextConsumer } from "studio/Layout/context";
import { isMobile, isMobileOnly } from "react-device-detect";
import { tablet, desktop, mobile } from "@appserver/components/utils/device";
import NoUserSelect from "@appserver/components/utils/commonStyles";
2022-01-28 13:44:58 +00:00
import Base from "@appserver/components/themes/base";
const StyledSectionHeader = styled.div`
position: relative;
height: 53px;
min-height: 53px;
margin-right: 20px;
${NoUserSelect}
width: calc(100vw - 296px);
max-width: calc(100vw - 296px);
@media ${tablet} {
width: ${(props) =>
props.showText ? "calc(100vw - 272px)" : "calc(100vw - 84px)"};
max-width: ${(props) =>
props.showText ? "calc(100vw - 272px)" : "calc(100vw - 84px)"};
height: 61px;
min-height: 61px;
margin-right: 0px !important;
}
2021-05-18 14:59:34 +00:00
${isMobile &&
css`
width: ${(props) =>
props.showText ? "calc(100vw - 272px)" : "calc(100vw - 84px)"};
max-width: ${(props) =>
props.showText ? "calc(100vw - 272px)" : "calc(100vw - 84px)"};
height: 61px;
min-height: 61px;
margin-right: 0px !important;
2021-05-18 14:59:34 +00:00
`}
@media ${mobile} {
width: calc(100vw - 32px) !important;
max-width: calc(100vw - 32px) !important;
height: 61px;
min-height: 61px;
margin-right: 0px !important;
}
${isMobileOnly &&
2021-05-18 14:59:34 +00:00
css`
width: calc(100vw - 32px) !important;
max-width: calc(100vw - 32px) !important;
height: 61px;
min-height: 61px;
margin-right: 0px !important;
2021-05-18 14:59:34 +00:00
`}
`;
StyledSectionHeader.defaultProps = { theme: Base };
const SectionHeader = (props) => {
const {
isArticlePinned,
isHeaderVisible,
viewAs,
maintenanceExist,
snackbarExist,
className,
...rest
} = props;
2020-11-17 08:36:49 +00:00
return (
<StyledSectionHeader
className={`section-header ${className}`}
viewAs={viewAs}
{...rest}
/>
);
};
SectionHeader.displayName = "SectionHeader";
2021-01-26 15:21:50 +00:00
SectionHeader.propTypes = {
isArticlePinned: PropTypes.bool,
isHeaderVisible: PropTypes.bool,
};
export default SectionHeader;