From 7673814fd30500e871485eda80e28f27f97d75c7 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Mon, 22 Aug 2022 15:53:22 +0800 Subject: [PATCH] Add a delete page article action, add keyboard ctrls for confirm dialogs --- packages/web/components/elements/Button.tsx | 6 +++ packages/web/components/patterns/CardMenu.tsx | 2 +- .../components/patterns/ConfirmationModal.tsx | 21 ++++++++- .../templates/article/ArticleActionsMenu.tsx | 19 +++++++- .../templates/homeFeed/HomeFeedContainer.tsx | 46 +++++++++++++------ packages/web/lib/hooks/useReaderSettings.tsx | 7 ++- .../web/pages/[username]/[slug]/index.tsx | 43 +++++++++++++++++ 7 files changed, 124 insertions(+), 20 deletions(-) diff --git a/packages/web/components/elements/Button.tsx b/packages/web/components/elements/Button.tsx index 5c956ba29..0ae54959e 100644 --- a/packages/web/components/elements/Button.tsx +++ b/packages/web/components/elements/Button.tsx @@ -29,6 +29,9 @@ export const Button = styled('button', { color: '$omnivoreGray', bg: '$omnivoreCtaYellow', p: '10px 13px', + '&:focus': { + outline: '5px auto -webkit-focus-ring-color', + }, }, ctaOutlineYellow: { boxSizing: 'border-box', @@ -45,6 +48,9 @@ export const Button = styled('button', { color: '$utilityTextDefault', bg: 'transparent', p: '9px 12px', + '&:focus': { + outline: '5px auto -webkit-focus-ring-color', + }, }, ctaLightGray: { border: 0, diff --git a/packages/web/components/patterns/CardMenu.tsx b/packages/web/components/patterns/CardMenu.tsx index 357de8d8b..c22a9d9c5 100644 --- a/packages/web/components/patterns/CardMenu.tsx +++ b/packages/web/components/patterns/CardMenu.tsx @@ -85,7 +85,7 @@ export function CardMenu(props: CardMenuProps): JSX.Element { onSelect={() => { props.actionHandler('delete') }} - title="Remove" + title="Delete" /> {!!props.item.subscription && ( {props.message} - diff --git a/packages/web/components/templates/article/ArticleActionsMenu.tsx b/packages/web/components/templates/article/ArticleActionsMenu.tsx index ba367f44e..c90cb6262 100644 --- a/packages/web/components/templates/article/ArticleActionsMenu.tsx +++ b/packages/web/components/templates/article/ArticleActionsMenu.tsx @@ -1,5 +1,5 @@ import { Separator } from "@radix-ui/react-separator" -import { ArchiveBox, DotsThree, HighlighterCircle, TagSimple, TextAa, Tray } from "phosphor-react" +import { ArchiveBox, DotsThree, HighlighterCircle, TagSimple, TextAa, Trash, Tray } from "phosphor-react" import { ArticleAttributes } from "../../../lib/networking/queries/useGetArticleQuery" import { Button } from "../../elements/Button" import { Dropdown } from "../../elements/DropdownElements" @@ -143,6 +143,23 @@ export function ArticleActionsMenu(props: ArticleActionsMenuProps): JSX.Element + + {!props.article?.isArchived ? (