| 1 | "use client"; |
| 2 | |
| 3 | import { Star, X } from "lucide-react"; |
| 4 | |
| 5 | import { CreateThemeModal } from "@/components/notebook/presentation/components/theme/create-theme/CreateThemeModal"; |
| 6 | import { Button } from "@/components/ui/button"; |
| 7 | import { cn } from "@/lib/utils"; |
| 8 | import { usePresentationState } from "@/states/presentation-state"; |
| 9 | import { useThemePanelState } from "./theme-panel-state"; |
| 10 | |
| 11 | export function ThemePanelHeader() { |
| 12 | const { showFavorites, setShowFavorites, setOpenCreateThemeModal } = |
| 13 | useThemePanelState(); |
| 14 | const setActiveRightPanel = usePresentationState( |
| 15 | (s) => s.setActiveRightPanel, |
| 16 | ); |
| 17 | |
| 18 | return ( |
| 19 | <div className="flex items-center justify-between border-b border-border px-4 py-2"> |
| 20 | <Button |
| 21 | onClick={() => setOpenCreateThemeModal(true)} |
| 22 | className="bg-purple-600 px-4 py-2 text-sm text-white hover:bg-purple-700" |
| 23 | > |
| 24 | New Theme |
| 25 | </Button> |
| 26 | <div className="flex items-center gap-2"> |
| 27 | <CreateThemeModal /> |
| 28 | <Button |
| 29 | type="button" |
| 30 | variant="ghost" |
| 31 | className={cn( |
| 32 | "size-8! rounded-full p-0", |
| 33 | showFavorites |
| 34 | ? "bg-yellow-100 text-yellow-600 hover:bg-yellow-100 dark:bg-yellow-900/40 dark:text-yellow-400" |
| 35 | : "text-foreground", |
| 36 | )} |
| 37 | onClick={() => setShowFavorites(!showFavorites)} |
| 38 | aria-pressed={showFavorites} |
| 39 | aria-label="Favorite themes" |
| 40 | title="Favorite themes" |
| 41 | > |
| 42 | <Star |
| 43 | className={cn( |
| 44 | "size-4!", |
| 45 | showFavorites && "fill-yellow-500 text-yellow-500", |
| 46 | )} |
| 47 | /> |
| 48 | </Button> |
| 49 | <Button |
| 50 | variant="ghost" |
| 51 | className="size-8! rounded-full p-0" |
| 52 | onClick={() => setActiveRightPanel(null)} |
| 53 | > |
| 54 | <X className="size-5!" /> |
| 55 | </Button> |
| 56 | </div> |
| 57 | </div> |
| 58 | ); |
| 59 | } |
| 60 |