feat(bookreader): controls review 2
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
import { ControlButtonsProps } from "../types";
|
import { ControlButtonsProps } from "../types";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { ChevronLeft, ChevronRight, LayoutTemplate, SplitSquareVertical } from "lucide-react";
|
import { ChevronLeft, ChevronRight, X, SplitSquareVertical, LayoutTemplate } from "lucide-react";
|
||||||
|
|
||||||
export const ControlButtons = ({
|
export const ControlButtons = ({
|
||||||
showControls,
|
showControls,
|
||||||
onPrevious,
|
onToggleControls,
|
||||||
onNext,
|
onPreviousPage,
|
||||||
|
onNextPage,
|
||||||
onClose,
|
onClose,
|
||||||
currentPage,
|
currentPage,
|
||||||
totalPages,
|
totalPages,
|
||||||
@@ -14,10 +15,10 @@ export const ControlButtons = ({
|
|||||||
}: ControlButtonsProps) => {
|
}: ControlButtonsProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Boutons en haut */}
|
{/* Bouton mode double page */}
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"absolute top-4 left-4 flex items-center gap-2 z-30 transition-all duration-300",
|
"absolute top-4 left-4 z-30 transition-all duration-300",
|
||||||
showControls ? "opacity-100" : "opacity-0 pointer-events-none"
|
showControls ? "opacity-100" : "opacity-0 pointer-events-none"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
@@ -39,12 +40,29 @@ export const ControlButtons = ({
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Bouton fermer */}
|
||||||
|
{onClose && (
|
||||||
|
<button
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
onClose();
|
||||||
|
}}
|
||||||
|
className={cn(
|
||||||
|
"absolute top-4 right-4 p-2 rounded-full bg-background/50 hover:bg-background/80 transition-all duration-300 z-30",
|
||||||
|
showControls ? "opacity-100" : "opacity-0 pointer-events-none"
|
||||||
|
)}
|
||||||
|
aria-label="Fermer"
|
||||||
|
>
|
||||||
|
<X className="h-6 w-6" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Bouton précédent */}
|
{/* Bouton précédent */}
|
||||||
{currentPage > 1 && (
|
{currentPage > 1 && (
|
||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onPrevious();
|
onPreviousPage();
|
||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn(
|
||||||
"absolute left-4 top-1/2 -translate-y-1/2 p-2 rounded-full bg-background/50 hover:bg-background/80 transition-all duration-300 z-20",
|
"absolute left-4 top-1/2 -translate-y-1/2 p-2 rounded-full bg-background/50 hover:bg-background/80 transition-all duration-300 z-20",
|
||||||
@@ -61,7 +79,7 @@ export const ControlButtons = ({
|
|||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onNext();
|
onNextPage();
|
||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn(
|
||||||
"absolute right-4 top-1/2 -translate-y-1/2 p-2 rounded-full bg-background/50 hover:bg-background/80 transition-all duration-300 z-20",
|
"absolute right-4 top-1/2 -translate-y-1/2 p-2 rounded-full bg-background/50 hover:bg-background/80 transition-all duration-300 z-20",
|
||||||
@@ -72,36 +90,6 @@ export const ControlButtons = ({
|
|||||||
<ChevronRight className="h-8 w-8" />
|
<ChevronRight className="h-8 w-8" />
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Bouton fermer */}
|
|
||||||
{onClose && (
|
|
||||||
<button
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
onClose();
|
|
||||||
}}
|
|
||||||
className={cn(
|
|
||||||
"absolute top-4 right-4 p-2 rounded-full bg-background/50 hover:bg-background/80 transition-all duration-300 z-30",
|
|
||||||
showControls ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
||||||
)}
|
|
||||||
aria-label="Fermer"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
className="h-6 w-6"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
strokeWidth={2}
|
|
||||||
d="M6 18L18 6M6 6l12 12"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ export interface ControlButtonsProps {
|
|||||||
onToggleControls: () => void;
|
onToggleControls: () => void;
|
||||||
onPreviousPage: () => void;
|
onPreviousPage: () => void;
|
||||||
onNextPage: () => void;
|
onNextPage: () => void;
|
||||||
|
onClose?: () => void;
|
||||||
currentPage: number;
|
currentPage: number;
|
||||||
totalPages: number;
|
totalPages: number;
|
||||||
|
isDoublePage: boolean;
|
||||||
|
onToggleDoublePage: () => void;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user