From 19542da005decca415c130c52d8a63648e0f6730 Mon Sep 17 00:00:00 2001 From: Dmitri <19738862+Dmitri-2@users.noreply.github.com> Date: Sun, 18 Sep 2022 19:01:59 -0700 Subject: [PATCH] Add modal sizes --- .../modal/examples/ModalExample.vue | 34 +++++++++++++++++-- .../modal/examples/ModalSizeExample.vue | 19 +++++++++++ docs/components/modal/modal.md | 33 ++++++++++++++++-- src/components/Modal/Modal.vue | 17 +++++++++- 4 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 docs/components/modal/examples/ModalSizeExample.vue diff --git a/docs/components/modal/examples/ModalExample.vue b/docs/components/modal/examples/ModalExample.vue index c354d8f..c590f72 100644 --- a/docs/components/modal/examples/ModalExample.vue +++ b/docs/components/modal/examples/ModalExample.vue @@ -1,9 +1,9 @@ ``` -### Slot Properties +## Slot Properties Modal slots receive the following functions to interact with the modal: 1. `show` = show the modal 2. `hide` = hide the modal 3. `toggle` = toggles the modal from current state (e.g. if shown, then hide) + +These properties allow your code to set the open/closed state of the modal easily. + +## Sizes + +The modal can come in the following sizes (based on TailwindCSS classes). + +`xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`, `5xl`, `6xl`, `7xl` + +The default value is: `2xl` + +Demo: + + + +```vue + + +``` \ No newline at end of file diff --git a/src/components/Modal/Modal.vue b/src/components/Modal/Modal.vue index e88f688..da29f54 100644 --- a/src/components/Modal/Modal.vue +++ b/src/components/Modal/Modal.vue @@ -4,7 +4,8 @@
-
+
@@ -54,6 +55,20 @@ const props = defineProps({ }, }) +const modalSizeClasses = { + xs: 'max-w-xs', + sm: 'max-w-sm', + md: 'max-w-md', + lg: 'max-w-lg', + xl: 'max-w-xl', + '2xl': 'max-w-2xl', + '3xl': 'max-w-3xl', + '4xl': 'max-w-4xl', + '5xl': 'max-w-5xl', + '6xl': 'max-w-6xl', + '7xl': 'max-w-7xl', +} + const isHidden: Ref = ref(!props.show) function toggleModal() {