|
@@ -13,6 +13,7 @@ import {
|
|
|
AiOutlineLink,
|
|
|
AiOutlineEdit,
|
|
|
} from "react-icons/ai";
|
|
|
+import { FiDownload } from "react-icons/fi";
|
|
|
|
|
|
import { Tooltip } from "src/components/Tooltip";
|
|
|
import { useRouter } from "next/router";
|
|
@@ -24,6 +25,7 @@ import { HiHeart } from "react-icons/hi";
|
|
|
import shallow from "zustand/shallow";
|
|
|
import { MdCenterFocusWeak } from "react-icons/md";
|
|
|
import { getNextLayout } from "src/utils/getNextLayout";
|
|
|
+import { DownloadModal } from "src/containers/Modals/DownloadModal";
|
|
|
|
|
|
const StyledSidebar = styled.div`
|
|
|
display: flex;
|
|
@@ -41,19 +43,19 @@ const StyledSidebar = styled.div`
|
|
|
}
|
|
|
`;
|
|
|
|
|
|
-const StyledElement = styled.div<{ beta?: boolean }>`
|
|
|
+const StyledElement = styled.button`
|
|
|
position: relative;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
text-align: center;
|
|
|
font-size: 26px;
|
|
|
font-weight: 600;
|
|
|
- width: 100%;
|
|
|
- color: ${({ theme }) => theme.INTERACTIVE_NORMAL};
|
|
|
+ width: fit-content;
|
|
|
+ color: ${({ theme }) => theme.SIDEBAR_ICONS};
|
|
|
cursor: pointer;
|
|
|
|
|
|
svg {
|
|
|
- padding: 8px;
|
|
|
+ padding: 12px 8px;
|
|
|
vertical-align: middle;
|
|
|
}
|
|
|
|
|
@@ -64,11 +66,20 @@ const StyledElement = styled.div<{ beta?: boolean }>`
|
|
|
&:hover :is(a, svg) {
|
|
|
color: ${({ theme }) => theme.INTERACTIVE_HOVER};
|
|
|
}
|
|
|
+
|
|
|
+ @media only screen and (max-width: 768px) {
|
|
|
+ font-size: 22px;
|
|
|
+
|
|
|
+ svg {
|
|
|
+ padding: 8px 4px;
|
|
|
+ vertical-align: middle;
|
|
|
+ }
|
|
|
+ }
|
|
|
`;
|
|
|
|
|
|
const StyledText = styled.span<{ secondary?: boolean }>`
|
|
|
color: ${({ theme, secondary }) =>
|
|
|
- secondary ? theme.INTERACTIVE_NORMAL : theme.ORANGE};
|
|
|
+ secondary ? theme.INTERACTIVE_HOVER : theme.ORANGE};
|
|
|
`;
|
|
|
|
|
|
const StyledFlowIcon = styled(TiFlowMerge)<{ rotate: number }>`
|
|
@@ -82,21 +93,14 @@ const StyledTopWrapper = styled.nav`
|
|
|
align-items: center;
|
|
|
width: 100%;
|
|
|
|
|
|
- & > div:nth-child(n + 1) {
|
|
|
- border-bottom: 1px solid ${({ theme }) => theme.BACKGROUND_MODIFIER_ACCENT};
|
|
|
- }
|
|
|
-
|
|
|
.mobile {
|
|
|
display: none;
|
|
|
}
|
|
|
|
|
|
@media only screen and (max-width: 768px) {
|
|
|
+ justify-content: space-evenly;
|
|
|
flex-direction: row;
|
|
|
|
|
|
- & > div:nth-child(n + 1) {
|
|
|
- border-bottom: none;
|
|
|
- }
|
|
|
-
|
|
|
.mobile {
|
|
|
display: initial;
|
|
|
}
|
|
@@ -114,18 +118,19 @@ const StyledBottomWrapper = styled.nav`
|
|
|
align-items: center;
|
|
|
width: 100%;
|
|
|
|
|
|
- & > div,
|
|
|
- a:nth-child(0) {
|
|
|
- border-top: 1px solid ${({ theme }) => theme.BACKGROUND_MODIFIER_ACCENT};
|
|
|
- }
|
|
|
-
|
|
|
@media only screen and (max-width: 768px) {
|
|
|
display: none;
|
|
|
}
|
|
|
`;
|
|
|
|
|
|
-const StyledLogo = styled.div`
|
|
|
+const StyledLogo = styled.a`
|
|
|
color: ${({ theme }) => theme.FULL_WHITE};
|
|
|
+ padding: 8px 4px;
|
|
|
+ border-bottom: 1px solid ${({ theme }) => theme.BACKGROUND_MODIFIER_ACCENT};
|
|
|
+
|
|
|
+ @media only screen and (max-width: 768px) {
|
|
|
+ border-bottom: 0;
|
|
|
+ }
|
|
|
`;
|
|
|
|
|
|
function rotateLayout(layout: "LEFT" | "RIGHT" | "DOWN" | "UP") {
|
|
@@ -142,6 +147,7 @@ export const Sidebar: React.FC = () => {
|
|
|
const [uploadVisible, setUploadVisible] = React.useState(false);
|
|
|
const [clearVisible, setClearVisible] = React.useState(false);
|
|
|
const [shareVisible, setShareVisible] = React.useState(false);
|
|
|
+ const [isDownloadVisible, setDownloadVisible] = React.useState(false);
|
|
|
const { push } = useRouter();
|
|
|
|
|
|
const [expand, layout, hideEditor] = useConfig(
|
|
@@ -215,6 +221,11 @@ export const Sidebar: React.FC = () => {
|
|
|
<AiOutlineSave />
|
|
|
</StyledElement>
|
|
|
</Tooltip>
|
|
|
+ <Tooltip className="mobile" title="Download Image">
|
|
|
+ <StyledElement onClick={() => setDownloadVisible(true)}>
|
|
|
+ <FiDownload />
|
|
|
+ </StyledElement>
|
|
|
+ </Tooltip>
|
|
|
<Tooltip title="Clear JSON">
|
|
|
<StyledElement onClick={() => setClearVisible(true)}>
|
|
|
<AiOutlineDelete />
|
|
@@ -252,6 +263,10 @@ export const Sidebar: React.FC = () => {
|
|
|
<ImportModal visible={uploadVisible} setVisible={setUploadVisible} />
|
|
|
<ClearModal visible={clearVisible} setVisible={setClearVisible} />
|
|
|
<ShareModal visible={shareVisible} setVisible={setShareVisible} />
|
|
|
+ <DownloadModal
|
|
|
+ visible={isDownloadVisible}
|
|
|
+ setVisible={setDownloadVisible}
|
|
|
+ />
|
|
|
</StyledSidebar>
|
|
|
);
|
|
|
};
|