File tree Expand file tree Collapse file tree 7 files changed +25
-15
lines changed Expand file tree Collapse file tree 7 files changed +25
-15
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ Start the server with ```npm run dev ```
27
27
- Able to place orders remotely with Woocommerce (bank transfers only for now)
28
28
- Algolia search (work in progress)
29
29
- Apollo Client with GraphQL
30
- - Animations with React-Spring
30
+ - Animations with React-Spring and Animate.css
31
31
- Shows loading spinner created with Styled Components while loading data and error message if data can not be loaded
32
32
- Shows page load progress with Nprogress during navigation
33
33
- Mobile menu and cart slide-out with animations
@@ -41,9 +41,7 @@ Start the server with ```npm run dev ```
41
41
42
42
## TODO
43
43
44
- - Validate remote Woocommerce session (or delete old session?)
45
44
- Hide products not in stock
46
45
- Add better SEO
47
- - Add price to Algolia search (Wordpress plugin has been developed, needs to be integrated)
48
46
- Add a better README.md
49
47
- Implement https://github.com/cyrilwanner/next-optimized-images for production
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ import {
25
25
const AddToCartButton = ( props ) => {
26
26
const [ cart , setCart ] = useContext ( AppContext ) ;
27
27
const [ requestError , setRequestError ] = useState ( null ) ;
28
- const [ showViewCart , setShowViewCart ] = useState ( false ) ;
28
+ const [ showViewCart , setShowViewCart ] = useState ( false ) ;
29
+ const [ showAddToCart , setshowAddToCart ] = useState ( false ) ;
29
30
30
31
const product = props . product ;
31
32
@@ -63,7 +64,8 @@ const AddToCartButton = (props) => {
63
64
refetch ( ) ;
64
65
// Show View Cart Button
65
66
setShowViewCart ( true ) ;
66
- console . warn ( 'Completed ADD_TO_CART' , data ) ;
67
+ setshowAddToCart ( true )
68
+
67
69
} ,
68
70
onError : ( error ) => {
69
71
if ( error ) {
@@ -81,14 +83,14 @@ const AddToCartButton = (props) => {
81
83
82
84
return (
83
85
< >
84
- { ! addToCartLoading && (
85
- < button
86
- onClick = { handleAddToCartClick }
87
- className = "px-4 py-2 font-bold bg-white border border-gray-400 border-solid rounded hover:bg-gray-400"
88
- >
89
- KJØP
90
- </ button >
91
- ) }
86
+ < button
87
+ onClick = { handleAddToCartClick }
88
+ className = { `px-4 py-2 font-bold bg-white border border-gray-400 border-solid rounded hover:bg-gray-400 ${
89
+ addToCartLoading && `animate__animated animate__fadeOut` } ${ showAddToCart && `animate__animated animate__fadeIn` } ` }
90
+ >
91
+ KJØP
92
+ </ button >
93
+
92
94
{ addToCartLoading && (
93
95
< >
94
96
< div className = "mt-4 text-xl text-left" >
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ const IndexProducts = ({ products }) => {
35
35
< img
36
36
id = "product-image"
37
37
className = "transition duration-500 ease-in-out transform hover:grow hover:shadow-lg hover:scale-105"
38
- //className="w-64 transition duration-500 ease-in-out transform hover:grow hover:shadow-lg hover:scale-105"
38
+ alt = { name }
39
39
src = { image . sourceUrl }
40
40
/>
41
41
</ a >
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ const SingleProduct = ({ product }) => {
44
44
< img
45
45
id = "product-image"
46
46
className = "h-auto p-8 transition duration-500 ease-in-out transform xl:p-2 md:p-2 lg:p-2 hover:grow hover:shadow-lg hover:scale-105"
47
+ alt = { name }
47
48
src = { image . sourceUrl }
48
49
/>
49
50
< div className = "ml-8" >
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import Footer from '../components/Footer/Footer.component';
9
9
10
10
import '../styles/index.css' ;
11
11
import '../styles/algolia.min.css' ;
12
+ import '../styles/animate.min.css' ;
12
13
import 'nprogress/nprogress.css' ;
13
14
14
15
import client from '../utils/apollo/ApolloClient' ;
Original file line number Diff line number Diff line change 1
- import { request } from 'graphql-request' ;
2
1
import { withRouter } from 'next/router' ;
3
2
4
3
import SingleProduct from 'components/Product/SingleProduct.component' ;
You can’t perform that action at this time.
0 commit comments