DocSpace-client/packages/common/components/Article/styled-article.js

430 lines
8.2 KiB
JavaScript
Raw Normal View History

import styled, { css } from "styled-components";
2022-09-29 14:29:09 +00:00
import { isMobile, isMobileOnly, isTablet } from "react-device-detect";
import {
mobile,
tablet,
isMobile as isMobileUtils,
hugeMobile,
} from "@docspace/components/utils/device";
import { Base } from "@docspace/components/themes";
import MenuIcon from "PUBLIC_DIR/images/menu.react.svg";
import CrossIcon from "PUBLIC_DIR/images/cross.react.svg";
const StyledArticle = styled.article`
position: relative;
overflow: hidden;
background: ${props => props.theme.catalog.background};
min-width: 251px;
max-width: 251px;
2022-07-08 07:38:57 +00:00
box-sizing: border-box;
2023-02-09 11:28:01 +00:00
user-select: none;
2022-07-22 13:20:01 +00:00
//padding: 0 20px;
border-right: ${props => props.theme.catalog.verticalLine};
@media ${tablet} {
min-width: ${props => (props.showText ? "243px" : "60px")};
max-width: ${props => (props.showText ? "243px" : "60px")};
height: ${props =>
props.correctTabletHeight ? `${props.correctTabletHeight}px` : `100%`};
2022-07-22 13:20:01 +00:00
//padding: 0 8px;
}
${isTablet &&
css`
min-width: ${props => (props.showText ? "243px" : "60px")};
max-width: ${props => (props.showText ? "243px" : "60px")};
//padding: 0 8px;
height: ${props =>
props.correctTabletHeight ? `${props.correctTabletHeight}px` : `100%`};
`}
@media ${mobile} {
display: ${props => (props.articleOpen ? "flex" : "none")};
2022-06-22 13:09:19 +00:00
flex-direction: column;
min-width: 100%;
width: 100%;
position: fixed;
margin: 0;
height: calc(100% - 64px) !important;
margin-top: 16px;
//padding: 0 8px;
}
${isMobileOnly &&
css`
display: ${props => (props.articleOpen ? "flex" : "none")} !important;
2022-06-22 13:09:19 +00:00
flex-direction: column;
min-width: 100% !important;
width: 100%;
position: fixed;
margin: 0;
padding: 0;
2022-11-03 12:46:56 +00:00
top: 64px;
height: calc(100% - 64px) !important;
border-right: none;
`}
z-index: ${props =>
props.showText && (isMobileOnly || isMobileUtils()) ? "230" : "205"};
.article-body__scrollbar {
height: ${props =>
`calc(100% - ${props.$withMainButton ? "190px" : "150px"})`} !important;
2023-03-20 09:57:44 +00:00
${!isMobileOnly &&
css`
@media ${tablet} {
height: calc(100% - 126px) !important;
2023-03-20 09:57:44 +00:00
}
`}
@media ${mobile} {
height: 100% !important;
margin-top: 32px;
}
@media ${hugeMobile} {
height: 100% !important;
}
${isTablet &&
css`
height: calc(100% - 126px) !important;
`}
2022-07-25 13:47:04 +00:00
${isMobileOnly &&
css`
height: 100% !important;
2022-07-25 13:47:04 +00:00
margin-top: 32px !important;
`}
.scroll-body {
2022-07-22 10:29:22 +00:00
overflow-x: hidden !important;
padding: 0 20px 0 12px !important;
2022-07-22 07:55:26 +00:00
@media ${tablet} {
padding: 0 8px 0 0 !important;
height: calc(100% - 60px);
2022-07-22 07:55:26 +00:00
}
${isTablet &&
css`
padding: 0 8px !important;
height: calc(100% - 60px);
`}
@media ${mobile} {
padding-bottom: 20px;
height: 100%;
}
${isMobileOnly &&
css`
padding-bottom: 20px;
height: 100%;
`}
}
}
`;
StyledArticle.defaultProps = { theme: Base };
const StyledArticleHeader = styled.div`
height: 24px;
2023-06-05 08:17:34 +00:00
padding: 22px 21px 23px 20px;
margin: 0;
display: flex;
justify-content: flex-start;
align-items: center;
@media ${tablet} {
2022-07-22 13:20:01 +00:00
padding: 18px 8px 19px;
margin: 0;
justify-content: ${(props) => (props.showText ? "flex-start" : "center")};
height: 61px;
min-height: 61px;
max-height: 61px;
box-sizing: border-box;
}
2022-07-22 22:23:25 +00:00
${isTablet &&
css`
padding: 18px 8px 19px;
2022-07-22 22:23:25 +00:00
margin: 0;
justify-content: ${(props) => (props.showText ? "flex-start" : "center")};
height: 61px;
min-height: 61px;
max-height: 61px;
box-sizing: border-box;
`}
@media ${mobile} {
border-bottom: ${(props) => props.theme.catalog.header.borderBottom};
padding: 12px 0 12px;
}
${isMobileOnly &&
css`
border-bottom: ${(props) =>
props.theme.catalog.header.borderBottom} !important;
padding: 12px 0 12px !important;
`}
2022-05-05 11:56:41 +00:00
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
`;
StyledArticleHeader.defaultProps = { theme: Base };
const StyledHeading = styled.div`
height: 24px;
margin: 0;
padding: 0;
cursor: pointer;
2022-11-03 11:44:54 +00:00
img.logo-icon_svg {
2022-11-03 13:41:59 +00:00
height: 24px;
width: 211px;
2022-11-03 11:44:54 +00:00
}
2022-09-23 10:32:43 +00:00
.logo-icon_svg {
svg {
path:last-child {
fill: ${(props) => props.theme.client.home.logoColor};
}
}
}
@media ${tablet} {
display: ${(props) => (props.showText ? "block" : "none")};
2022-07-22 21:53:40 +00:00
margin-left: 9px;
}
${isTablet &&
css`
display: ${(props) => (props.showText ? "block" : "none")};
2022-07-22 22:23:25 +00:00
margin-left: 9px !important;
`}
@media ${mobile} {
margin-left: 0;
}
${isMobileOnly &&
css`
margin-left: 0 !important;
`}
`;
const StyledIconBox = styled.div`
cursor: pointer;
display: none;
align-items: center;
2022-10-25 09:30:44 +00:00
img {
2023-03-23 06:30:57 +00:00
height: 28px;
width: 28px;
2022-10-25 09:30:44 +00:00
}
@media ${tablet} {
2022-07-20 11:58:50 +00:00
display: ${(props) => (props.showText ? "none" : "flex")};
}
2022-07-22 10:29:22 +00:00
${isTablet &&
css`
display: ${(props) => (props.showText ? "none" : "flex")};
`}
@media ${mobile} {
display: none;
}
${isMobileOnly &&
css`
display: none !important;
`}
`;
const StyledMenuIcon = styled(MenuIcon)`
display: block;
width: 20px;
height: 20px;
cursor: pointer;
path {
fill: ${(props) => props.theme.catalog.header.iconFill};
}
`;
StyledMenuIcon.defaultProps = { theme: Base };
const StyledArticleMainButton = styled.div`
2022-07-22 13:20:01 +00:00
padding: 0px 20px 16px;
max-width: 100%;
@media ${tablet} {
padding: 0;
margin: 0;
}
${isMobile &&
css`
padding: 0;
margin: 0;
`}
`;
const StyledControlContainer = styled.div`
width: 17px;
height: 17px;
position: absolute;
top: 37px;
right: 10px;
border-radius: 100px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
z-index: 290;
`;
StyledControlContainer.defaultProps = { theme: Base };
const StyledCrossIcon = styled(CrossIcon)`
width: 17px;
height: 17px;
path {
fill: ${(props) => props.theme.catalog.control.fill};
}
`;
StyledCrossIcon.defaultProps = { theme: Base };
const StyledArticleProfile = styled.div`
2022-07-22 21:53:40 +00:00
padding: 16px 20px;
height: 40px !important;
display: flex;
align-items: center;
2022-07-22 21:53:40 +00:00
justify-content: center;
2023-07-20 11:23:09 +00:00
border-top: ${props => props.theme.catalog.profile.borderTop};
border-right: ${props => props.theme.catalog.verticalLine};
background-color: ${props => props.theme.catalog.profile.background};
@media ${tablet} {
2022-07-22 21:53:40 +00:00
padding: 16px 14px;
}
2023-07-20 11:23:09 +00:00
${isTablet &&
css`
padding: 16px 14px;
`}
.profile-avatar {
cursor: pointer;
}
.option-button {
margin-left: auto;
2022-07-22 13:20:01 +00:00
height: 32px;
width: 32px;
.injected-svg {
width: 16px;
height: 16px;
}
.option-button-icon {
display: flex;
2022-07-22 07:55:26 +00:00
align-items: center;
justify-content: center;
}
}
`;
StyledArticleProfile.defaultProps = { theme: Base };
2022-07-22 09:53:02 +00:00
const StyledUserName = styled.div`
display: flex;
2023-07-20 11:23:09 +00:00
flex-direction: ${props => (props.length > 18 ? "column" : "row")};
2022-07-22 09:53:02 +00:00
max-width: 131px;
2022-07-22 10:50:57 +00:00
min-width: 131px;
2023-07-20 11:23:09 +00:00
${props =>
props.theme.interfaceDirection === "rtl"
? css`
padding-right: 12px;
`
: css`
padding-left: 12px;
`}
cursor: pointer;
2022-07-22 21:53:40 +00:00
`;
const StyledProfileWrapper = styled.div`
z-index: 209;
2022-07-22 21:53:40 +00:00
position: fixed;
bottom: 0;
2023-07-19 11:23:56 +00:00
${props =>
props.theme.interfaceDirection === "rtl"
? css`
right: 0;
`
: css`
left: 0;
`}
min-width: 251px;
max-width: 251px;
2023-07-19 11:23:56 +00:00
background-color: ${props => props.theme.catalog.profile.background};
@media ${tablet} {
2023-07-19 11:23:56 +00:00
min-width: ${props => (props.showText ? "243px" : "60px")};
max-width: ${props => (props.showText ? "243px" : "60px")};
}
${isTablet &&
css`
2023-07-19 11:23:56 +00:00
min-width: ${props => (props.showText ? "243px" : "60px")};
max-width: ${props => (props.showText ? "243px" : "60px")};
`}
2022-07-22 09:53:02 +00:00
`;
2023-04-04 13:36:07 +00:00
const StyledArticleAlertsComponent = styled.div`
margin: 32px 0;
2023-04-04 13:36:07 +00:00
div:last-child {
margin-top: 20px;
}
`;
export {
StyledArticle,
StyledArticleHeader,
StyledHeading,
StyledIconBox,
StyledMenuIcon,
StyledArticleMainButton,
StyledControlContainer,
StyledCrossIcon,
StyledArticleProfile,
2022-07-22 09:53:02 +00:00
StyledUserName,
2022-07-22 21:53:40 +00:00
StyledProfileWrapper,
2023-04-04 13:36:07 +00:00
StyledArticleAlertsComponent,
};