| 1 | "use client"; |
| 2 | |
| 3 | import { RiFontSize } from "react-icons/ri"; |
| 4 | |
| 5 | import { Label } from "@/components/ui/label"; |
| 6 | import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"; |
| 7 | import { cn } from "@/lib/utils"; |
| 8 | import { useCommonValues } from "../hooks/useCommonValues"; |
| 9 | import { useUpdateAllSlides } from "../hooks/useUpdateAllSlides"; |
| 10 | |
| 11 | export function TypographySizeSection() { |
| 12 | const { currentFontSize } = useCommonValues(); |
| 13 | const updateAllSlides = useUpdateAllSlides(); |
| 14 | |
| 15 | return ( |
| 16 | <div className="space-y-2"> |
| 17 | <Label |
| 18 | htmlFor="font-size" |
| 19 | className="flex items-center gap-2 text-sm font-semibold text-foreground" |
| 20 | > |
| 21 | <RiFontSize className="size-4 text-muted-foreground" /> |
| 22 | Font Size |
| 23 | </Label> |
| 24 | |
| 25 | <ToggleGroup |
| 26 | id="font-size" |
| 27 | type="single" |
| 28 | value={currentFontSize} |
| 29 | onValueChange={(val) => |
| 30 | val && updateAllSlides({ fontSize: val as "S" | "M" | "L" }) |
| 31 | } |
| 32 | className="w-full gap-2 rounded-full" |
| 33 | > |
| 34 | <ToggleGroupItem |
| 35 | value="S" |
| 36 | variant="outline" |
| 37 | size="sm" |
| 38 | className={cn( |
| 39 | "flex-1 border-border transition-all", |
| 40 | currentFontSize === "S" && |
| 41 | "border-primary bg-primary text-primary-foreground", |
| 42 | )} |
| 43 | > |
| 44 | S |
| 45 | </ToggleGroupItem> |
| 46 | <ToggleGroupItem |
| 47 | value="M" |
| 48 | variant="outline" |
| 49 | size="sm" |
| 50 | className={cn( |
| 51 | "flex-1 border-border transition-all", |
| 52 | currentFontSize === "M" && |
| 53 | "border-primary bg-primary text-primary-foreground", |
| 54 | )} |
| 55 | > |
| 56 | M |
| 57 | </ToggleGroupItem> |
| 58 | <ToggleGroupItem |
| 59 | value="L" |
| 60 | variant="outline" |
| 61 | size="sm" |
| 62 | className={cn( |
| 63 | "flex-1 border-border transition-all", |
| 64 | currentFontSize === "L" && |
| 65 | "border-primary bg-primary text-primary-foreground", |
| 66 | )} |
| 67 | > |
| 68 | L |
| 69 | </ToggleGroupItem> |
| 70 | </ToggleGroup> |
| 71 | </div> |
| 72 | ); |
| 73 | } |
| 74 |