2022-09-26 08:22:46 +00:00
|
|
|
import React from "react";
|
|
|
|
import styled, { css } from "styled-components";
|
|
|
|
import Text from "@docspace/components/text";
|
|
|
|
import { ReactSVG } from "react-svg";
|
|
|
|
import { desktop, mobile, tablet } from "@docspace/components/utils/device";
|
|
|
|
import { isTablet, isMobileOnly } from "react-device-detect";
|
2022-09-26 09:37:21 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
2022-09-26 08:22:46 +00:00
|
|
|
|
|
|
|
const StyledHideArticleMenuButton = styled.div`
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
position: fixed;
|
|
|
|
height: 44px;
|
2022-09-26 13:11:22 +00:00
|
|
|
z-index: 209;
|
2022-09-26 08:22:46 +00:00
|
|
|
bottom: 89px;
|
|
|
|
left: 0;
|
|
|
|
cursor: pointer;
|
|
|
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
|
|
|
|
|
|
min-width: ${({ showText }) => (showText ? "243px" : "60px")};
|
|
|
|
max-width: ${({ showText }) => (showText ? "243px" : "60px")};
|
|
|
|
|
|
|
|
@media ${desktop} {
|
2022-09-26 11:57:27 +00:00
|
|
|
${!isTablet &&
|
|
|
|
css`
|
|
|
|
display: none;
|
|
|
|
`}
|
2022-09-26 08:22:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@media ${mobile} {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
${isMobileOnly &&
|
|
|
|
css`
|
|
|
|
display: none;
|
|
|
|
`}
|
|
|
|
|
|
|
|
.article-hide-menu-container {
|
|
|
|
align-items: center;
|
|
|
|
margin-left: 16px;
|
|
|
|
|
|
|
|
.article-hide-menu-text {
|
|
|
|
margin-left: 8px;
|
2022-11-07 11:58:53 +00:00
|
|
|
color: ${({ currentColorScheme }) => currentColorScheme.accentColor};
|
2022-09-26 08:22:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@media ${tablet} {
|
|
|
|
display: ${({ showText }) => (showText ? "flex" : "none")};
|
|
|
|
}
|
|
|
|
|
|
|
|
${isTablet &&
|
|
|
|
css`
|
|
|
|
display: ${({ showText }) => (showText ? "flex" : "none")};
|
|
|
|
`}
|
|
|
|
}
|
|
|
|
|
|
|
|
.article-show-menu-container {
|
|
|
|
justify-content: center;
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
@media ${tablet} {
|
|
|
|
display: ${({ showText }) => (showText ? "none" : "flex")};
|
|
|
|
}
|
|
|
|
|
|
|
|
${isTablet &&
|
|
|
|
css`
|
|
|
|
display: ${({ showText }) => (showText ? "none" : "flex")};
|
|
|
|
`}
|
|
|
|
}
|
|
|
|
|
|
|
|
.article-hide-menu-icon_svg,
|
|
|
|
.article-show-menu-icon_svg {
|
|
|
|
height: 28px;
|
2022-11-07 11:58:53 +00:00
|
|
|
|
|
|
|
svg {
|
|
|
|
path {
|
|
|
|
fill: ${({ currentColorScheme }) => currentColorScheme.accentColor};
|
|
|
|
}
|
|
|
|
}
|
2022-09-26 08:22:46 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2022-11-07 11:58:53 +00:00
|
|
|
const HideArticleMenuButton = ({
|
|
|
|
showText,
|
|
|
|
toggleShowText,
|
|
|
|
currentColorScheme,
|
|
|
|
}) => {
|
2022-09-26 09:37:21 +00:00
|
|
|
const { t } = useTranslation("Common");
|
2022-09-26 08:22:46 +00:00
|
|
|
|
|
|
|
return (
|
2022-11-07 11:58:53 +00:00
|
|
|
<StyledHideArticleMenuButton
|
|
|
|
showText={showText}
|
|
|
|
onClick={toggleShowText}
|
|
|
|
currentColorScheme={currentColorScheme}
|
|
|
|
>
|
2022-09-26 08:22:46 +00:00
|
|
|
{showText ? (
|
2022-11-14 10:19:03 +00:00
|
|
|
<div
|
|
|
|
className="article-hide-menu-container"
|
|
|
|
id="document_catalog-hide-menu"
|
|
|
|
>
|
2022-09-26 08:22:46 +00:00
|
|
|
<ReactSVG
|
|
|
|
className="article-hide-menu-icon_svg"
|
|
|
|
src="/static/images/article-hide-menu.react.svg"
|
|
|
|
/>
|
|
|
|
<Text
|
|
|
|
className="article-hide-menu-text"
|
|
|
|
fontWeight={600}
|
|
|
|
fontSize="12px"
|
|
|
|
noSelect
|
|
|
|
truncate
|
|
|
|
>
|
2022-09-26 09:37:21 +00:00
|
|
|
{t("HideArticleMenu")}
|
2022-09-26 08:22:46 +00:00
|
|
|
</Text>
|
|
|
|
</div>
|
|
|
|
) : (
|
2022-11-14 10:19:03 +00:00
|
|
|
<div
|
|
|
|
className="article-show-menu-container"
|
|
|
|
id="document_catalog-show-menu"
|
|
|
|
>
|
2022-09-26 08:22:46 +00:00
|
|
|
<ReactSVG
|
|
|
|
className="article-show-menu-icon_svg"
|
|
|
|
src="/static/images/article-show-menu.react.svg"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</StyledHideArticleMenuButton>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default HideArticleMenuButton;
|