Skip to content

Commit ecd6c73

Browse files
committed
Improve design
1 parent 4ea03b6 commit ecd6c73

File tree

5 files changed

+62
-10
lines changed

5 files changed

+62
-10
lines changed

components/AlgoliaSearch/MobileSearch.component.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { useState } from 'react';
55
import SearchResults from './SearchResults.component';
66

77
const searchClient = algoliasearch(
8-
process.env.ALGOLIA_APP_ID,
9-
process.env.ALGOLIA_PUBLIC_API_KEY
8+
process.env.NEXT_PUBLIC_ALGOLIA_APP_ID,
9+
process.env.NEXT_PUBLIC_ALGOLIA_PUBLIC_API_KEY
1010
);
1111

1212
/**
@@ -16,7 +16,7 @@ const MobileSearch = () => {
1616
const [search, setSearch] = useState(null);
1717
const [hasFocus, sethasFocus] = useState(false);
1818
return (
19-
<div className="inline mt-4">
19+
<div className="inline mt-4 md:hidden">
2020
<InstantSearch
2121
indexName={process.env.NEXT_PUBLIC_ALGOLIA_INDEX_NAME}
2222
searchClient={searchClient}

components/Cart/Cart.component.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const Cart = () => {
1818
<>
1919
<Link href="/handlekurv">
2020
<a
21-
className="inline-block pl-4 mt-4 no-underline"
21+
className="pl-4 mt-4 no-underline inline-block"
2222
aria-label="Handlekurv"
2323
>
2424
<svg
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import Link from 'next/link';
2+
3+
import Cart from '../Cart/Cart.component';
4+
import Search from '../AlgoliaSearch/AlgoliaSearchBox.component';
5+
import SVGMobileSearchIcon from '../SVG/SVGMobileSearchIcon.component';
6+
7+
import Hamburger from '../Header/Hamburger.component';
8+
9+
/**
10+
* Navigation for the application.
11+
* Includes mobile menu.
12+
*/
13+
const Stickynav = () => (
14+
<nav
15+
id="footer"
16+
className="fixed bottom-0 z-50 w-full py-1 bg-white md:hidden lg:hidden xl:hidden"
17+
>
18+
<div className="container flex flex-wrap items-center justify-between px-6 py-3 mx-auto mt-0 md:min-w-96">
19+
<Hamburger />
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="flex items-center order-2 md:order-3" id="nav-content">
42+
<Search />
43+
<SVGMobileSearchIcon />
44+
<Cart />
45+
</div>
46+
</div>
47+
</nav>
48+
);
49+
50+
export default Stickynav;

components/Header/Navbar.component.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@ import Link from 'next/link';
22

33
import Cart from '../Cart/Cart.component';
44
import Search from '../AlgoliaSearch/AlgoliaSearchBox.component';
5-
import SVGMobileSearchIcon from '../SVG/SVGMobileSearchIcon.component';
5+
import MobileSearch from '../AlgoliaSearch/MobileSearch.component';
6+
67

7-
import Hamburger from './Hamburger.component';
88

99
/**
1010
* Navigation for the application.
1111
* Includes mobile menu.
1212
*/
1313
const Navbar = () => (
1414
<header>
15-
<nav id="header" className="fixed top-0 z-50 w-full py-1 bg-white ">
15+
<nav id="header" className="top-0 z-50 w-full py-1 bg-white ">
1616
<div className="container flex flex-wrap items-center justify-between px-6 py-3 mx-auto mt-0 md:min-w-96">
17-
<Hamburger />
18-
1917
<div
2018
className="order-3 hidden w-full md:flex md:items-center md:w-auto md:order-1"
2119
id="menu"
@@ -59,7 +57,9 @@ const Navbar = () => (
5957
</div>
6058
<div className="flex items-center order-2 md:order-3" id="nav-content">
6159
<Search />
62-
<SVGMobileSearchIcon />
60+
61+
<MobileSearch />
62+
6363
<Cart />
6464
</div>
6565
</div>

pages/_app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Router from 'next/router';
55
import NProgress from 'nprogress';
66

77
import Footer from 'components/Footer/Footer.component';
8+
import Stickynav from 'components/Footer/Stickynav.component';
89

910
import 'styles/index.css';
1011
import 'styles/animate.min.css';
@@ -21,6 +22,7 @@ const App = ({ Component, pageProps }) => (
2122
<AppProvider>
2223
<Component {...pageProps} />
2324
<Footer />
25+
<Stickynav />
2426
</AppProvider>
2527
</ApolloProvider>
2628
);

0 commit comments

Comments
 (0)