| 1 | import { ClipboardList } from "lucide-react"; |
| 2 | import { Tooltip } from "../components/Tooltip"; |
| 3 | import type { Translator } from "../lib/i18n"; |
| 4 | |
| 5 | // Floating launcher card show/hide toggle, rendered in the topic bar's actions |
| 6 | // row. Only mounted while the card can actually show (dock collapsed, surface |
| 7 | // wide enough), so it is never a control that swallows its own click; the |
| 8 | // pressed state mirrors whether the card is currently on screen. |
| 9 | export function LauncherToggleButton({ visible, t, onToggle }: { |
| 10 | visible: boolean; |
| 11 | t: Translator; |
| 12 | onToggle: () => void; |
| 13 | }) { |
| 14 | return ( |
| 15 | <div className="app__launcher-toggle"> |
| 16 | <Tooltip label={visible ? t("rightDock.hideLauncher") : t("rightDock.showLauncher")}> |
| 17 | <button |
| 18 | className={[ |
| 19 | "topicbar__chrome-btn", |
| 20 | "topicbar__chrome-btn--launcher", |
| 21 | visible ? "topicbar__chrome-btn--active" : "", |
| 22 | ].filter(Boolean).join(" ")} |
| 23 | type="button" |
| 24 | onClick={onToggle} |
| 25 | aria-label={visible ? t("rightDock.hideLauncher") : t("rightDock.showLauncher")} |
| 26 | aria-pressed={visible} |
| 27 | > |
| 28 | <ClipboardList size={15} /> |
| 29 | </button> |
| 30 | </Tooltip> |
| 31 | </div> |
| 32 | ); |
| 33 | } |
| 34 |