Skip to content

Commit

Permalink
Merge pull request #353 from MovieReviewComment/feature/issue-302/imp…
Browse files Browse the repository at this point in the history
…lement-history-actions

[#302] Implement HistoryActions
  • Loading branch information
2wheeh authored May 4, 2024
2 parents 481956e + c5c7ec2 commit 6280639
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions ui/src/components/review/client/history-actions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use client';

import { ArrowUturnLeftIcon, ArrowUturnRightIcon } from '@heroicons/react/24/outline';
import { IS_APPLE } from '@lexical/utils';
import type { LexicalEditor } from 'lexical';

import { IconButton } from '@/components/common/client/icon-button';

import { useHistoryActions } from '@/hooks/editor/use-history-actions';

export function HistoryActions({ editor }: { editor: LexicalEditor | undefined | null }) {
const { undo, redo, canRedo, canUndo } = useHistoryActions(editor);

return (
<div className="flex space-x-2">
<IconButton
suppressHydrationWarning
title={IS_APPLE ? 'Undo (⌘Z)' : 'Undo (Ctrl+Z)'}
onClick={undo}
type="button"
disabled={!canUndo}
icon={<ArrowUturnLeftIcon className="w-5" />}
/>

<IconButton
suppressHydrationWarning
title={IS_APPLE ? 'Redo (⌘Y)' : 'Redo (Ctrl+Y)'}
onClick={redo}
type="button"
disabled={!canRedo}
icon={<ArrowUturnRightIcon className="w-5" />}
/>
</div>
);
}

0 comments on commit 6280639

Please sign in to comment.