import type { EditorMode } from '../editors/types'; import { EditIcon, ViewIcon } from '../icons'; type EditorModeToggleProps = { mode: EditorMode; onChange: (mode: EditorMode) => void; /** Disable interaction (e.g. when the active tab has no document). */ disabled?: boolean; }; const BASE_BUTTON = 'flex size-6 cursor-pointer items-center justify-center disabled:cursor-default'; /** * Conjoined two-button Edit / View segmented control. The selected button is * highlighted; both carry a tooltip + aria-label. Emits the *other* mode on * click of the unselected side. */ export function EditorModeToggle({ mode, onChange, disabled, }: EditorModeToggleProps) { const buttonClass = (active: boolean) => `${BASE_BUTTON} ${ active ? 'bg-border/50 text-foreground' : 'text-foreground/60 hover:bg-border/40' }`; return (
); }