feat: list of pages

This commit is contained in:
Ivan Rezchikov
2026-07-13 20:11:42 +03:00
parent 2e356e4c47
commit 7a7ca2d831
7 changed files with 122 additions and 68 deletions
+3 -2
View File
@@ -16,6 +16,7 @@ type Props = {
error?: string;
variant?: "default" | "editor";
previewClassName?: string;
previewStyle?: React.CSSProperties;
accept?: string;
required?: boolean;
value?: string;
@@ -55,7 +56,7 @@ function fileToFileList(file: File): FileList {
return dt.files;
}
export function ImageUploader({ id, name, label, description, error, variant = "default", previewClassName, accept = DEFAULT_ACCEPT, required, value, onFileSelect, onRemove, isUploading, children, caption, onCaptionChange }: Props) {
export function ImageUploader({ id, name, label, description, error, variant = "default", previewClassName, previewStyle, accept = DEFAULT_ACCEPT, required, value, onFileSelect, onRemove, isUploading, children, caption, onCaptionChange }: Props) {
const inputRef = useRef<HTMLInputElement>(null);
const [previewUrl, setPreviewUrl] = useState<string | null>(null);
const [fileInfo, setFileInfo] = useState<{ name: string; size: number } | null>(null);
@@ -124,7 +125,7 @@ export function ImageUploader({ id, name, label, description, error, variant = "
{displayUrl ? (
<div className={EDITOR_WRAPPER_CLASS}>
<div className="group relative rounded-md">
<img src={displayUrl} alt="" className={previewClassName ?? EDITOR_IMG_CLASS} />
<img src={displayUrl} alt="" className={previewClassName ?? EDITOR_IMG_CLASS} style={previewStyle} />
<div className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity">
<Button type="button" variant="secondary" size="sm" onClick={() => inputRef.current?.click()} disabled={isUploading}>