From 520bdc14b7cc719406979052e4b839c0525183a0 Mon Sep 17 00:00:00 2001 From: AibtVlr Date: Mon, 16 Oct 2023 16:35:41 +0600 Subject: [PATCH 1/3] add modals --- src/runtime/components/Parts/modal.vue | 156 +++++++++++++++ src/stories/Modal.stories.js | 259 +++++++++++++++++++++++++ 2 files changed, 415 insertions(+) create mode 100644 src/runtime/components/Parts/modal.vue create mode 100644 src/stories/Modal.stories.js diff --git a/src/runtime/components/Parts/modal.vue b/src/runtime/components/Parts/modal.vue new file mode 100644 index 0000000..6afd701 --- /dev/null +++ b/src/runtime/components/Parts/modal.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/src/stories/Modal.stories.js b/src/stories/Modal.stories.js new file mode 100644 index 0000000..6bb7fe1 --- /dev/null +++ b/src/stories/Modal.stories.js @@ -0,0 +1,259 @@ +import Modal from '../runtime/components/Parts/modal.vue' + +const modal_buttons = [ + { + id: 0, + text: 'No, cancel', + attributes: { + size: 'x-large', + variant: 'outlined', + color: 'primary', + class: 'text-body-1', + rounded: 'lg', + } + }, + + { + id: 1, + text: 'Yes, confirm ', + attributes: { + size: 'x-large', + variant: 'flat', + color: 'primary', + class: 'text-body-1', + rounded: 'lg', + } + } +] + +// More on how to set up stories at: https://storybook.js.org/docs/vue/writing-stories/introduction +export default { + title: 'Parts/Modal', + component: Modal, + tags: ['autodocs'], + argTypes: { + //General + modelValue: 'boolean', + heading: { type: 'text' }, + text: { type: 'text' }, + rounded: { type: 'text' }, + + //Buttons + buttons: { type: 'array' }, + buttonsDirection: { type: 'text' }, + + //Icon + icon: { type: 'text' }, + iconCenter: {type: 'boolean'}, + iconBg: { type: 'text' }, + + //Img + img: { type: 'text' }, + imgRounded: { type: 'text' }, + imgFluid: {type: 'boolean'} + }, +}; + +export const Standard = { + render: (args) => ({ + components: { Modal }, + setup() { + console.log(args) + return { args }; + }, + template:` + ` + }), + args: { + modelValue: true, + width:"580", + heading:"Sure you want to accept?", + text:"A sure you want to accept this?", + rounded:"lg", + buttons: modal_buttons, + icon:"mdi-check-circle-outline", + 'icon-size':"34" + }, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/UmrBZaCGhezw0qx9xuq7Xf/%D0%94%D0%B8%D0%B7%D0%B0%D0%B9%D0%BD-%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0?type=design&node-id=1441%3A36039&mode=design&t=pIUOX6myj5IXqDE7-1", + }, + }, +} + +export const body_slot = { + render: (args) => ({ + components: { Modal }, + setup() { + console.log(args) + return { args }; + }, + template:` + + ` + }), + args: { + bodySlot: + ` + `, + modelValue: true, + width:"580", + heading:"Sure you want to accept?", + text:"A sure you want to accept this?", + rounded:"lg", + buttons: modal_buttons, + icon:"mdi-check-circle-outline", + 'icon-size':"34" + }, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/UmrBZaCGhezw0qx9xuq7Xf/%D0%94%D0%B8%D0%B7%D0%B0%D0%B9%D0%BD-%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0?type=design&node-id=1441%3A36039&mode=design&t=pIUOX6myj5IXqDE7-1", + }, + }, +} + +export const No_icon = { + render: (args) => ({ + components: { Modal }, + setup() { + console.log(args) + return { args }; + }, + template:` + ` + }), + args: { + modelValue: true, + width:"580", + heading:"Sure you want to accept?", + text:"A sure you want to accept this?", + rounded:"lg", + buttons:[ + { + id: 0, + text: 'No, cancel', + attributes: { + size: 'x-large', + variant: 'outlined', + color: 'primary', + class: 'text-body-1', + rounded: 'lg', + } + }, + + { + id: 1, + text: 'Yes, confirm ', + attributes: { + size: 'x-large', + variant: 'flat', + color: 'primary', + class: 'text-body-1', + rounded: 'lg', + } + }, + ], + }, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/UmrBZaCGhezw0qx9xuq7Xf/%D0%94%D0%B8%D0%B7%D0%B0%D0%B9%D0%BD-%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0?type=design&node-id=1441%3A36039&mode=design&t=pIUOX6myj5IXqDE7-1", + }, + }, +} + +export const Icon_center = { + render: (args) => ({ + components: { Modal }, + setup() { + console.log(args) + return { args }; + }, + template:` + ` + }), + args: { + modelValue: true, + width:"580", + heading:"Sure you want to accept?", + text:"A sure you want to accept this?", + rounded:"lg", + buttons: modal_buttons, + buttonsDirection: 'column-reverse', + icon: 'mdi-check-circle-outline', + iconCenter: true, + 'icon-color':"dark", + iconBg: "transparent", + 'icon-size': "52" + }, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/UmrBZaCGhezw0qx9xuq7Xf/%D0%94%D0%B8%D0%B7%D0%B0%D0%B9%D0%BD-%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0?type=design&node-id=1441%3A36039&mode=design&t=pIUOX6myj5IXqDE7-1", + }, + }, +} + +export const Image = { + render: (args) => ({ + components: { Modal }, + setup() { + console.log(args) + return { args }; + }, + template:` + ` + }), + args: { + modelValue: true, + width: "580", + heading: "Subscribe to our newsletter", + text: "A sure you want to accept this?", + rounded: "lg", + buttons: modal_buttons, + 'img-height': "300", + 'img-rounded': 'lg', + img: "https://images.unsplash.com/photo-1684252408280-737200626f2c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2788&q=80", + }, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/UmrBZaCGhezw0qx9xuq7Xf/%D0%94%D0%B8%D0%B7%D0%B0%D0%B9%D0%BD-%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0?type=design&node-id=1441%3A36039&mode=design&t=pIUOX6myj5IXqDE7-1", + }, + }, +} + +export const Image_fluid = { + render: (args) => ({ + components: { Modal }, + setup() { + console.log(args) + return { args }; + }, + template:` + ` + }), + args: { + modelValue: true, + width: "580", + heading: "Subscribe to our newsletter", + text: "A sure you want to accept this?", + rounded: "lg", + 'close-button-variant': "tonal", + 'close-button-color': "grey-lighten-3", + buttons: modal_buttons, + 'img-height': "300", + 'img-fluid': true, + img: "https://images.unsplash.com/photo-1684252408280-737200626f2c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2788&q=80", + }, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/UmrBZaCGhezw0qx9xuq7Xf/%D0%94%D0%B8%D0%B7%D0%B0%D0%B9%D0%BD-%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0?type=design&node-id=1441%3A36039&mode=design&t=pIUOX6myj5IXqDE7-1", + }, + }, +} From 38fb9fabcaa4c45daffb0d1b0f35743aea40431a Mon Sep 17 00:00:00 2001 From: AibtVlr Date: Mon, 16 Oct 2023 16:35:55 +0600 Subject: [PATCH 2/3] Create modals page --- playground/pages/modals.vue | 155 +++++++++++++++++++ src/runtime/components/Pages/testVuetify.vue | 4 +- 2 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 playground/pages/modals.vue diff --git a/playground/pages/modals.vue b/playground/pages/modals.vue new file mode 100644 index 0000000..aaec0c0 --- /dev/null +++ b/playground/pages/modals.vue @@ -0,0 +1,155 @@ + + + + + diff --git a/src/runtime/components/Pages/testVuetify.vue b/src/runtime/components/Pages/testVuetify.vue index e3b1422..0fc2296 100644 --- a/src/runtime/components/Pages/testVuetify.vue +++ b/src/runtime/components/Pages/testVuetify.vue @@ -381,8 +381,8 @@ const header_menu = [ { id: 2, - title: 'Services', - url: '', + title: 'Modals', + url: 'modals', }, { From 88ddbcbe28545171db5352cee6ac6e309f5761f4 Mon Sep 17 00:00:00 2001 From: AibtVlr Date: Tue, 17 Oct 2023 14:44:49 +0600 Subject: [PATCH 3/3] add modal to module.ts --- src/module.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/module.ts b/src/module.ts index 15e4ed0..476455c 100644 --- a/src/module.ts +++ b/src/module.ts @@ -40,6 +40,12 @@ export default defineNuxtModule({ filePath: resolver.resolve('runtime/components/Parts/header.vue') }) + // Modal + addComponent( { + name: 'partsModal', + filePath: resolver.resolve('runtime/components/Parts/modal.vue') + }) + addComponent({ name: 'News',