From 8b016c925c150020779510c5b702995ad8240110 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Fri, 10 Feb 2023 18:21:12 +0530 Subject: [PATCH] fix: remirror buttons --- .../rich-text-editor/toolbar/bold.tsx | 27 ------------------ .../rich-text-editor/toolbar/index.tsx | 27 +++++++++--------- .../rich-text-editor/toolbar/italic.tsx | 28 ------------------- .../rich-text-editor/toolbar/redo.tsx | 18 ------------ .../rich-text-editor/toolbar/strike.tsx | 26 ----------------- .../rich-text-editor/toolbar/underline.tsx | 28 ------------------- .../rich-text-editor/toolbar/undo.tsx | 21 -------------- apps/app/styles/editor.css | 20 +++++++++++++ 8 files changed, 34 insertions(+), 161 deletions(-) delete mode 100644 apps/app/components/rich-text-editor/toolbar/bold.tsx delete mode 100644 apps/app/components/rich-text-editor/toolbar/italic.tsx delete mode 100644 apps/app/components/rich-text-editor/toolbar/redo.tsx delete mode 100644 apps/app/components/rich-text-editor/toolbar/strike.tsx delete mode 100644 apps/app/components/rich-text-editor/toolbar/underline.tsx delete mode 100644 apps/app/components/rich-text-editor/toolbar/undo.tsx diff --git a/apps/app/components/rich-text-editor/toolbar/bold.tsx b/apps/app/components/rich-text-editor/toolbar/bold.tsx deleted file mode 100644 index 59c51b80c08..00000000000 --- a/apps/app/components/rich-text-editor/toolbar/bold.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { useCommands, useActive } from "@remirror/react"; - -export const BoldButton = () => { - const { toggleBold, focus } = useCommands(); - const active = useActive(); - - return ( - - ); -}; diff --git a/apps/app/components/rich-text-editor/toolbar/index.tsx b/apps/app/components/rich-text-editor/toolbar/index.tsx index 1167c8d22cb..de42077cde5 100644 --- a/apps/app/components/rich-text-editor/toolbar/index.tsx +++ b/apps/app/components/rich-text-editor/toolbar/index.tsx @@ -1,11 +1,12 @@ -// history -import { RedoButton } from "./redo"; -import { UndoButton } from "./undo"; -// formats -import { BoldButton } from "./bold"; -import { ItalicButton } from "./italic"; -import { UnderlineButton } from "./underline"; -import { StrikeButton } from "./strike"; +// buttons +import { + ToggleBoldButton, + ToggleItalicButton, + ToggleUnderlineButton, + ToggleStrikeButton, + RedoButton, + UndoButton, +} from "@remirror/react"; // headings import HeadingControls from "./heading-controls"; // list @@ -15,17 +16,17 @@ import { UnorderedListButton } from "./unordered-list"; export const RichTextToolbar: React.FC = () => (
- +
- - - - + + + +
diff --git a/apps/app/components/rich-text-editor/toolbar/italic.tsx b/apps/app/components/rich-text-editor/toolbar/italic.tsx deleted file mode 100644 index 6d7ab328a87..00000000000 --- a/apps/app/components/rich-text-editor/toolbar/italic.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { useCommands, useActive } from "@remirror/react"; - -export const ItalicButton = () => { - const { toggleItalic, focus } = useCommands(); - - const active = useActive(); - - return ( - - ); -}; diff --git a/apps/app/components/rich-text-editor/toolbar/redo.tsx b/apps/app/components/rich-text-editor/toolbar/redo.tsx deleted file mode 100644 index 6fea794e0c6..00000000000 --- a/apps/app/components/rich-text-editor/toolbar/redo.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { useCommands } from "@remirror/react"; - -export const RedoButton = () => { - const { redo } = useCommands(); - return ( - - ); -}; diff --git a/apps/app/components/rich-text-editor/toolbar/strike.tsx b/apps/app/components/rich-text-editor/toolbar/strike.tsx deleted file mode 100644 index 52c22926e04..00000000000 --- a/apps/app/components/rich-text-editor/toolbar/strike.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { useCommands, useActive } from "@remirror/react"; - -export const StrikeButton = () => { - const { toggleStrike } = useCommands(); - - const active = useActive(); - - return ( - - ); -}; diff --git a/apps/app/components/rich-text-editor/toolbar/underline.tsx b/apps/app/components/rich-text-editor/toolbar/underline.tsx deleted file mode 100644 index 955a6a35667..00000000000 --- a/apps/app/components/rich-text-editor/toolbar/underline.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { useCommands, useActive } from "@remirror/react"; - -export const UnderlineButton = () => { - const { toggleUnderline, focus } = useCommands(); - - const active = useActive(); - - return ( - - ); -}; diff --git a/apps/app/components/rich-text-editor/toolbar/undo.tsx b/apps/app/components/rich-text-editor/toolbar/undo.tsx deleted file mode 100644 index 6c35b96aed2..00000000000 --- a/apps/app/components/rich-text-editor/toolbar/undo.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { useCommands } from "@remirror/react"; - -// icons - -export const UndoButton = () => { - const { undo } = useCommands(); - - return ( - - ); -}; diff --git a/apps/app/styles/editor.css b/apps/app/styles/editor.css index 319f3207d0f..4c7f499154f 100644 --- a/apps/app/styles/editor.css +++ b/apps/app/styles/editor.css @@ -419,3 +419,23 @@ img.ProseMirror-separator { text-decoration: underline; } /* end link styling */ + +/* format buttons styling */ +.MuiButtonBase-root { + border: none !important; + border-radius: 0.25rem !important; + padding: 0.25rem !important; +} + +.MuiButtonBase-root:hover { + background-color: rgb(229 231 235); +} + +.MuiButtonBase-root svg { + fill: #000 !important; +} + +.MuiButtonBase-root.Mui-selected { + background-color: rgb(229 231 235) !important; +} +/* end format buttons styling */