All files / src/widgets/toolbar/ui RedoButton.tsx

66.66% Statements 2/3
100% Branches 2/2
50% Functions 1/2
66.66% Lines 2/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26            3x 3x                                    
import { Redo2 } from 'lucide-react';
import { useAppDispatch, useAppSelector } from '@/store/hooks';
import { selectCanRedo } from '@/entities/history/model/selectors';
import { redo } from '@/entities/history/model/slice';
 
export function RedoButton() {
	const dispatch = useAppDispatch();
	const canRedo = useAppSelector(selectCanRedo);
 
	return (
		<button
			onClick={() => dispatch(redo())}
			disabled={!canRedo}
			className={`p-2 rounded transition-colors ${
				canRedo
					? 'bg-gray-100 hover:bg-gray-200'
					: 'bg-gray-50 text-gray-400 cursor-not-allowed'
			}`}
			aria-label="Redo"
			title="Redo (Ctrl+Shift+Z)"
		>
			<Redo2 className="w-4 h-4" />
		</button>
	);
}