From 17a52fa8e5946987699c23eb01dd4d936875060c Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Fri, 11 Jan 2019 14:54:21 +0100 Subject: [PATCH] Added Modal to our Styleguide --- store/modal.js | 22 ++ .../system/components/layout/Modal/Modal.vue | 191 ++++++++++++++++++ .../system/components/layout/Modal/demo.md | 65 ++++++ .../system/components/layout/Modal/style.scss | 75 +++++++ 4 files changed, 353 insertions(+) create mode 100644 store/modal.js create mode 100644 styleguide/src/system/components/layout/Modal/Modal.vue create mode 100644 styleguide/src/system/components/layout/Modal/demo.md create mode 100644 styleguide/src/system/components/layout/Modal/style.scss diff --git a/store/modal.js b/store/modal.js new file mode 100644 index 000000000..f7bc1ad8e --- /dev/null +++ b/store/modal.js @@ -0,0 +1,22 @@ +export const state = () => { + return { + open: null, + data: {} + } +} + +export const mutations = { + SET_OPEN(state, ctx) { + state.open = ctx.name || null + state.data = ctx.data || {} + } +} + +export const getters = { + open(state) { + return state.open + }, + data(state) { + return state.data + } +} diff --git a/styleguide/src/system/components/layout/Modal/Modal.vue b/styleguide/src/system/components/layout/Modal/Modal.vue new file mode 100644 index 000000000..f85c3f986 --- /dev/null +++ b/styleguide/src/system/components/layout/Modal/Modal.vue @@ -0,0 +1,191 @@ + + + + + + + diff --git a/styleguide/src/system/components/layout/Modal/demo.md b/styleguide/src/system/components/layout/Modal/demo.md new file mode 100644 index 000000000..68129b2f9 --- /dev/null +++ b/styleguide/src/system/components/layout/Modal/demo.md @@ -0,0 +1,65 @@ +## Basic Modal + +Basic modal usage + +You will need to add the portal-target to the end of your html body to get the modal working properly +```html + + + +``` + +``` + + +``` + +Customize button labels +``` + + +``` diff --git a/styleguide/src/system/components/layout/Modal/style.scss b/styleguide/src/system/components/layout/Modal/style.scss new file mode 100644 index 000000000..1c2ab66ec --- /dev/null +++ b/styleguide/src/system/components/layout/Modal/style.scss @@ -0,0 +1,75 @@ + +.ds-modal-wrapper { + padding: $space-base; + position: relative; +} + +.ds-modal { + position: fixed; + z-index: $z-index-modal; + left: 50%; + top: 50%; + transform: translate3d(-50%, -50%, 0); + display: flex; + flex-direction: column; + max-width: 600px; + width: calc(90vw - 40px); + max-height: 90vh; + background: white; + border-radius: $border-radius-large; + padding: 0 $space-base; + box-shadow: $box-shadow-x-large; +} +.ds-modal-close { + position: absolute; + top: $space-small; + right: $space-small; +} +.ds-modal-body { + flex: 1; + overflow-y: auto; + height: auto; + min-height: 100px; + max-height: 60vh; +} +.ds-modal-header { + padding-top: $space-base; + + .ds-modal-title { + margin-bottom: 0; + } +} +.ds-modal-backdrop { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: $z-index-modal - 1; + background: rgba(0, 0, 0, 0.7); +} +.ds-modal-footer { + display: flex; + padding: $space-base 0; + flex-shrink: 0; + justify-content: flex-end; + + & > button { + margin-left: $space-x-small; + } +} + +$easeOut: cubic-bezier(0.19, 1, 0.22, 1); + +.ds-transition-modal-appear-enter-active { + opacity: 1; + transition: all 180ms $easeOut; + transition-delay: 0; + transform: translate3d(-50%, -50%, 0) scale(1); +} +.ds-transition-modal-appear-enter, +.ds-transition-modal-appear-leave-active { + opacity: 0; + transition-delay: 0; + transform: translate3d(-50%, -50%, 0) scale(0.9); +}