Skip to content

Commit

Permalink
vuestorefront#2913 Improve Size Guide feature
Browse files Browse the repository at this point in the history
  • Loading branch information
RGijsberts committed Jun 6, 2019
1 parent 27ff1ba commit 3f19634
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
42 changes: 42 additions & 0 deletions src/themes/default/components/core/blocks/Product/SizeGuide.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<template>
<modal name="modal-sizeguide" :width="620">
<div slot="header">
{{ $t('Size Guide') }}
</div>
<div slot="content"> <SizeGuideContent /> </div>
</modal>
</template>

<script>
import { mapState } from 'vuex'
import Modal from 'theme/components/core/Modal'
import SizeGuideContent from 'theme/components/theme/blocks/Static/Example'
export default {
name: 'SizeGuide',
computed: {
...mapState({
activeElem: state => state.ui.authElem
})
},
components: {
Modal,
SizeGuideContent
},
methods: {
close (e) {
if (e) localStorage.removeItem('redirect')
this.$bus.$emit('modal-hide', 'modal-sizeguide')
}
}
}
</script>

<style scoped>
.modal {
font-size: 18px;
}
.modal-content {
max-height: 80%;
}
</style>
2 changes: 2 additions & 0 deletions src/themes/default/layouts/Default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import Loader from 'theme/components/core/Loader.vue'
import Modal from 'theme/components/core/Modal.vue'
import Notification from 'theme/components/core/Notification.vue'
import SignUp from 'theme/components/core/blocks/Auth/SignUp.vue'
import SizeGuide from 'theme/components/core/blocks/Product/SizeGuide.vue'
import CookieNotification from 'theme/components/core/CookieNotification.vue'
import OfflineBadge from 'theme/components/core/OfflineBadge.vue'
import { isServer } from '@vue-storefront/core/helpers'
Expand Down Expand Up @@ -116,6 +117,7 @@ export default {
Notification,
Modal,
SignUp,
SizeGuide,
CookieNotification,
OfflineBadge,
OrderConfirmation,
Expand Down
15 changes: 11 additions & 4 deletions src/themes/default/pages/Product.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@
v-focus-clean
/>
</div>
<router-link
<span
to="/size-guide"
v-if="option.label == 'Size'"
@click.prevent="openSizeGuide"
class="
p0 ml30 inline-flex middle-xs no-underline h5
action size-guide pointer cl-secondary
Expand All @@ -120,7 +121,7 @@
<span>
{{ $t('Size guide') }}
</span>
</router-link>
</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -227,6 +228,7 @@
/>
<promoted-offers single-banner />
<related-products type="related" />
<SizeGuide />
</div>
</template>

Expand All @@ -251,7 +253,7 @@ import PromotedOffers from 'theme/components/theme/blocks/PromotedOffers/Promote
import focusClean from 'theme/components/theme/directives/focusClean'
import WebShare from '@vue-storefront/core/modules/social-share/components/WebShare'
import BaseInputNumber from 'theme/components/core/blocks/Form/BaseInputNumber'
import SizeGuide from 'theme/components/core/blocks/Product/SizeGuide'
export default {
components: {
'WishlistButton': () => import(/* webpackChunkName: "wishlist" */'theme/components/core/blocks/Wishlist/AddToWishlist'),
Expand All @@ -270,7 +272,8 @@ export default {
Reviews,
SizeSelector,
WebShare,
BaseInputNumber
BaseInputNumber,
SizeGuide
},
mixins: [Product, VueOfflineMixin],
data () {
Expand All @@ -297,6 +300,9 @@ export default {
message: this.$t('No such configuration for the product. Please do choose another combination of attributes.'),
action1: { label: this.$t('OK') }
})
},
openSizeGuide () {
this.$bus.$emit('modal-show', 'modal-sizeguide')
}
},
validations: {
Expand Down Expand Up @@ -480,4 +486,5 @@ $bg-secondary: color(secondary, $colors-background);
.web-share {
float: right;
}
</style>

0 comments on commit 3f19634

Please sign in to comment.