Skip to content

Commit 08cc5d2

Browse files
authored
Merge pull request #724 from w3bdesign/dev
Fix "method_lines" issue in components/Header/Hamburger
2 parents 56ce1ae + ccac3c8 commit 08cc5d2

File tree

3 files changed

+36
-35
lines changed

3 files changed

+36
-35
lines changed

README.md

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

6868
## Features
6969

70-
- NextJS version 11.1.2
70+
- NextJS version 12.0.7
7171
- Connect to Woocommerce GraphQL API and list name, price and display image for products
7272
- Support for simple products and variable products
7373
- Cart handling and checkout with WooCommerce (Cash On Delivery only for now)

components/Header/Hamburger.component.jsx

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { useState } from 'react';
22
import { useSpring, animated } from 'react-spring';
33
import Link from 'next/link';
44

5+
import LINKS from '../../utils/constants/LINKS';
6+
57
/**
68
* Shows the mobile menu.
79
* Shows a X when mobile menu is expanded.
@@ -89,47 +91,26 @@ const Hamburger = () => {
8991
<line x1="6" y1="6" x2="18" y2="18"></line>
9092
</animated.svg>
9193
</label>
92-
9394
{isExpanded && (
9495
<animated.div
9596
style={hamburgerSlideDownAnimation}
9697
id="mobile-menu"
9798
className="absolute right-0 z-10 w-full text-center text-black bg-white "
9899
>
99100
<ul>
100-
<li className="w-full p-4 border-t border-gray-400 border-solid rounded">
101-
<Link href="/">
102-
<a
103-
className="inline-block px-4 py-2 no-underline hover:text-black hover:underline"
104-
href="#"
105-
>
106-
Hjem
107-
</a>
108-
</Link>
109-
</li>
110-
<li className="w-full p-4 border-t border-gray-400 border-solid rounded">
111-
<Link href="/produkter">
112-
<a
113-
className="inline-block px-4 py-2 no-underline hover:text-black hover:underline"
114-
href="#"
115-
>
116-
Produkter
117-
</a>
118-
</Link>
119-
</li>
120-
<li
121-
id="mobile-li"
122-
className="w-full p-4 border-t border-b border-gray-400 border-solid rounded"
123-
>
124-
<Link href="/kategorier">
125-
<a
126-
className="inline-block px-4 py-2 no-underline hover:text-black hover:underline"
127-
href="#"
128-
>
129-
Kategorier
130-
</a>
131-
</Link>
132-
</li>
101+
{LINKS.map(({ id, title, href }) => (
102+
<li
103+
key={id}
104+
id="mobile-li"
105+
className="w-full p-4 border-t border-gray-400 border-solid rounded"
106+
>
107+
<Link href={href}>
108+
<a className="inline-block px-4 py-2 no-underline hover:text-black hover:underline">
109+
{title}
110+
</a>
111+
</Link>
112+
</li>
113+
))}
133114
</ul>
134115
</animated.div>
135116
)}

utils/constants/LINKS.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//exports.default = [
2+
const LINKS = [
3+
{
4+
id: 0,
5+
title: 'Hjem',
6+
href: '/',
7+
},
8+
{
9+
id: 1,
10+
title: 'Produkter',
11+
href: '/produkter',
12+
},
13+
{
14+
id: 2,
15+
title: 'Kategorier',
16+
href: '/kategorier',
17+
},
18+
];
19+
20+
export default LINKS;

0 commit comments

Comments
 (0)