From df42b66bb1916273dd659fa316d6272d028ec42f Mon Sep 17 00:00:00 2001 From: Zh3nyaZh3nya <129783207+Zh3nyaZh3nya@users.noreply.github.com> Date: Wed, 4 Oct 2023 17:32:50 +0600 Subject: [PATCH 1/2] added file downloads --- src/module.ts | 5 +++ src/runtime/components/Pages/testVuetify.vue | 22 ++++++++----- .../components/Parts/files/downloadFiles.vue | 33 +++++++++++++++++++ 3 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 src/runtime/components/Parts/files/downloadFiles.vue diff --git a/src/module.ts b/src/module.ts index 277d722..bc58f68 100644 --- a/src/module.ts +++ b/src/module.ts @@ -46,5 +46,10 @@ export default defineNuxtModule({ name: 'News', filePath: resolver.resolve('runtime/components/Parts/News.vue') }) + + addComponent({ + name: 'downloadFiles', + filePath: resolver.resolve('runtime/components/Parts/files/downloadFiles.vue') + }) } }) diff --git a/src/runtime/components/Pages/testVuetify.vue b/src/runtime/components/Pages/testVuetify.vue index 20e172c..51f502e 100644 --- a/src/runtime/components/Pages/testVuetify.vue +++ b/src/runtime/components/Pages/testVuetify.vue @@ -22,15 +22,18 @@ - - - + + + + + + + + + + @@ -53,6 +56,7 @@ import Card from "../Parts/Card.vue" import footerOne from "../Parts/footer/footer.vue"; import HeaderOne from '../Parts/header/HeaderOne.vue' import partsNews from "../Parts/News.vue"; +import downloadFiles from "../Parts/files/downloadFiles.vue" const showDrawer = ref(false); diff --git a/src/runtime/components/Parts/files/downloadFiles.vue b/src/runtime/components/Parts/files/downloadFiles.vue new file mode 100644 index 0000000..6e8e38f --- /dev/null +++ b/src/runtime/components/Parts/files/downloadFiles.vue @@ -0,0 +1,33 @@ + + + From 93209c086458d3fe8fc5abb0ab06eb13ec85cebf Mon Sep 17 00:00:00 2001 From: Zh3nyaZh3nya <129783207+Zh3nyaZh3nya@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:37:28 +0600 Subject: [PATCH 2/2] added auto image selection based on the file extension, storybook docs --- playground/public/exel.svg | 5 ++ playground/public/img.svg | 6 +++ playground/public/mp3-4.svg | 5 ++ playground/public/pdf.svg | 5 ++ playground/public/word.svg | 5 ++ playground/public/zip.svg | 21 ++++++++ src/runtime/components/Pages/testVuetify.vue | 6 ++- .../components/Parts/files/downloadFiles.vue | 40 ++++++++++++-- src/stories/downloadFiles.stories.js | 52 +++++++++++++++++++ 9 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 playground/public/exel.svg create mode 100644 playground/public/img.svg create mode 100644 playground/public/mp3-4.svg create mode 100644 playground/public/pdf.svg create mode 100644 playground/public/word.svg create mode 100644 playground/public/zip.svg create mode 100644 src/stories/downloadFiles.stories.js diff --git a/playground/public/exel.svg b/playground/public/exel.svg new file mode 100644 index 0000000..f4dc7ee --- /dev/null +++ b/playground/public/exel.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/playground/public/img.svg b/playground/public/img.svg new file mode 100644 index 0000000..6b78749 --- /dev/null +++ b/playground/public/img.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/playground/public/mp3-4.svg b/playground/public/mp3-4.svg new file mode 100644 index 0000000..e157ce5 --- /dev/null +++ b/playground/public/mp3-4.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/playground/public/pdf.svg b/playground/public/pdf.svg new file mode 100644 index 0000000..b1b00b4 --- /dev/null +++ b/playground/public/pdf.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/playground/public/word.svg b/playground/public/word.svg new file mode 100644 index 0000000..1506d9d --- /dev/null +++ b/playground/public/word.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/playground/public/zip.svg b/playground/public/zip.svg new file mode 100644 index 0000000..4cb3b14 --- /dev/null +++ b/playground/public/zip.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/runtime/components/Pages/testVuetify.vue b/src/runtime/components/Pages/testVuetify.vue index cd5fe2e..95550d6 100644 --- a/src/runtime/components/Pages/testVuetify.vue +++ b/src/runtime/components/Pages/testVuetify.vue @@ -38,7 +38,11 @@ + :files="[ + {title: 'Политика обработки персональных данных ', img: 'logo.svg', download: '1.png', size: '123 KB', alt: '', date: '20.02.22'}, + {title: 'Политика обработки персональных данных ', download: '2.docx', alt: '', date: '20.02.22'} + ]" + /> diff --git a/src/runtime/components/Parts/files/downloadFiles.vue b/src/runtime/components/Parts/files/downloadFiles.vue index 6e8e38f..ada865e 100644 --- a/src/runtime/components/Parts/files/downloadFiles.vue +++ b/src/runtime/components/Parts/files/downloadFiles.vue @@ -1,11 +1,21 @@