fix: save-offline button icon+tooltip only, matches other recipe actions

Was a labeled outline button, inconsistent with PrintButton/
ShareRecipeButton's icon-only ghost + tooltip convention on the same
row.
This commit is contained in:
Arnaud
2026-07-21 00:33:21 +02:00
parent 3aaa12910a
commit e78e24e40d
@@ -5,6 +5,7 @@ import { usePathname } from "next/navigation";
import { toast } from "sonner"; import { toast } from "sonner";
import { Download, Check } from "lucide-react"; import { Download, Check } from "lucide-react";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { isRecipeSavedOffline, saveRecipeOffline, unsaveRecipeOffline } from "@/lib/offline-db"; import { isRecipeSavedOffline, saveRecipeOffline, unsaveRecipeOffline } from "@/lib/offline-db";
export function SaveOfflineButton({ recipeId, recipeTitle }: { recipeId: string; recipeTitle: string }) { export function SaveOfflineButton({ recipeId, recipeTitle }: { recipeId: string; recipeTitle: string }) {
@@ -40,10 +41,18 @@ export function SaveOfflineButton({ recipeId, recipeTitle }: { recipeId: string;
} }
} }
const label = saved ? "Saved offline" : "Save offline";
return ( return (
<Button type="button" variant="outline" size="sm" disabled={busy} onClick={() => { void toggle(); }}> <TooltipProvider>
{saved ? <Check className="h-3.5 w-3.5" /> : <Download className="h-3.5 w-3.5" />} <Tooltip>
{saved ? "Saved offline" : "Save offline"} <TooltipTrigger render={
<Button type="button" variant="ghost" size="icon" disabled={busy} aria-label={label} onClick={() => { void toggle(); }}>
{saved ? <Check className="h-4 w-4" /> : <Download className="h-4 w-4" />}
</Button> </Button>
} />
<TooltipContent>{label}</TooltipContent>
</Tooltip>
</TooltipProvider>
); );
} }