|
1 | | -// Imports |
2 | 1 | import Link from 'next/link'; |
3 | 2 |
|
4 | | -// Components |
5 | 3 | import Cart from './Cart.component'; |
6 | 4 | import AlgoliaSearchBox from '../AlgoliaSearch/AlgoliaSearchBox.component'; |
7 | 5 | import MobileSearch from '../AlgoliaSearch/MobileSearch.component'; |
8 | 6 |
|
9 | | -// Utils |
10 | | -import useIsMobile from '@/utils/hooks/useIsMobile'; |
11 | | - |
12 | 7 | /** |
13 | 8 | * Navigation for the application. |
14 | 9 | * Includes mobile menu. |
15 | 10 | */ |
16 | 11 | const Navbar = () => { |
17 | | - const isMobile = useIsMobile(); |
18 | 12 | return ( |
19 | 13 | <header className="border-b border-gray-200"> |
20 | 14 | <nav id="header" className="top-0 z-50 w-full bg-white"> |
21 | 15 | <div className="container mx-auto px-4 sm:px-6 py-4"> |
22 | | - {isMobile ? ( |
23 | | - // Mobile layout - logo with search below |
24 | | - <div className="flex flex-col space-y-4"> |
25 | | - <div className="text-center"> |
26 | | - <Link href="/"> |
27 | | - <span className="text-lg font-bold tracking-widest text-gray-900"> |
28 | | - NETTBUTIKK |
29 | | - </span> |
30 | | - </Link> |
31 | | - </div> |
32 | | - <div className="w-full"> |
33 | | - <MobileSearch /> |
34 | | - </div> |
| 16 | + <div className="flex flex-col space-y-4 md:hidden"> |
| 17 | + <div className="text-center"> |
| 18 | + <Link href="/"> |
| 19 | + <span className="text-lg font-bold tracking-widest text-gray-900"> |
| 20 | + NETTBUTIKK |
| 21 | + </span> |
| 22 | + </Link> |
35 | 23 | </div> |
36 | | - ) : ( |
37 | | - // Desktop layout |
38 | | - <div className="flex items-center justify-between"> |
39 | | - <div className="flex items-center space-x-8"> |
40 | | - <Link href="/produkter"> |
41 | | - <span className="text-base uppercase tracking-wider group relative"> |
42 | | - <span className="relative inline-block"> |
43 | | - <span className="absolute -bottom-1 left-0 w-0 h-px bg-gray-900 group-hover:w-full transition-all duration-500"></span> |
44 | | - Produkter |
45 | | - </span> |
| 24 | + <div className="w-full"> |
| 25 | + <MobileSearch /> |
| 26 | + </div> |
| 27 | + </div> |
| 28 | + <div className="hidden md:flex items-center justify-between"> |
| 29 | + <div className="flex items-center space-x-8"> |
| 30 | + <Link href="/produkter"> |
| 31 | + <span className="text-base uppercase tracking-wider group relative"> |
| 32 | + <span className="relative inline-block"> |
| 33 | + <span className="absolute -bottom-1 left-0 w-0 h-px bg-gray-900 group-hover:w-full transition-all duration-500"></span> |
| 34 | + Produkter |
46 | 35 | </span> |
47 | | - </Link> |
48 | | - <Link href="/kategorier"> |
49 | | - <span className="text-base uppercase tracking-wider group relative"> |
50 | | - <span className="relative inline-block"> |
51 | | - <span className="absolute -bottom-1 left-0 w-0 h-px bg-gray-900 group-hover:w-full transition-all duration-500"></span> |
52 | | - Kategorier |
53 | | - </span> |
| 36 | + </span> |
| 37 | + </Link> |
| 38 | + <Link href="/kategorier"> |
| 39 | + <span className="text-base uppercase tracking-wider group relative"> |
| 40 | + <span className="relative inline-block"> |
| 41 | + <span className="absolute -bottom-1 left-0 w-0 h-px bg-gray-900 group-hover:w-full transition-all duration-500"></span> |
| 42 | + Kategorier |
54 | 43 | </span> |
55 | | - </Link> |
56 | | - </div> |
57 | | - <Link href="/" className="hidden lg:block"> |
58 | | - <span className="text-xl font-bold tracking-widest text-gray-900 hover:text-gray-700 transition-colors"> |
59 | | - NETTBUTIKK |
60 | 44 | </span> |
61 | 45 | </Link> |
62 | | - <div className="flex items-center space-x-3"> |
63 | | - <AlgoliaSearchBox /> |
64 | | - <Cart /> |
65 | | - </div> |
66 | 46 | </div> |
67 | | - )} |
| 47 | + <Link href="/" className="hidden lg:block"> |
| 48 | + <span className="text-xl font-bold tracking-widest text-gray-900 hover:text-gray-700 transition-colors"> |
| 49 | + NETTBUTIKK |
| 50 | + </span> |
| 51 | + </Link> |
| 52 | + <div className="flex items-center space-x-3"> |
| 53 | + <AlgoliaSearchBox /> |
| 54 | + <Cart /> |
| 55 | + </div> |
| 56 | + </div> |
68 | 57 | </div> |
69 | 58 | </nav> |
70 | 59 | </header> |
|
0 commit comments