diff --git a/src/content/structured/components/buttons/code.mdx b/src/content/structured/components/buttons/code.mdx index 9c87b93b6..c516f4ec6 100644 --- a/src/content/structured/components/buttons/code.mdx +++ b/src/content/structured/components/buttons/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/button/code" -date: "2023-10-03" +date: "2024-03-13" title: "Button" @@ -67,12 +67,14 @@ export const snippetsOtherStates = [ { language: "Web component", snippet: `Add to order -Loading button`, +Loading button +Add to order`, }, { language: "React", snippet: `Add to order -Loading button`, +Loading button +Add to order`, }, ]; @@ -83,6 +85,9 @@ export const snippetsOtherStates = [ Loading button + + Add to order + ### With icon @@ -247,3 +252,86 @@ export const snippetsColour = [ Add to order + +### File upload + +export const FileUpload = () => { + function updateFileList(fileArray) { + const fileList = []; + Array.from(fileArray).forEach((file) => { + fileList.push(file.name); + }); + return fileList.join(", "); + } + return ( + + document.addEventListener("icFileSelection", (event) => + console.log(updateFileList(event.detail)) + ) + } + > + Upload File + + ); +}; + +export const snippetsFileUpload = [ + { + language: "Web component", + snippet: ` + Upload File + +`, + }, + { + language: "React", + snippet: `export const FileUpload = () => { + function updateFileList(fileArray) { + const fileList = []; + Array.from(fileArray).forEach((file) => { + fileList.push(file.name); + }); + return fileList.join(", "); + } + return ( + + document.addEventListener("icFileSelection", (event) => + console.log(updateFileList(event.detail)) + ) + } + > + Upload File + + ); +};`, + }, +]; + + + +