@cgi-learning-hub/ui
Version:
@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features
151 lines (150 loc) • 3.25 kB
JavaScript
import o from "../FileList/FileList.es.js";
import "../FileList/FileListItem.es.js";
const t = {
title: "Components/FileList",
component: o,
argTypes: {
files: {
description: "The list of files to display.",
control: "object",
table: {
type: {
summary: "(T extends CustomFile)[]",
detail: `interface CustomFile {
name: string;
size: number;
isLoading?: boolean;
isDeletable?: boolean;
isDownloadable?: boolean;
ownerName?: string;
}`
}
}
},
onDelete: {
description: "Facultative callback used for deleting a file. Withtout this callback, the delete button will not be displayed.",
action: "deleted",
table: {
type: { summary: "(file: T) => void | undefined" }
}
},
onClick: {
description: "Facultative callback when a file is clicked. Without this callback, the file will not be clickable.",
action: "clicked",
table: {
type: { summary: "(file: T) => void | undefined" }
}
},
onDownload: {
description: "Facultative callback when a file is downloaded. Without this callback, the download button will not be displayed.",
action: "downloaded",
table: {
type: { summary: "(file: T) => void | undefined" }
}
}
}
}, a = [
{
name: "file1 looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong.pdf",
size: 237482,
isLoading: !1,
isDeletable: !0,
isDownloadable: !0,
ownerName: "Alice Smith"
},
{
name: "file2.svg",
size: 5423,
isLoading: !0,
isDeletable: !1,
isDownloadable: !0
},
{
name: "file3.mp4",
size: 6548764,
isLoading: !1,
isDeletable: !0,
isDownloadable: !1,
ownerName: "John Doe"
},
{
name: "file4.docx",
size: 18456,
isLoading: !0,
isDeletable: !0,
isDownloadable: !1
},
{
name: "file5.gif",
size: 43954,
isLoading: !1,
isDeletable: !1,
isDownloadable: !0
},
{
name: "file6.zip",
size: 234723,
isLoading: !0,
isDeletable: !1,
isDownloadable: !1
},
{
name: "file7.png",
size: 32e4,
isLoading: !1,
isDeletable: !0,
isDownloadable: !0,
ownerName: "Chris Wilson"
},
{
name: "file8.jpg",
size: 98923,
isLoading: !0,
isDeletable: !0,
isDownloadable: !0,
ownerName: "Laura Martinez"
},
{
name: "file9.txt",
size: 14982,
isLoading: !1,
isDeletable: !0,
isDownloadable: !1,
ownerName: "David Moore"
},
{
name: "file10.mp3",
size: 2930294,
isLoading: !0,
isDeletable: !1,
isDownloadable: !1,
ownerName: "Rachel Taylor"
},
{
name: "file11.xlsx",
size: 11234,
isLoading: !1,
isDeletable: !0,
isDownloadable: !0,
ownerName: "James White"
},
{
name: "file12.rar",
size: 134723,
isLoading: !0,
isDeletable: !1,
isDownloadable: !0,
ownerName: "Sophia Harris"
}
], n = {
args: {
files: a,
onDelete: (e) => alert("delete : " + e.name),
onClick: (e) => alert("click : " + e.name),
onDownload: (e) => alert("download : " + e.name)
}
};
export {
n as Default,
t as default
};