Skip to content

Commit af3478f

Browse files
authored
Replace frontpage hero images with image slider
Implement Swiper
2 parents 94298d6 + ad7b836 commit af3478f

13 files changed

+246
-160
lines changed

CODE_OF_CONDUCT.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

@@ -68,9 +68,9 @@ members of the project's leadership.
6868
## Attribution
6969

7070
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71-
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
71+
available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>
7272

7373
[homepage]: https://www.contributor-covenant.org
7474

7575
For answers to common questions about this code of conduct, see
76-
https://www.contributor-covenant.org/faq
76+
<https://www.contributor-covenant.org/faq>

CONTRIBUTING.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ Please note we have a code of conduct, please follow it in all your interactions
77

88
## Pull Request Process
99

10-
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11-
build.
12-
2. Update the README.md with details of changes to the interface, this includes new environment
13-
variables, exposed ports, useful file locations and container parameters.
14-
3. Increase the version numbers in any examples files and the README.md to the new version that this
15-
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
16-
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
17-
do not have permission to do that, you may request the second reviewer to merge it for you.
10+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11+
build.
12+
2. Update the README.md with details of changes to the interface, this includes new environment
13+
variables, exposed ports, useful file locations and container parameters.
14+
3. Increase the version numbers in any examples files and the README.md to the new version that this
15+
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
16+
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
17+
do not have permission to do that, you may request the second reviewer to merge it for you.
1818

1919
## Code of Conduct
2020

@@ -32,22 +32,22 @@ orientation.
3232
Examples of behavior that contributes to creating a positive environment
3333
include:
3434

35-
* Using welcoming and inclusive language
36-
* Being respectful of differing viewpoints and experiences
37-
* Gracefully accepting constructive criticism
38-
* Focusing on what is best for the community
39-
* Showing empathy towards other community members
35+
- Using welcoming and inclusive language
36+
- Being respectful of differing viewpoints and experiences
37+
- Gracefully accepting constructive criticism
38+
- Focusing on what is best for the community
39+
- Showing empathy towards other community members
4040

4141
Examples of unacceptable behavior by participants include:
4242

43-
* The use of sexualized language or imagery and unwelcome sexual attention or
44-
advances
45-
* Trolling, insulting/derogatory comments, and personal or political attacks
46-
* Public or private harassment
47-
* Publishing others' private information, such as a physical or electronic
48-
address, without explicit permission
49-
* Other conduct which could reasonably be considered inappropriate in a
50-
professional setting
43+
- The use of sexualized language or imagery and unwelcome sexual attention or
44+
advances
45+
- Trolling, insulting/derogatory comments, and personal or political attacks
46+
- Public or private harassment
47+
- Publishing others' private information, such as a physical or electronic
48+
address, without explicit permission
49+
- Other conduct which could reasonably be considered inappropriate in a
50+
professional setting
5151

5252
### Our Responsibilities
5353

@@ -89,4 +89,5 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
8989
available at [http://contributor-covenant.org/version/1/4][version]
9090

9191
[homepage]: http://contributor-covenant.org
92+
9293
[version]: http://contributor-covenant.org/version/1/4/

README.md

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,59 +9,65 @@
99

1010
# This is currently a work in progress!
1111

12-
1. Install and activate the following required plugins, in your WordPress plugin directory:
12+
1. Install and activate the following required plugins, in your WordPress plugin directory:
1313

14-
- [woocommerce](https://wordpress.org/plugins/woocommerce) Ecommerce for WordPress.
15-
- [wp-graphql](https://wordpress.org/plugins/wp-graphql) Exposes GraphQL for WordPress.
16-
- [wp-graphql-woocommerce](https://github.com/wp-graphql/wp-graphql-woocommerce) Adds WooCommerce functionality to a WPGraphQL schema.
17-
- [algolia-woo-indexer](https://github.com/w3bdesign/algolia-woo-indexer) Sends WooCommerce products to Algolia. Required for search to work.
18-
- [wp-graphql-cors](https://github.com/funkhaus/wp-graphql-cors) Ensures that CORS works correctly. Remember to add the domain to the store under `Extend "Access-Control-Allow-Origin” header`
14+
- [woocommerce](https://wordpress.org/plugins/woocommerce) Ecommerce for WordPress.
15+
- [wp-graphql](https://wordpress.org/plugins/wp-graphql) Exposes GraphQL for WordPress.
16+
- [wp-graphql-woocommerce](https://github.com/wp-graphql/wp-graphql-woocommerce) Adds WooCommerce functionality to a WPGraphQL schema.
17+
- [algolia-woo-indexer](https://github.com/w3bdesign/algolia-woo-indexer) Sends WooCommerce products to Algolia. Required for search to work.
18+
- [wp-graphql-cors](https://github.com/funkhaus/wp-graphql-cors) Ensures that CORS works correctly. Remember to add the domain to the store under `Extend "Access-Control-Allow-Origin” header`
1919

2020
Optional plugin:
2121

22-
- [headless-wordpress](https://github.com/w3bdesign/headless-wp) Disables the frontend so only the backend is accessible. (optional)
22+
- [headless-wordpress](https://github.com/w3bdesign/headless-wp) Disables the frontend so only the backend is accessible. (optional)
2323

2424
The current release has been tested and is confirmed working with the following versions:
2525

26-
- WordPress version 5.6.0
27-
- WooCommerce version 4.9.0
28-
- WP GraphQL version 1.1.2
29-
- WooGraphQL version 0.6.1 (latest development version)
30-
- WPGraphQL CORS version 1.1.0 (with introspection enabled)
26+
- WordPress version 5.6.0
27+
- WooCommerce version 4.9.0
28+
- WP GraphQL version 1.1.2
29+
- WooGraphQL version 0.6.1 (latest development version)
30+
- WPGraphQL CORS version 1.1.0 (with introspection enabled)
3131

32-
2. For debugging and testing, install either:
32+
2. For debugging and testing, install either:
3333

34-
https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/ (Firefox)
34+
<https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/> (Firefox)
3535

36-
https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm (Chrome)
36+
<https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm> (Chrome)
3737

38-
Rename .env.example to .env so the Apollo debugger will correctly load. It will not load if the NODE_ENV variable is not correctly set.
38+
Rename .env.example to .env so the Apollo debugger will correctly load. It will not load if the NODE_ENV variable is not correctly set.
3939

40-
3. Make sure WooCommerce has some products already or import some sample products
40+
3. Make sure WooCommerce has some products already or import some sample products
4141

42-
The WooCommerce sample products CSV file is available at `wp-content/plugins/woocommerce/sample-data/sample_products.csv` or [Sample products](sample_products/)
42+
The WooCommerce sample products CSV file is available at `wp-content/plugins/woocommerce/sample-data/sample_products.csv` or [Sample products](sample_products/)
4343

44-
Import the products at `WP Dashboard > Tools > Import > WooCommerce products(CSV)`
44+
Import the products at `WP Dashboard > Tools > Import > WooCommerce products(CSV)`
4545

46-
4. Clone or fork the repo and modify `.env` with the URL to the GraphQL endpoint (or set environment variables in the configuration UI for your deployment solution)
47-
5. Start the server with `npm run dev`
48-
6. Enable COD (Cash On Demand) payment method in WooCommerce
49-
7. Add a product to the cart
50-
8. Proceed to checkout
51-
9. Fill in your details and place the order
46+
4. Clone or fork the repo and modify `.env` with the URL to the GraphQL endpoint (or set environment variables in the configuration UI for your deployment solution)
47+
48+
5. Start the server with `npm run dev`
49+
50+
6. Enable COD (Cash On Demand) payment method in WooCommerce
51+
52+
7. Add a product to the cart
53+
54+
8. Proceed to checkout
55+
56+
9. Fill in your details and place the order
5257

5358
## Features
5459

55-
- NuxtJS
56-
- Tailwind CSS
57-
- Vue Apollo with GraphQL Codegen
58-
- Responsive design
59-
- Support for simple products
60-
- GraphQL-based filters
61-
- CSS animations and transitions
62-
- Form handling and validation with Vue Formulate
63-
- Checkout process
64-
- Animated mobile menu
60+
- NuxtJS
61+
- Tailwind CSS
62+
- Vue Apollo with GraphQL Codegen
63+
- Vue Awesome Swiper for image slider on frontpage
64+
- Responsive design
65+
- Support for simple products
66+
- GraphQL-based filters
67+
- CSS animations and transitions
68+
- Form handling and validation with Vue Formulate
69+
- Checkout process
70+
- Animated mobile menu
6571

6672
## Troubleshooting
6773

@@ -75,7 +81,7 @@ Check the attributes of the products. Right now the application requires Size an
7581

7682
## TODO
7783

78-
- Look into variable product support
79-
- Make WooCommerce session token expire and get deleted after 24 hours
80-
- Finish implementing Algolia search
81-
- Make Algolia look good on mobile
84+
- Look into variable product support
85+
- Make WooCommerce session token expire and get deleted after 24 hours
86+
- Finish implementing Algolia search
87+
- Make Algolia look good on mobile

assets/images/Hero.jpg

-256 KB
Loading

assets/images/Hero2.jpg

38 KB
Loading
Loading

components/Cart/ShowCartContents.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default {
7979
result({ data, loading, networkStatus }) {
8080
const cartIsReady = data && networkStatus === 7
8181
82-
if (cartIsReady) {
82+
if (cartIsReady && !loading) {
8383
this.loading = false
8484
this.remoteCart = data
8585
this.subTotal = data.cart.total
@@ -118,7 +118,7 @@ export default {
118118
},
119119
},
120120
})
121-
.then(({ data }) => {
121+
.then(() => {
122122
this.removingCartItem = false
123123
this.$apollo.queries.cart.refetch()
124124
})

components/Header/Cart.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default {
5252
pollInterval: process.server ? undefined : 2000,
5353
result({ data, loading, networkStatus }) {
5454
const cartIsReady = networkStatus === 7
55-
if (cartIsReady) {
55+
if (cartIsReady && !loading) {
5656
this.remoteCart = data
5757
this.subTotal = data.cart.total
5858
this.cartLength = data.cart.contents.nodes.reduce(
@@ -71,7 +71,7 @@ export default {
7171
// Check if we are in the browser before checking localStorage
7272
// Will refresh the page to refetch the session from WooCommerce
7373
if (process.browser && !localStorage.getItem('woo-session')) {
74-
window.location.reload(true)
74+
this.$router.push({ path: '/', force: true })
7575
}
7676
},
7777
},

components/Index/Hero.vue

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,78 @@
11
<template>
22
<div>
3-
<div
4-
id="hero"
5-
class="flex w-full mx-auto mt-16 bg-right bg-cover md:pt-0 md:items-center"
6-
>
3+
<swiper id="hero" ref="mySwiper" :options="swiperOption">
4+
<swiper-slide
5+
><img alt="Image slider slide #1" src="~assets/images/Hero.jpg" />
6+
<div
7+
class="flex flex-col items-start justify-center w-full mx-auto tracking-wide lg:w-1/2"
8+
>
9+
<span
10+
class="w-full p-4 mt-4 text-center text-white bg-black text-md lg:text-2xl lg:-mt-64"
11+
>
12+
Modern Pillow Sample Set
13+
</span>
14+
</div>
15+
</swiper-slide>
16+
<swiper-slide
17+
><img alt="Image slider slide #2" src="~assets/images/Hero2.jpg" />
18+
<div
19+
class="flex flex-col items-start justify-center w-full mx-auto tracking-wide lg:w-1/2"
20+
>
21+
<span
22+
class="w-full p-4 mt-4 text-center text-white bg-black text-md lg:text-2xl lg:-mt-64"
23+
>
24+
Modern Interior Sample
25+
</span>
26+
</div>
27+
</swiper-slide>
728
<div
8-
class="flex flex-col items-start justify-center w-full px-6 tracking-wide lg:w-1/2"
9-
>
10-
<span class="p-4 my-4 text-2xl text-white bg-black rounded-lg">
11-
Modern Pillow Sample Set
12-
</span>
13-
</div>
14-
</div>
29+
slot="button-prev"
30+
class="swiper-button-prev"
31+
@click="swiper.slidePrev(1000, false)"
32+
></div>
33+
<div
34+
slot="button-next"
35+
class="swiper-button-next"
36+
@click="swiper.slideNext(1000, false)"
37+
></div>
38+
</swiper>
1539
</div>
1640
</template>
1741

1842
<script>
43+
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
44+
45+
import 'swiper/swiper-bundle.min.css'
46+
1947
export default {
2048
name: 'Hero',
49+
components: {
50+
Swiper,
51+
SwiperSlide,
52+
},
53+
data() {
54+
return {
55+
swiperOption: {
56+
navigation: {
57+
nextEl: '.swiper-button-next',
58+
prevEl: '.swiper-button-prev',
59+
},
60+
},
61+
}
62+
},
63+
computed: {
64+
swiper() {
65+
return this.$refs.mySwiper.$swiper
66+
},
67+
},
68+
mounted() {
69+
this.swiper.slideTo(2, 2000, false)
70+
},
2171
}
2272
</script>
2373

2474
<style lang="postcss" scoped>
2575
#hero {
26-
background-image: url('~assets/images/Hero.jpg');
27-
height: 24rem;
2876
max-width: 1350px;
2977
}
3078
</style>

nuxt.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default {
1313
},
1414
// Global page headers (https://go.nuxtjs.dev/config-head)
1515
head: {
16-
title: 'nuxtjs-woocommerce',
16+
title: 'NuxtJS WooCommerce',
1717
meta: [
1818
{ charset: 'utf-8' },
1919
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
@@ -26,7 +26,10 @@ export default {
2626
css: ['@/assets/css/animate.min.css'],
2727

2828
// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
29-
plugins: ['~/plugins/vue-formulate'],
29+
plugins: [
30+
'~/plugins/vue-formulate',
31+
{ src: '~/plugins/vue-awesome-swiper', mode: 'client', ssr: false },
32+
],
3033

3134
// Auto import components (https://go.nuxtjs.dev/config-components)
3235
components: true,

0 commit comments

Comments
 (0)