/** * Save Button with inline feedback * * Shows state based on whether there are unsaved changes: * - "Saved" when clean (no unsaved changes) * - "Save" when dirty (has unsaved changes) * - "Saving..." while saving */ import { Button, Loader } from "@cloudflare/kumo"; import { useLingui } from "@lingui/react/macro"; import { FloppyDisk, Check } from "@phosphor-icons/react"; import type { ComponentProps } from "react"; import * as React from "react"; import { cn } from "../lib/utils"; export interface SaveButtonProps extends Omit, "children" | "shape"> { /** Whether there are unsaved changes */ isDirty: boolean; /** Whether currently saving */ isSaving: boolean; } /** * Button that reflects save state */ export function SaveButton({ isDirty, isSaving, className, disabled, ...props }: SaveButtonProps) { const { t } = useLingui(); const isSaved = !isDirty && !isSaving; return ( ); } export default SaveButton;