Skip to content

Commit c9e7374

Browse files
committed
Merge branch 'master' into 1112-design-categories-1920-x-1080
2 parents 69254bf + c36497e commit c9e7374

File tree

12 files changed

+3599
-1902
lines changed

12 files changed

+3599
-1902
lines changed

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727
uses: actions/checkout@v4
2828

2929
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@v2
30+
uses: github/codeql-action/init@v3
3131
with:
3232
languages: ${{ matrix.language }}
3333
queries: +security-and-quality
3434

3535
- name: Autobuild
36-
uses: github/codeql-action/autobuild@v2
36+
uses: github/codeql-action/autobuild@v3
3737

3838
- name: Perform CodeQL Analysis
39-
uses: github/codeql-action/analyze@v2
39+
uses: github/codeql-action/analyze@v3
4040
with:
4141
category: "/language:${{ matrix.language }}"

.github/workflows/playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
env:
2323
CI: true
2424
NEXT_PUBLIC_GRAPHQL_URL: ${{ secrets.NEXT_PUBLIC_GRAPHQL_URL }}
25-
- uses: actions/upload-artifact@v3
25+
- uses: actions/upload-artifact@v4
2626
if: always()
2727
with:
2828
name: playwright-report

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The current release has been tested and is confirmed working with the following
7171

7272
## Features
7373

74-
- Next.js version 13.5.3
74+
- Next.js version 14.2.5
7575
- React 18
7676
- Typescript
7777
- Tests with Playwright
@@ -114,6 +114,8 @@ With that said, keep the following in mind:
114114
- Currently only simple products and variable products work without any issues. Other product types are not known to work.
115115
- Only Cash On Delivery (COD) is currently supported. More payment methods may be added later.
116116

117+
This project is tested with BrowserStack.
118+
117119
## TODO
118120

119121
- Add total to cart/checkout page

package-lock.json

Lines changed: 3523 additions & 1832 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextjs-woocommerce",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
@@ -22,37 +22,37 @@
2222
"author": "w3bdesign",
2323
"license": "ISC",
2424
"dependencies": {
25-
"@apollo/client": "^3.8.7",
26-
"@types/react": "^18.2.37",
27-
"algoliasearch": "^4.20.0",
28-
"autoprefixer": "^10.4.16",
29-
"framer-motion": "10.16.5",
30-
"graphql": "^16.8.1",
25+
"@apollo/client": "^3.11.8",
26+
"@types/react": "^18.3.5",
27+
"algoliasearch": "^4.24.0",
28+
"autoprefixer": "^10.4.20",
29+
"framer-motion": "11.5.4",
30+
"graphql": "^16.9.0",
3131
"lodash": "^4.17.21",
32-
"next": "^14.0.3",
32+
"next": "^14.2.11",
3333
"nprogress": "^0.2.0",
34-
"postcss": "^8.4.31",
35-
"react": "^18.2.0",
36-
"react-dom": "^18.2.0",
37-
"react-hook-form": "^7.48.2",
34+
"postcss": "^8.4.45",
35+
"react": "^18.3.1",
36+
"react-dom": "^18.3.1",
37+
"react-hook-form": "^7.53.0",
3838
"react-instantsearch-dom": "^6.40.4",
39-
"uuid": "^9.0.1"
39+
"uuid": "^10.0.0"
4040
},
4141
"devDependencies": {
42-
"@playwright/test": "^1.40.0",
43-
"@types/lodash": "^4.14.201",
44-
"@types/node": "20.9.1",
42+
"@playwright/test": "^1.47.1",
43+
"@types/lodash": "^4.17.7",
44+
"@types/node": "22.5.4",
4545
"@types/nprogress": "^0.2.3",
46-
"@types/react-instantsearch-dom": "^6.12.6",
47-
"@types/uuid": "^9.0.7",
48-
"@typescript-eslint/eslint-plugin": "^6.11.0",
49-
"@typescript-eslint/parser": "^6.11.0",
46+
"@types/react-instantsearch-dom": "^6.12.8",
47+
"@types/uuid": "^10.0.0",
48+
"@typescript-eslint/eslint-plugin": "^8.5.0",
49+
"@typescript-eslint/parser": "^8.5.0",
5050
"babel-plugin-styled-components": "^2.1.4",
51-
"eslint": "^8.53.0",
52-
"eslint-config-next": "^14.0.3",
53-
"postcss-preset-env": "^9.3.0",
54-
"prettier": "^3.1.0",
55-
"tailwindcss": "^3.3.5",
56-
"typescript": "^5.2.2"
51+
"eslint": "8.57.0",
52+
"eslint-config-next": "^14.2.11",
53+
"postcss-preset-env": "^10.0.3",
54+
"prettier": "^3.3.3",
55+
"tailwindcss": "^3.4.11",
56+
"typescript": "^5.6.2"
5757
}
5858
}

src/components/Footer/Stickynav.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Hamburger from './Hamburger.component';
1313
const Stickynav = () => (
1414
<nav
1515
id="footer"
16-
className="fixed bottom-0 z-50 w-full md:hidden lg:hidden xl:hidden"
16+
className="fixed bottom-0 z-50 w-full md:hidden"
1717
>
1818
<div className="container flex flex-wrap items-center justify-between px-6 py-3 mx-auto mt-0 md:min-w-96 bg-blue-800">
1919
<Hamburger />

src/components/Layout/PageTitle.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface IPageTitleProps {
1313
const PageTitle = ({ title, marginLeft }: IPageTitleProps) => (
1414
<section
1515
className={`container ${
16-
marginLeft ? 'pl-8' : 'pl-4'
16+
marginLeft ? 'p-4' : 'p-0'
1717
} pl-4 mx-auto mt-24 text-center bg-white`}
1818
>
1919
<span className="py-2 text-2xl font-bold tracking-wide text-center text-gray-800 no-underline uppercase hover:no-underline">

src/components/Product/AddToCart.component.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,18 @@ export interface IProduct {
8080
export interface IProductRootObject {
8181
product: IProduct;
8282
variationId?: number;
83+
fullWidth?: boolean;
8384
}
8485

8586
/**
8687
* Handles the Add to cart functionality.
8788
* Uses GraphQL for product data
8889
* @param {IAddToCartProps} product // Product data
90+
* @param {number} variationId // Variation ID
91+
* @param {boolean} fullWidth // Whether the button should be full-width
8992
*/
9093

91-
const AddToCart = ({ product, variationId }: IProductRootObject) => {
94+
const AddToCart = ({ product, variationId, fullWidth = false }: IProductRootObject) => {
9295
const { setCart } = useContext(CartContext);
9396
const [requestError, setRequestError] = useState<boolean>(false);
9497

@@ -146,6 +149,7 @@ const AddToCart = ({ product, variationId }: IProductRootObject) => {
146149
<Button
147150
handleButtonClick={() => handleAddToCart()}
148151
buttonDisabled={addToCartLoading || requestError}
152+
fullWidth={fullWidth}
149153
>
150154
KJØP
151155
</Button>

src/components/Product/DisplayProducts.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ interface IDisplayProductsProps {
4848

4949
const DisplayProducts = ({ products }: IDisplayProductsProps) => (
5050
<section className="container mx-auto bg-white">
51-
<div id="product-container" className="flex flex-wrap items-center">
51+
<div id="product-container" className="flex flex-wrap items-center mb-[120px] md:mb-0">
5252
{products ? (
5353
products.map(
5454
({

src/components/Product/SingleProduct.component.tsx

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const SingleProduct = ({ product }: IProductRootObject) => {
4848
}
4949

5050
return (
51-
<section className="py-8 bg-white mb-12 sm:mb-2">
51+
<section className="bg-white mb-[8rem] md:mb-12">
5252
{/* Show loading spinner while loading, and hide content while loading */}
5353
{isLoading ? (
5454
<div className="h-56 mt-20">
@@ -57,14 +57,14 @@ const SingleProduct = ({ product }: IProductRootObject) => {
5757
<LoadingSpinner />
5858
</div>
5959
) : (
60-
<div className="container flex flex-wrap items-center pt-4 pb-12 mx-auto ">
61-
<div className="grid grid-cols-1 gap-4 mt-16 lg:grid-cols-2 xl:grid-cols-2 md:grid-cols-2 sm:grid-cols-2">
60+
<div className="container flex flex-wrap items-center pt-4 pb-12 mx-auto">
61+
<div className="grid grid-cols-1 gap-4 md:mt-16 lg:grid-cols-2 xl:grid-cols-2 md:grid-cols-2 sm:grid-cols-2">
6262
{image && (
6363
<img
6464
id="product-image"
6565
src={image.sourceUrl}
6666
alt={name}
67-
className="h-auto p-8 transition duration-500 ease-in-out transform xl:p-2 md:p-2 lg:p-2 hover:grow hover:scale-105"
67+
className="h-auto p-8 transition duration-500 ease-in-out transform xl:p-2 md:p-2 lg:p-2 md:hover:grow md:hover:scale-105"
6868
/>
6969
)}
7070
{!image && (
@@ -75,48 +75,47 @@ const SingleProduct = ({ product }: IProductRootObject) => {
7575
placeholderFallBack
7676
}
7777
alt={name}
78-
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"
78+
className="h-auto p-8 transition duration-500 ease-in-out transform xl:p-2 md:p-2 lg:p-2 md:hover:grow md:hover:shadow-lg md:hover:scale-105"
7979
/>
8080
)}
81-
<div className="ml-8">
82-
<p className="text-3xl font-bold text-left">{name}</p>
83-
<br />
81+
<div className="px-4 md:ml-8">
82+
<h1 className="text-3xl font-bold text-center md:text-left mb-4">
83+
{name}
84+
</h1>
8485
{/* Display sale price when on sale */}
8586
{onSale && (
86-
<div className="flex">
87-
<p className="pt-1 mt-4 text-3xl text-gray-900">
87+
<div className="flex flex-col md:flex-row items-center md:items-start mb-4">
88+
<p className="text-3xl font-bold text-red-600">
8889
{product.variations && filteredVariantPrice(price, '')}
8990
{!product.variations && salePrice}
9091
</p>
91-
<p className="pt-1 pl-8 mt-4 text-2xl text-gray-900 line-through">
92+
<p className="text-xl text-gray-500 line-through md:ml-4">
9293
{product.variations && filteredVariantPrice(price, 'right')}
9394
{!product.variations && regularPrice}
9495
</p>
9596
</div>
9697
)}
9798
{/* Display regular price when not on sale */}
9899
{!onSale && (
99-
<p className="pt-1 mt-4 text-2xl text-gray-900"> {price}</p>
100+
<p className="text-2xl font-bold mb-4">{price}</p>
100101
)}
101-
<br />
102-
<p className="pt-1 mt-4 text-2xl text-gray-900">
103-
{DESCRIPTION_WITHOUT_HTML}
104-
</p>
102+
<p className="text-lg mb-4 text-center md:text-left">{DESCRIPTION_WITHOUT_HTML}</p>
105103
{Boolean(product.stockQuantity) && (
106-
<p
107-
v-if="data.product.stockQuantity"
108-
className="pt-1 mt-4 mb-4 text-2xl text-gray-900"
109-
>
110-
{product.stockQuantity} på lager
111-
</p>
104+
<div className="mb-4 p-2 bg-green-100 border border-green-400 rounded-lg mx-auto md:mx-0 max-w-[14.375rem]">
105+
<p className="text-lg text-green-700 font-semibold text-center md:text-left">
106+
{product.stockQuantity} på lager
107+
</p>
108+
</div>
112109
)}
113110
{product.variations && (
114-
<p className="pt-1 mt-4 text-xl text-gray-900">
115-
<span className="py-2">Varianter</span>
111+
<div className="mb-4">
112+
<label htmlFor="variant" className="block text-lg font-medium mb-2">
113+
Varianter
114+
</label>
116115
<select
117116
id="variant"
118117
name="variant"
119-
className="block w-80 px-6 py-2 bg-white border border-gray-500 rounded-lg focus:outline-none focus:shadow-outline"
118+
className="block w-full px-4 py-2 bg-white border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
120119
onChange={(e) => {
121120
setSelectedVariation(Number(e.target.value));
122121
}}
@@ -133,20 +132,17 @@ const SingleProduct = ({ product }: IProductRootObject) => {
133132
},
134133
)}
135134
</select>
136-
</p>
135+
</div>
137136
)}
138-
<div className="pt-1 mt-2">
139-
{
140-
// Display default AddToCart button if we do not have variations.
141-
// If we do, send the variationId to AddToCart button
142-
}
137+
<div className="w-full p-4 md:p-0">
143138
{product.variations && (
144139
<AddToCart
145140
product={product}
146141
variationId={selectedVariation}
142+
fullWidth={true}
147143
/>
148144
)}
149-
{!product.variations && <AddToCart product={product} />}
145+
{!product.variations && <AddToCart product={product} fullWidth={true} />}
150146
</div>
151147
</div>
152148
</div>

0 commit comments

Comments
 (0)