File tree Expand file tree Collapse file tree 9 files changed +45
-44
lines changed Expand file tree Collapse file tree 9 files changed +45
-44
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,7 @@ Start the server with ```npm run dev ```
24
24
- Connect to Woocommerce GraphQL API and list name, price and display image for products
25
25
- Cart handling with createContext
26
26
- Algolia search (work in progress)
27
- - Vercel useSWR for caching and graphql-request for data fetching (gradually being replaced with Apollo Client)
28
- - Apollo for GraphQL
27
+ - Apollo Client with GraphQL
29
28
- Animations with React-Spring
30
29
- Shows loading spinner created with Styled Components while loading data and error message if data can not be loaded
31
30
- Default frontpage products loaded through a predefined JSON file with getStaticProps for preloading
Original file line number Diff line number Diff line change 1
1
import { v4 as uuidv4 } from 'uuid' ;
2
2
3
- import PageTitle from 'components/Header/PageTitle.component' ;
4
-
5
-
6
-
7
3
/**
8
4
* Map over the categories and display them individually.
9
5
* Uses uuidv4 for unique key IDs
@@ -12,25 +8,17 @@ import PageTitle from 'components/Header/PageTitle.component';
12
8
const Categories = ( { categories } ) => {
13
9
return (
14
10
< >
15
-
16
- < br />
17
11
18
-
19
-
20
-
21
-
22
- < PageTitle title = "Kategorier" />
23
-
12
+ < section className = "container mx-auto bg-white" >
24
13
25
-
26
- < section className = "bg-white" >
27
- < div className = "container flex flex-wrap items-center mx-auto" >
14
+ < div className = "flex " >
15
+
28
16
{ categories . map ( ( { name } ) => (
29
17
< div
30
18
key = { uuidv4 ( ) }
31
- className = "flex flex-col p-6 md:w-1/3 xl:w-1/4"
19
+ className = "flex flex-col justify-around p-6 xs:w-1/2 md:w-1/3 xl:w-1/4"
32
20
>
33
- < div className = "flex items-center justify-center p-6 text-center border border-gray-300 rounded-lg shadow hover:shadow-outline" >
21
+ < div className = "flex items-center justify-center w-full h-16 text-center border border-gray-300 rounded-lg shadow hover:shadow-outline" >
34
22
< p className = "text-lg" > { name } </ p >
35
23
</ div >
36
24
</ div >
Original file line number Diff line number Diff line change 4
4
const Footer = ( ) => {
5
5
return (
6
6
< >
7
- < footer className = "container top-0 p-6 py-1 mx-auto mt-0 text-center bg-white border border-gray-300 rounded-lg shadow" >
7
+ < footer className = "container px-6 mx-auto text-center bg-white border border-gray-300 rounded-lg shadow" >
8
8
< div className = "p-6" > Copyright © { new Date ( ) . getFullYear ( ) } Daniel</ div >
9
9
</ footer >
10
10
</ >
Original file line number Diff line number Diff line change 1
- const PageTitle = ( { title } ) => {
1
+ const PageTitle = ( { title, marginleft } ) => {
2
2
return (
3
- < section className = "py-4 bg-white" >
4
- < div className = "container flex flex-wrap items-center mx-auto" >
5
- < div className = "container py-2 mx-auto mt-16 text-center " >
6
- < span className = "text-xl font-bold tracking-wide text-gray-800 no-underline uppercase hover:no-underline" >
3
+ < >
4
+ { marginleft ? (
5
+ < section className = "container pl-6 mx-auto mt-24 bg-white " >
6
+ < span className = "py-2 text-xl font-bold tracking-wide text-left text-gray-800 no-underline uppercase hover:no-underline" >
7
7
{ title }
8
8
</ span >
9
- </ div >
10
- </ div >
11
- </ section >
9
+ </ section >
10
+ ) : (
11
+ < section className = "container pl-4 mx-auto mt-24 bg-white" >
12
+ < span className = "py-2 text-xl font-bold tracking-wide text-left text-gray-800 no-underline uppercase hover:no-underline" >
13
+ { title }
14
+ </ span >
15
+ </ section >
16
+ ) }
17
+ </ >
12
18
) ;
13
19
} ;
14
20
Original file line number Diff line number Diff line change 1
1
import Link from 'next/link' ;
2
2
import { v4 as uuidv4 } from 'uuid' ;
3
3
4
- import PageTitle from 'components/Header/PageTitle.component' ;
5
-
6
4
/**
7
5
* Displays all of the products as long as length is defined.
8
6
* Does a map() over the props array and utilizes uuidv4 for unique key values.
@@ -11,18 +9,15 @@ import PageTitle from 'components/Header/PageTitle.component';
11
9
const IndexProducts = ( { products } ) => {
12
10
return (
13
11
< >
14
- < br />
15
-
16
-
17
- < PageTitle title = "Produkter" />
18
-
19
-
20
-
21
- < section className = "bg-white" >
12
+
13
+ < section className = "container mx-auto bg-white" >
14
+
22
15
< div
23
16
id = "product-container"
24
- className = "container flex flex-wrap items-center mx-auto overflow-hidden "
17
+ className = "flex flex-wrap items-center"
25
18
>
19
+
20
+
26
21
{ products ? (
27
22
products . map (
28
23
( {
@@ -46,8 +41,8 @@ const IndexProducts = ({ products }) => {
46
41
< a >
47
42
< img
48
43
id = "product-image"
49
- // className="object-cover w-full h-64 transition duration-500 ease-in-out transform hover:grow hover:shadow-lg hover:scale-105"
50
- className = "w-64 transition duration-500 ease-in-out transform hover:grow hover:shadow-lg hover:scale-105"
44
+ className = "transition duration-500 ease-in-out transform hover:grow hover:shadow-lg hover:scale-105"
45
+ // className="w-64 transition duration-500 ease-in-out transform hover:grow hover:shadow-lg hover:scale-105"
51
46
src = { image . sourceUrl }
52
47
/>
53
48
</ a >
Original file line number Diff line number Diff line change 1
1
import Hero from 'components/Index/Hero.component' ;
2
2
import IndexProducts from 'components/Product/IndexProducts.component' ;
3
+ import PageTitle from 'components/Header/PageTitle.component' ;
4
+
3
5
import client from 'utils/apollo/ApolloClient.js' ;
4
6
5
7
import { FETCH_ALL_PRODUCTS_QUERY } from 'utils/const/GQL_QUERIES' ;
@@ -14,6 +16,7 @@ const HomePage = ({ products }) => {
14
16
< >
15
17
16
18
< Hero />
19
+ < PageTitle title = "Produkter" />
17
20
{ products && < IndexProducts products = { products } /> }
18
21
</ >
19
22
) ;
Original file line number Diff line number Diff line change 1
1
import Categories from 'components/Category/Categories.component' ;
2
2
import LoadingSpinner from 'components/LoadingSpinner/LoadingSpinner.component' ;
3
+ import PageTitle from 'components/Header/PageTitle.component' ;
4
+
3
5
import client from 'utils/apollo/ApolloClient.js' ;
4
6
5
7
import { FETCH_ALL_CATEGORIES_QUERY } from 'utils/const/GQL_QUERIES' ;
@@ -12,6 +14,8 @@ const CategoryPage = ({ categories }) => {
12
14
13
15
return (
14
16
< >
17
+ < PageTitle title = "Kategorier" />
18
+
15
19
{ categories && < Categories categories = { categories } /> }
16
20
17
21
{ ! categories && ! error && (
Original file line number Diff line number Diff line change 1
1
import IndexProducts from 'components/Product/IndexProducts.component' ;
2
2
import LoadingSpinner from 'components/LoadingSpinner/LoadingSpinner.component' ;
3
+ import PageTitle from 'components/Header/PageTitle.component' ;
3
4
4
5
import { FETCH_ALL_PRODUCTS_QUERY } from 'utils/const/GQL_QUERIES' ;
6
+
5
7
import client from 'utils/apollo/ApolloClient.js' ;
6
8
7
9
/**
@@ -15,7 +17,11 @@ const Produkter = ({ products }) => {
15
17
16
18
return (
17
19
< >
18
- { products && < IndexProducts products = { products } /> }
20
+ < PageTitle title = "Produkter" marginleft = "true" />
21
+
22
+ {
23
+ products && < IndexProducts products = { products } />
24
+ }
19
25
20
26
{ ! products && ! error && (
21
27
< div className = "h-64 mt-8 text-2xl text-center" >
Original file line number Diff line number Diff line change 24
24
}
25
25
26
26
# product-container {
27
- max-width : 1100 px ;
27
+ /* max-width: 1000px;*/
28
28
}
29
29
30
30
/* Fix for annoying CSS bug with NavBar moving slightly on front page only */
31
31
@media only screen and (min-width : 769px ) {
32
32
# navbar-div {
33
- margin-left : 350 px ;
33
+ margin-left : 330 px ;
34
34
}
35
35
}
36
36
You can’t perform that action at this time.
0 commit comments