From 0c301fcf0c5d878f985d3e93c65d8172699811b6 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 26 Feb 2021 10:51:14 -0800 Subject: [PATCH] fix: Enlarge scrollable area in sidebar for improved UX on small screens --- app/components/Scrollable.js | 6 +- app/components/Sidebar/Main.js | 177 +++++++++---------- app/components/Sidebar/components/Section.js | 6 +- 3 files changed, 94 insertions(+), 95 deletions(-) diff --git a/app/components/Scrollable.js b/app/components/Scrollable.js index 762301a6..2c686970 100644 --- a/app/components/Scrollable.js +++ b/app/components/Scrollable.js @@ -8,9 +8,10 @@ type Props = {| shadow?: boolean, topShadow?: boolean, bottomShadow?: boolean, + flex?: boolean, |}; -function Scrollable({ shadow, topShadow, bottomShadow, ...rest }: Props) { +function Scrollable({ shadow, topShadow, bottomShadow, flex, ...rest }: Props) { const ref = React.useRef(); const [topShadowVisible, setTopShadow] = React.useState(false); const [bottomShadowVisible, setBottomShadow] = React.useState(false); @@ -42,6 +43,7 @@ function Scrollable({ shadow, topShadow, bottomShadow, ...rest }: Props) { (props.$flex ? "flex" : "block")}; + flex-direction: column; height: 100%; overflow-y: auto; overflow-x: hidden; diff --git a/app/components/Sidebar/Main.js b/app/components/Sidebar/Main.js index 69c4f021..eb563117 100644 --- a/app/components/Sidebar/Main.js +++ b/app/components/Sidebar/Main.js @@ -81,96 +81,92 @@ function MainSidebar() { /> )} - - -
+ +
+ } + exact={false} + label={t("Home")} + /> + } + label={t("Search")} + exact={false} + /> + } + exact={false} + label={t("Starred")} + /> + } + exact={false} + label={t("Templates")} + active={documents.active ? documents.active.template : undefined} + /> + } + label={ + + {t("Drafts")} + + + } + active={ + documents.active + ? !documents.active.publishedAt && + !documents.active.isDeleted && + !documents.active.isTemplate + : undefined + } + /> +
+
+ +
+
+ } + exact={false} + label={t("Archive")} + active={ + documents.active + ? documents.active.isArchived && !documents.active.isDeleted + : undefined + } + /> + } + exact={false} + label={t("Trash")} + active={documents.active ? documents.active.isDeleted : undefined} + /> + } + exact={false} + label={t("Settings")} + /> + {can.invite && ( } - exact={false} - label={t("Home")} + to="/settings/people" + onClick={handleInviteModalOpen} + icon={} + label={`${t("Invite people")}…`} /> - } - label={t("Search")} - exact={false} - /> - } - exact={false} - label={t("Starred")} - /> - } - exact={false} - label={t("Templates")} - active={documents.active ? documents.active.template : undefined} - /> - } - label={ - - {t("Drafts")} - - - } - active={ - documents.active - ? !documents.active.publishedAt && - !documents.active.isDeleted && - !documents.active.isTemplate - : undefined - } - /> -
-
- -
-
- -
- } - exact={false} - label={t("Archive")} - active={ - documents.active - ? documents.active.isArchived && !documents.active.isDeleted - : undefined - } - /> - } - exact={false} - label={t("Trash")} - active={documents.active ? documents.active.isDeleted : undefined} - /> - } - exact={false} - label={t("Settings")} - /> - {can.invite && ( - } - label={`${t("Invite people")}…`} - /> - )} -
-
- + )} +
+
{can.invite && ( props.theme.sidebarMinWidth}px; flex-shrink: 0; + + &:first-child { + margin-top: 20px; + } `; export default Section;