@@ -4,67 +4,72 @@ import Cart from '../Cart/Cart.component';
44import Search from '../AlgoliaSearch/AlgoliaSearchBox.component' ;
55import MobileSearch from '../AlgoliaSearch/MobileSearch.component' ;
66
7-
7+ import { useResponsive } from '../../utils/hooks/useResponsive' ;
88
99/**
1010 * Navigation for the application.
1111 * Includes mobile menu.
1212 */
13- const Navbar = ( ) => (
14- < header >
15- < nav id = "header" className = "top-0 z-50 w-full py-1 bg-white " >
16- < div className = "container flex md:flex-wrap flex-col md:flex-row items-center justify-between px-6 py-3 mx-auto mt-0 md:min-w-96" >
17- < div
18- className = "order-3 hidden w-full md:flex md:items-center md:w-auto md:order-1"
19- id = "menu"
20- >
21- < ul className = "items-center justify-between pt-4 text-base text-gray-700 md:flex md:pt-0" >
22- < li >
23- < Link href = "/produkter" >
24- < a className = "inline-block py-2 pr-4 text-xl font-bold no-underline hover:underline" >
25- Produkter
26- </ a >
27- </ Link >
28- </ li >
29- < li >
30- < Link href = "/kategorier" >
31- < a className = "inline-block py-2 pr-4 text-xl font-bold no-underline hover:underline" >
32- Kategorier
33- </ a >
34- </ Link >
35- </ li >
36- </ ul >
37- </ div >
38- < div className = "order-1 md:order-2" >
39- < Link href = "/" >
40- < a className = "flex items-center text-xl font-bold tracking-wide text-gray-800 no-underline hover:no-underline " >
41- < svg
42- className = "mr-2 text-gray-800 fill-current"
43- xmlns = "https://www.w3.org/2000/svg"
44- width = "24"
45- height = "24"
46- viewBox = "0 0 24 24"
47- aria-label = "Nettbutikk logo"
48- >
49- < path
50- d = "M5,22h14c1.103,0,2-0.897,2-2V9c0-0.553-0.447-1-1-1h-3V7c0-2.757-2.243-5-5-5S7,4.243,7,7v1H4C3.447,8,3,8.447,3,9v11 C3,21.103,3.897,22,5,22z M9,7c0-1.654,1.346-3,3-3s3,1.346,3,3v1H9V7z M5,10h2v2h2v-2h6v2h2v-2h2l0.002,10H5V10z"
51- aria-label = "Nettbutikk logo"
52- />
53- </ svg >
54- NETTBUTIKK
55- </ a >
56- </ Link >
57- </ div >
58- < div className = "flex items-center order-2 md:order-3" id = "nav-content" >
59- < Search />
60-
61- < MobileSearch />
13+ const Navbar = ( ) => {
14+ const responsive = useResponsive ( ) ;
6215
63- < Cart />
16+ return (
17+ < header >
18+ < nav id = "header" className = "top-0 z-50 w-full py-1 bg-white " >
19+ < div className = "container flex md:flex-wrap flex-col md:flex-row items-center justify-between px-6 py-3 mx-auto mt-0 md:min-w-96" >
20+ < div
21+ className = "order-3 hidden w-full md:flex md:items-center md:w-auto md:order-1"
22+ id = "menu"
23+ >
24+ < ul className = "items-center justify-between pt-4 text-base text-gray-700 md:flex md:pt-0" >
25+ < li >
26+ < Link href = "/produkter" >
27+ < a className = "inline-block py-2 pr-4 text-xl font-bold no-underline hover:underline" >
28+ Produkter
29+ </ a >
30+ </ Link >
31+ </ li >
32+ < li >
33+ < Link href = "/kategorier" >
34+ < a className = "inline-block py-2 pr-4 text-xl font-bold no-underline hover:underline" >
35+ Kategorier
36+ </ a >
37+ </ Link >
38+ </ li >
39+ </ ul >
40+ </ div >
41+ < div className = "order-1 md:order-2" >
42+ < Link href = "/" >
43+ < a className = "flex items-center text-xl font-bold tracking-wide text-gray-800 no-underline hover:no-underline " >
44+ < svg
45+ className = "mr-2 text-gray-800 fill-current"
46+ xmlns = "https://www.w3.org/2000/svg"
47+ width = "24"
48+ height = "24"
49+ viewBox = "0 0 24 24"
50+ aria-label = "Nettbutikk logo"
51+ >
52+ < path
53+ d = "M5,22h14c1.103,0,2-0.897,2-2V9c0-0.553-0.447-1-1-1h-3V7c0-2.757-2.243-5-5-5S7,4.243,7,7v1H4C3.447,8,3,8.447,3,9v11 C3,21.103,3.897,22,5,22z M9,7c0-1.654,1.346-3,3-3s3,1.346,3,3v1H9V7z M5,10h2v2h2v-2h6v2h2v-2h2l0.002,10H5V10z"
54+ aria-label = "Nettbutikk logo"
55+ />
56+ </ svg >
57+ NETTBUTIKK
58+ </ a >
59+ </ Link >
60+ </ div >
61+ < div
62+ className = "flex items-center order-2 md:order-3"
63+ id = "nav-content"
64+ >
65+ < Search />
66+ < MobileSearch />
67+ { ! responsive . isMobile && < Cart /> }
68+ </ div >
6469 </ div >
65- </ div >
66- </ nav >
67- </ header >
68- ) ;
70+ </ nav >
71+ </ header >
72+ ) ;
73+ } ;
6974
7075export default Navbar ;
0 commit comments