All files / src/components Buttons.tsx

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

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                              1x 7x                
import type { FC } from 'react';
import styles from '../styles.module.css';
 
export interface ButtonsProps {
  readonly canDelete: boolean;
  readonly onAdd: () => void;
  readonly onRename: () => void;
  readonly onDelete: () => void;
}
 
/**
 * Three-button strip on the right of the nav. Matches the legacy
 * `Buttons` React class: Add / Rename... / Delete, where Delete is disabled
 * when there is only one sheet.
 */
export const Buttons: FC<ButtonsProps> = ({ canDelete, onAdd, onRename, onDelete }) => (
  <div className={styles['buttons']}>
    <button onClick={onAdd}>Add</button>
    <button onClick={onRename}>Rename...</button>
    <button onClick={onDelete} disabled={!canDelete}>
      Delete
    </button>
  </div>
);