From 14c6251be4f14f09a312fd86d7b83fa810bb7ef4 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 29 Apr 2024 19:56:42 -0400 Subject: [PATCH] fix: Icon misalignment in document restore menu --- app/components/ContextMenu/MenuItem.tsx | 12 ++++---- app/menus/DocumentMenu.tsx | 15 ++-------- app/menus/NewChildDocumentMenu.tsx | 40 +++++++++++-------------- app/menus/NewTemplateMenu.tsx | 8 +---- 4 files changed, 29 insertions(+), 46 deletions(-) diff --git a/app/components/ContextMenu/MenuItem.tsx b/app/components/ContextMenu/MenuItem.tsx index a535fd137..6f55e2b46 100644 --- a/app/components/ContextMenu/MenuItem.tsx +++ b/app/components/ContextMenu/MenuItem.tsx @@ -1,5 +1,6 @@ import { LocationDescriptor } from "history"; import { CheckmarkIcon } from "outline-icons"; +import { ellipsis } from "polished"; import * as React from "react"; import { mergeRefs } from "react-merge-refs"; import { MenuItem as BaseMenuItem } from "reakit/Menu"; @@ -76,7 +77,7 @@ const MenuItem = ( )} {icon && {icon}} - {children} + {children} ); }, @@ -101,6 +102,10 @@ const Spacer = styled.svg` flex-shrink: 0; `; +const Title = styled.div` + ${ellipsis()} +`; + type MenuAnchorProps = { level?: number; disabled?: boolean; @@ -129,10 +134,6 @@ export const MenuAnchorCSS = css` white-space: nowrap; position: relative; - svg:not(:last-child) { - margin-right: 4px; - } - svg { flex-shrink: 0; opacity: ${(props) => (props.disabled ? ".5" : 1)}; @@ -154,6 +155,7 @@ export const MenuAnchorCSS = css` cursor: var(--pointer); svg { + color: ${props.theme.accentText}; fill: ${props.theme.accentText}; } } diff --git a/app/menus/DocumentMenu.tsx b/app/menus/DocumentMenu.tsx index 1ad080cee..382e58d40 100644 --- a/app/menus/DocumentMenu.tsx +++ b/app/menus/DocumentMenu.tsx @@ -8,7 +8,7 @@ import { VisuallyHidden } from "reakit/VisuallyHidden"; import { toast } from "sonner"; import styled from "styled-components"; import breakpoint from "styled-components-breakpoint"; -import { s, ellipsis } from "@shared/styles"; +import { s } from "@shared/styles"; import { UserPreference } from "@shared/types"; import { getEventFiles } from "@shared/utils/files"; import Document from "~/models/Document"; @@ -16,7 +16,6 @@ import ContextMenu from "~/components/ContextMenu"; import OverflowMenuButton from "~/components/ContextMenu/OverflowMenuButton"; import Separator from "~/components/ContextMenu/Separator"; import Template from "~/components/ContextMenu/Template"; -import Flex from "~/components/Flex"; import CollectionIcon from "~/components/Icons/CollectionIcon"; import Switch from "~/components/Switch"; import { actionToMenuItem } from "~/actions"; @@ -146,12 +145,8 @@ function DocumentMenu({ handleRestore(ev, { collectionId: collection.id, }), - title: ( - - - {collection.name} - - ), + icon: , + title: collection.name, }); } @@ -383,8 +378,4 @@ const Style = styled.div` `}; `; -const CollectionName = styled.div` - ${ellipsis()} -`; - export default observer(DocumentMenu); diff --git a/app/menus/NewChildDocumentMenu.tsx b/app/menus/NewChildDocumentMenu.tsx index f3a3d0560..a1069d402 100644 --- a/app/menus/NewChildDocumentMenu.tsx +++ b/app/menus/NewChildDocumentMenu.tsx @@ -34,34 +34,30 @@ function NewChildDocumentMenu({ document, label }: Props) { { type: "route", title: ( - - , - }} - /> - + , + }} + /> ), to: newDocumentPath(document.collectionId), }, { type: "route", title: ( - - , - }} - /> - + , + }} + /> ), to: newDocumentPath(document.collectionId, { parentDocumentId: document.id, diff --git a/app/menus/NewTemplateMenu.tsx b/app/menus/NewTemplateMenu.tsx index d89f1b2d9..7dd4ea3de 100644 --- a/app/menus/NewTemplateMenu.tsx +++ b/app/menus/NewTemplateMenu.tsx @@ -3,8 +3,6 @@ import { PlusIcon } from "outline-icons"; import * as React from "react"; import { useTranslation } from "react-i18next"; import { MenuButton, useMenuState } from "reakit/Menu"; -import styled from "styled-components"; -import { ellipsis } from "@shared/styles"; import Button from "~/components/Button"; import ContextMenu from "~/components/ContextMenu"; import Header from "~/components/ContextMenu/Header"; @@ -39,7 +37,7 @@ function NewTemplateMenu() { filtered.push({ type: "route", to: newTemplatePath(collection.id), - title: {collection.name}, + title: collection.name, icon: , }); } @@ -70,8 +68,4 @@ function NewTemplateMenu() { ); } -const CollectionName = styled.div` - ${ellipsis()} -`; - export default observer(NewTemplateMenu);