Skip to content

Commit

Permalink
refactor: clarify when to show toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
2wheeh committed May 4, 2024
1 parent 765dba6 commit 171799e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ui/src/components/review/client/editor-sticky-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ import { useEditorRef } from '@/context/editor/editor-ref-context';
import { useStickyIOS } from '@/hooks/common/use-sticky-ios';

export function EditorStickyToolbar() {
const { isEditable } = useEditable() ?? {};
const { isEditable } = useEditable() ?? { isEditable: null };

if (isEditable === false) {
return null;
}
const showToolbar = isEditable === null || isEditable === true;

return <EditorToolbarInner />;
return showToolbar ? <EditorToolbarInner /> : null;
}

function EditorToolbarInner() {
Expand Down

0 comments on commit 171799e

Please sign in to comment.