Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#2773 #3157

Merged
merged 24 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
dc7bccf
Created add to wish list button at ProductTile
Michal-Dziedzinski Jun 25, 2019
3860bc5
Added add to compare component
Michal-Dziedzinski Jun 28, 2019
ceb14c3
Added transition on hover
Michal-Dziedzinski Jun 28, 2019
e87795c
Merge branch 'develop' into feature/#2773
pkarw Jun 29, 2019
6b0c7be
Merge branch 'develop' into feature/#2773
pkarw Jun 29, 2019
66d73b8
Fixed CR comments
Michal-Dziedzinski Jul 4, 2019
2d332f7
Merged pull changes
Michal-Dziedzinski Jul 4, 2019
2860214
Change isToCompare to isOnCompare
Michal-Dziedzinski Jul 5, 2019
55b7e65
Deleted commented fragment of code and added extra line
Michal-Dziedzinski Jul 5, 2019
7b1707e
Refactor visibilityCHanged method (number of nasted if)
Michal-Dziedzinski Jul 5, 2019
a166a1a
Merge changes
Michal-Dziedzinski Jul 5, 2019
1500ffb
Merged changes
Michal-Dziedzinski Jul 15, 2019
e1266c6
Merge branch 'develop' into feature/#2773
Michal-Dziedzinski Jul 15, 2019
5859f1e
Remove semicolons
Michal-Dziedzinski Jul 16, 2019
2fb980e
Merge branch 'develop' into feature/#2773
patzick Jul 16, 2019
12661bd
Remove semicolons
Michal-Dziedzinski Jul 16, 2019
22af4aa
Merge branch 'feature/#2773' of https://github.com/DivanteLtd/vue-sto…
Michal-Dziedzinski Jul 16, 2019
a36fd4c
Merge branch 'develop' into feature/#2773
pkarw Jul 16, 2019
548cca0
Fix changelog file, move isOnCompare and isOnWishlist to getters
Michal-Dziedzinski Jul 16, 2019
3bcd2ff
Merged changes
Michal-Dziedzinski Jul 16, 2019
9a186e7
Change find to some in wishlist and compare getters
Michal-Dziedzinski Jul 17, 2019
ba8d9f3
merged changes
Michal-Dziedzinski Jul 17, 2019
df75809
Merge branch 'develop' into feature/#2773
patzick Jul 18, 2019
9ccce52
fix registering compare module
patzick Jul 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions core/modules/compare/components/AddToCompare.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import Product from '@vue-storefront/core/modules/catalog/types/Product'
import { Compare as CompareModule } from '../'
import compareMountedMixin from '@vue-storefront/core/modules/compare/mixins/compareMountedMixin'

export const AddToCompare = {
name: 'AddToCompare',
mixins: [compareMountedMixin],
props: {
product: {
required: true,
type: Object
}
},
created () {
CompareModule.register()
},
methods: {
addToCompare (product: Product) {
return this.$store.state['compare']
Expand Down
25 changes: 25 additions & 0 deletions core/modules/compare/components/IsToCompare.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Compare as CompareModule } from '..';
import compareMountedMixin from '@vue-storefront/core/modules/compare/mixins/compareMountedMixin';

export const IsToCompare = {
name: 'isToCompare',
mixins: [compareMountedMixin],
props: {
product: {
required: true,
type: Object
}
},
created () {
CompareModule.register();
},
computed: {
isToCompare (): boolean {
Michal-Dziedzinski marked this conversation as resolved.
Show resolved Hide resolved
return (
!!this.$store.state.compare.items.find(
p => p.sku === this.product.sku
) || false
);
}
}
};
4 changes: 2 additions & 2 deletions core/modules/compare/components/Product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export const CompareProduct = {
name: 'CompareProduct',
mixins: [compareMountedMixin],
computed: {
isOnCompare (): boolean {
return this.$store.getters['compare/isOnCompare'](this.product)
isToCompare (): boolean {
return this.$store.getters['compare/isToCompare'](this.product)
Michal-Dziedzinski marked this conversation as resolved.
Show resolved Hide resolved
}
},
methods: {
Expand Down
20 changes: 20 additions & 0 deletions core/modules/compare/components/RemoveFromCompare.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Product from '@vue-storefront/core/modules/catalog/types/Product'
import { Compare as CompareModule } from '..'
import compareMountedMixin from '@vue-storefront/core/modules/compare/mixins/compareMountedMixin'

export const RemoveFromCompare = {
name: 'RemoveFromCompare',
mixins: [compareMountedMixin],
props: {
product: {
required: true,
type: Object
}
},
methods: {
removeFromCompare (product: Product) {
Michal-Dziedzinski marked this conversation as resolved.
Show resolved Hide resolved
CompareModule.register()
this.$store.dispatch('compare/removeItem', product)
}
}
}
8 changes: 4 additions & 4 deletions core/modules/compare/store/getters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GetterTree } from 'vuex'
import RootState from '@vue-storefront/core/types/RootState'
import CompareState from '../types/CompareState'
import { GetterTree } from 'vuex';
import RootState from '@vue-storefront/core/types/RootState';
import CompareState from '../types/CompareState';

const getters: GetterTree<CompareState, RootState> = {
isEmpty: (state) => state.items.length === 0,
Expand All @@ -9,4 +9,4 @@ const getters: GetterTree<CompareState, RootState> = {
getCompareProductsCount: (state) => state.items.length
}

export default getters
export default getters;
10 changes: 5 additions & 5 deletions docs/guide/components/product.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ No props
- `compare` - Defines if the current product is in compare list.
- `product` -A computed property that represents the current product that is shown on the page. Initially gets its value from `product/productCurrent` Vuex store getter. Includes all the options like size and color that the user sets on the page.
- `originalProduct` - A computed property that represents the current product in its initial state. Gets its value from`product/productOriginal` Vuex store getter.
- `parentProduct` - A computed property that represents the current product parent product, if any. Gets its value from `product/productParent` Vuex store getter.
- `parentProduct` - A computed property that represents the current product parent product, if any. Gets its value from `product/productParent` Vuex store getter.
- `attributesByCode` - A computed property that returns the list of all product attributes by their code. Gets its value from `attribute/attributeListByCode` Vuex store getter.
- `attributesById` - A computed property that returns the list of all product attributes by their ID. Gets its value from `attribute/attributeListById` Vuex store getter. **This prop is not used anywhere**.
- `breadcrumbs` - A computed property that represents breadcrumbs for the current product. Gets its value from `product/breadcrumbs` Vuex store getter.
- `configuration` - A computed property that represents an object that shows which attributes (like size and color) are chosen on the product. Gets its value from `product/currentConfiguration` Vuex store getter.
- `configuration` - A computed property that represents an object that shows which attributes (like size and color) are chosen on the product. Gets its value from `product/currentConfiguration` Vuex store getter.
- `options` - A computed property that represents an object that shows what attributes (like size and color) with what values are available on the product. Gets its value from `product/currentOptions` Vuex store getter.
- `category` - A computed property representing a category object of the current product. Gets its value from `category/getCurrentCategory` Vuex store getter.
- `productName` - A computed property that represents a product name. Gets its value from `category/getCurrentCategory` Vuex store getter.
- `productId` - A computed property representing a product ID. Gets its value from `category/getCurrentCategory` Vuex store getter.
- `isOnCompare` - A computed property that checks if a given product is in compare list.
- `productId` - A computed property representing a product ID. Gets its value from `category/getCurrentCategory` Vuex store getter.
- `isToCompare` - A computed property that checks if a given product is in compare list.
- `image` - A computed property that defines an image (thumbnail) that will be shown on the page and its size.
- `customAttributes` - this is a subset of `attributesByCode` list of attributes that the current product has.

Expand Down Expand Up @@ -55,7 +55,7 @@ Dispatches `product/reset` action that sets the current product to the original

_Parameters_

- `{store, route}` - An object that consists of references to the Vuex store and global router object.
- `{store, route}` - An object that consists of references to the Vuex store and global router object.

#### stateCheck

Expand Down
42 changes: 27 additions & 15 deletions src/themes/default-amp/components/core/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
<div class="row between-xs middle-xs px15 py5" v-if="isCheckoutPage">
<div class="col-xs-5 col-md-3 middle-xs">
<div>
<router-link :to="localizedRoute('/')" class="cl-tertiary links">
<router-link
:to="localizedRoute('/')"
class="cl-tertiary links"
>
{{ $t('Return to shopping') }}
</router-link>
</div>
Expand All @@ -33,12 +36,13 @@
</div>
<div class="col-xs-5 col-md-3 end-xs">
<div>
<a v-if="!currentUser" href="#" @click.prevent="gotoAccount" class="cl-tertiary links">
{{ $t('Login to your account') }}
</a>
<span v-else>
{{ $t('You are logged in as') }} {{ currentUser.firstname }}
</span>
<a
v-if="!currentUser"
href="#"
@click.prevent="gotoAccount"
class="cl-tertiary links"
>{{ $t('Login to your account') }}</a>
<span v-else>{{ $t('You are logged in as') }} {{ currentUser.firstname }}</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -79,9 +83,13 @@ export default {
})
},
beforeMount () {
window.addEventListener('scroll', () => {
this.isScrolling = true
}, {passive: true})
window.addEventListener(
'scroll',
() => {
this.isScrolling = true
},
{ passive: true }
)

setInterval(() => {
if (this.isScrolling) {
Expand All @@ -96,7 +104,10 @@ export default {
},
hasScrolled () {
this.scrollTop = window.scrollY
if (this.scrollTop > this.lastScrollTop && this.scrollTop > this.navbarHeight) {
if (
this.scrollTop > this.lastScrollTop &&
this.scrollTop > this.navbarHeight
) {
this.navVisible = false
} else {
this.navVisible = true
Expand All @@ -115,7 +126,7 @@ $color-icon-hover: color(secondary, $colors-background);
header {
height: 54px;
top: -55px;
z-index: 2;
z-index: 3;
transition: top 0.2s ease-in-out;
&.is-visible {
top: 0;
Expand Down Expand Up @@ -148,12 +159,13 @@ header {
}
}
.col-xs-2:first-of-type {
padding-left: 0;
padding-left: 0;
}
.col-xs-2:last-of-type {
padding-right: 0;
padding-right: 0;
}
a, span {
a,
span {
font-size: 12px;
}
}
Expand Down
Loading