Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,35 @@ | |
</template> | ||
This comment has been minimized.
Sorry, something went wrong.
filrak
Author
Collaborator
|
||
|
||
<script> | ||
import Loader from '@vue-storefront/core/components/Loader' | ||
import { mapState } from 'vuex' | ||
export default { | ||
mixins: [Loader] | ||
name: 'Loader', | ||
data () { | ||
return { | ||
message: null | ||
} | ||
}, | ||
methods: { | ||
show (message = null) { | ||
this.message = message | ||
this.$store.commit('ui/setLoader', true) | ||
}, | ||
hide () { | ||
this.$store.commit('ui/setLoader', false) | ||
} | ||
}, | ||
computed: mapState({ | ||
isVisible: state => state.ui.loader | ||
}), | ||
beforeMount () { | ||
this.$bus.$on('notification-progress-start', this.show) | ||
this.$bus.$on('notification-progress-stop', this.hide) | ||
}, | ||
beforeDestroy () { | ||
this.$bus.$off('notification-progress-start', this.show) | ||
this.$bus.$off('notification-progress-stop', this.hide) | ||
} | ||
} | ||
</script> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,8 @@ | |
</i> | ||
This comment has been minimized.
Sorry, something went wrong.
filrak
Author
Collaborator
|
||
<slot name="header"/> | ||
</header> | ||
<div class="modal-content pt30 pb60 px65" v-if="$slots.content || staticData"> | ||
<div class="modal-content pt30 pb60 px65" v-if="$slots.content"> | ||
This comment has been minimized.
Sorry, something went wrong.
filrak
Author
Collaborator
|
||
<slot name="content"/> | ||
<static-content :file="staticData" v-if="staticData"/> | ||
</div> | ||
<slot/> | ||
</div> | ||
|
@@ -33,18 +32,63 @@ | |
</template> | ||
|
||
<script> | ||
import StaticContent from 'theme/components/theme/StaticContent' | ||
import Modal from '@vue-storefront/core/components/Modal' | ||
import { mapMutations } from 'vuex' | ||
import onEscapePress from '@vue-storefront/core/mixins/onEscapePress' | ||
export default { | ||
components: { | ||
StaticContent | ||
name: 'Modal', | ||
data () { | ||
return { | ||
isVisible: false | ||
} | ||
}, | ||
methods: { | ||
onHide (name, state, params) { | ||
return name === this.name ? this.toggle(false) : false | ||
}, | ||
onShow (name, state, params) { | ||
return name === this.name ? this.toggle(true) : false | ||
}, | ||
onToggle (name, state, params) { | ||
if (name === this.name) { | ||
state = typeof state === 'undefined' ? !this.isVisible : state | ||
this.toggle(state) | ||
} | ||
}, | ||
onEscapePress () { | ||
this.close() | ||
}, | ||
...mapMutations('ui', [ | ||
'setOverlay' | ||
]), | ||
toggle (state) { | ||
this.isVisible = state | ||
state ? this.setOverlay(state) : setTimeout(() => this.setOverlay(state), this.delay) | ||
}, | ||
close () { | ||
this.toggle(false) | ||
} | ||
}, | ||
beforeMount () { | ||
this.$bus.$on('modal-toggle', this.onToggle) | ||
this.$bus.$on('modal-show', this.onShow) | ||
this.$bus.$on('modal-hide', this.onHide) | ||
}, | ||
mixins: [Modal], | ||
beforeDestroy () { | ||
this.$bus.$off('modal-toggle', this.onToggle) | ||
this.$bus.$off('modal-show', this.onShow) | ||
this.$bus.$off('modal-hide', this.onHide) | ||
}, | ||
mixins: [onEscapePress], | ||
props: { | ||
staticData: { | ||
type: String, | ||
default: '' | ||
name: { | ||
required: true, | ||
type: String | ||
}, | ||
delay: { | ||
required: false, | ||
type: Number, | ||
default: 300 | ||
}, | ||
width: { | ||
type: Number, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ | |
</modal> | ||
</template> | ||
<script> | ||
import { Subscribe } from '@vue-storefront/core/modules/mailchimp/components/Subscribe' | ||
import { Subscribe } from 'src/modules/mailchimp/components/Subscribe' | ||
This comment has been minimized.
Sorry, something went wrong. |
||
import i18n from '@vue-storefront/i18n' | ||
import ButtonFull from 'theme/components/theme/ButtonFull.vue' | ||
|
@@ -54,10 +54,10 @@ export default { | |
}, | ||
methods: { | ||
onSuccesfulSubmission () { | ||
this.$bus.$emit('notification', { | ||
this.$store.dispatch('notification/spawnNotification', { | ||
This comment has been minimized.
Sorry, something went wrong.
filrak
Author
Collaborator
|
||
type: 'success', | ||
message: i18n.t('You have been successfully subscribed to our newsletter!'), | ||
action1: { label: i18n.t('OK'), action: 'close' } | ||
action1: { label: i18n.t('OK') } | ||
This comment has been minimized.
Sorry, something went wrong.
filrak
Author
Collaborator
|
||
}) | ||
this.$bus.$emit('modal-hide', 'modal-newsletter') | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
:class="notification.type" | ||
> | ||
<div | ||
@click="action(notification.action1.action, index)" | ||
@click="execAction(notification.action1, index)" | ||
This comment has been minimized.
Sorry, something went wrong.
filrak
Author
Collaborator
|
||
class="message p20" | ||
data-testid="notificationMessage" | ||
> | ||
|
@@ -20,15 +20,15 @@ | |
:class="`border-${notification.type}`" | ||
id="notificationAction1" | ||
data-testid="notificationAction1" | ||
@click="action(notification.action1.action, index, notification)" | ||
@click="execAction(notification.action1, index)" | ||
> | ||
{{ notification.action1.label }} | ||
</div> | ||
<div | ||
class="py10 px20 pointer weight-400 notification-action uppercase" | ||
id="notificationAction2" | ||
data-testid="notificationAction2" | ||
@click="action(notification.action2.action, index, notification)" | ||
@click="execAction(notification.action2, index)" | ||
v-if="notification.action2" | ||
> | ||
{{ notification.action2.label }} | ||
|
@@ -40,10 +40,23 @@ | |
</template> | ||
|
||
<script> | ||
import Notification from '@vue-storefront/core/components/Notification' | ||
import { Notification } from '@vue-storefront/core/modules/notification/components/Notification' | ||
This comment has been minimized.
Sorry, something went wrong. |
||
export default { | ||
mixins: [Notification] | ||
mixins: [Notification], | ||
methods: { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
execAction (action, index) { | ||
if (action.action) { | ||
// for backward compatibility | ||
if (action.action === 'close') { | ||
this.$store.dispatch('notification/removeNotification', index) | ||
} else { | ||
action.action() | ||
} | ||
} | ||
this.$store.dispatch('notification/removeNotification', index) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
|
Filer and it's typed version merged into one.
Correct import.