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

114 lines
2.6 KiB
JavaScript
Raw Normal View History

import React from "react";
import styled, { css } from "styled-components";
import PropTypes from "prop-types";
import { Resizable } from "re-resizable";
import { isMobile } from "react-device-detect";
2020-11-26 16:40:54 +00:00
import { tablet } from "@appserver/components/src/utils/device";
const StyledArticle = styled.article`
@media ${tablet} {
${(props) =>
props.visible &&
!props.pinned &&
css`
position: fixed;
z-index: 400;
`}
}
.resizable-block {
padding: 0 24px;
background: #f8f9f9;
min-width: 265px;
height: 100% !important;
max-width: ${(props) => (props.isLoaded ? "calc(100vw - 368px)" : "265px")};
box-sizing: border-box;
overflow: hidden auto;
display: flex;
flex-direction: column;
.resizable-border {
div {
cursor: ew-resize !important;
}
}
2021-01-21 10:41:59 +00:00
${isMobile &&
css`
margin-top: 56px;
2021-01-21 10:41:59 +00:00
height: calc(100% - 56px) !important;
width: 240px !important;
Merge branch 'develop' into feature/workspaces # Conflicts: # packages/asc-web-common/src/components/Layout/MobileLayout.js # packages/asc-web-common/src/components/Layout/ScrollToTop.js # packages/asc-web-common/src/components/Layout/context.js # packages/asc-web-common/src/components/Layout/index.js # packages/asc-web-common/src/components/NavMenu/index.js # packages/asc-web-common/src/components/NavMenu/sub-components/header-nav.js # packages/asc-web-common/src/components/PageLayout/index.js # packages/asc-web-common/src/components/PageLayout/sub-components/article.js # packages/asc-web-common/src/components/PageLayout/sub-components/section-header.js # packages/asc-web-common/src/components/PageLayout/sub-components/section.js # packages/asc-web-components/src/components/icons/svg/button.cancel.react.svg # packages/asc-web-components/src/components/icons/svg/clear.active.react.svg # packages/asc-web-components/src/components/icons/svg/load.error.react.svg # products/ASC.Files/Client/package.json # products/ASC.Files/Client/src/App.js # products/ASC.Files/Client/src/store/files/actions.js # products/ASC.People/Client/package.json # products/ASC.People/Client/src/App.js # products/ASC.People/Client/src/components/pages/Profile/index.js # products/ASC.People/Client/src/components/pages/ProfileAction/index.js # products/ASC.People/Client/yarn.lock # web/ASC.Web.Client/package.json # web/ASC.Web.Client/src/App.js # web/ASC.Web.Client/yarn.lock # web/ASC.Web.Common/package.json # web/ASC.Web.Common/yarn.lock # web/ASC.Web.Components/package.json # web/ASC.Web.Components/yarn.lock # yarn.lock
2021-01-29 13:39:00 +00:00
@media ${tablet} {
margin-top: ${(props) => (props.pinned ? "56px;" : "0;")};
}
2021-01-21 10:41:59 +00:00
`}
@media ${tablet} {
padding: 0 16px;
${(props) =>
props.visible
? props.pinned
? `
min-width: 240px;
max-width: ${props.isLoaded ? "calc(100vw - 368px)" : "240px"};
2021-01-21 10:41:59 +00:00
.increaseHeight {
position: fixed;
height: 100%;
top: 0;
left: 0;
min-width: 240px;
background: #f8f9f9;
z-index: -1;
}
`
: `
position: fixed !important;
width: 240px !important;
min-width: 240px;
max-width: 240px;
position: fixed;
height: 100% !important;
top: 0;
left: 0;
z-index: 400;
.resizable-border {
display: none;
}
`
: `
display: none;
`}
}
}
`;
class Article extends React.Component {
render() {
//console.log("PageLayout Article render", this.props);
const { children, ...rest } = this.props;
const enable = {
top: false,
right: !isMobile,
bottom: false,
left: false,
};
return (
<StyledArticle {...rest}>
<Resizable
enable={enable}
className="resizable-block"
handleWrapperClass="resizable-border"
>
{children}
<div className="increaseHeight"></div>
</Resizable>
</StyledArticle>
);
}
}
Article.propTypes = {
children: PropTypes.any,
};
export default Article;