Skip to content

Commit f46eb40

Browse files
authored
Merge pull request #16 from imranhsayed/feature/add-menu-style
Feature/add menu style
2 parents b5fb937 + cc42a10 commit f46eb40

4 files changed

Lines changed: 71 additions & 28 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react";
2+
import Navbar from "./navbar";
3+
4+
const Header = ({ menus }) => {
5+
return (
6+
<header>
7+
<Navbar menus={ menus } />
8+
</header>
9+
)
10+
}
11+
12+
export default Header;
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import Link from "next/link";
2+
import React from "react";
3+
4+
const Navbar = ({menus}) => {
5+
return (
6+
<nav className="flex items-center justify-between flex-wrap bg-teal-500 p-6">
7+
<div className="flex items-center flex-shrink-0 text-white mr-6">
8+
<svg className="fill-current h-8 w-8 mr-2" width="54" height="54" viewBox="0 0 54 54"
9+
xmlns="http://www.w3.org/2000/svg">
10+
<path
11+
d="M13.5 22.1c1.8-7.2 6.3-10.8 13.5-10.8 10.8 0 12.15 8.1 17.55 9.45 3.6.9 6.75-.45 9.45-4.05-1.8 7.2-6.3 10.8-13.5 10.8-10.8 0-12.15-8.1-17.55-9.45-3.6-.9-6.75.45-9.45 4.05zM0 38.3c1.8-7.2 6.3-10.8 13.5-10.8 10.8 0 12.15 8.1 17.55 9.45 3.6.9 6.75-.45 9.45-4.05-1.8 7.2-6.3 10.8-13.5 10.8-10.8 0-12.15-8.1-17.55-9.45-3.6-.9-6.75.45-9.45 4.05z"/>
12+
</svg>
13+
<Link href="/">
14+
<a>
15+
<span className="font-semibold text-xl tracking-tight">Next.js WordPress Theme</span>
16+
</a>
17+
</Link>
18+
</div>
19+
<div className="block lg:hidden">
20+
<button
21+
className="flex items-center px-3 py-2 border rounded text-teal-200 border-teal-400 hover:text-white hover:border-white">
22+
<svg className="fill-current h-3 w-3" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
23+
<title>Menu</title>
24+
<path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"/>
25+
</svg>
26+
</button>
27+
</div>
28+
<div className="w-full block flex-grow lg:flex lg:items-center lg:w-auto">
29+
<div className="text-sm lg:flex-grow">
30+
{(menus || []).map((menu, index) => {
31+
const path = menu.node.path;
32+
const href = "[...slug]";
33+
return (
34+
<Link key={menu?.node?.id ?? ""} href={href} as={path}>
35+
<a className="block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-white mr-4">
36+
{menu.node.label}
37+
</a>
38+
</Link>
39+
);
40+
})}
41+
</div>
42+
<div>
43+
<Link href="/blog">
44+
<a className="inline-block text-sm px-4 py-2 leading-none border rounded text-white border-white hover:border-transparent hover:text-teal-500 hover:bg-white mt-4 lg:mt-0">Blog</a>
45+
</Link>
46+
</div>
47+
</div>
48+
</nav>
49+
)
50+
}
51+
52+
export default Navbar;

frontend/src/components/layout/index.js

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,12 @@
11
import React from "react";
22
import Link from "next/link";
3+
import Header from "../header";
34

45
const Layout = ({ menus, children }) => {
56

67
return (
78
<div>
8-
<header>
9-
<div
10-
style={{
11-
display: "flex",
12-
justifyContent: "center",
13-
marginTop: "50px",
14-
}}
15-
>
16-
{(menus || []).map((menu) => {
17-
const path = menu.node.path;
18-
const href = "[...slug]";
19-
return (
20-
<Link key={menu?.node?.id ?? ""} href={href} as={path}>
21-
<a
22-
style={{
23-
fontSize: "18px",
24-
color: "blue",
25-
textDecoration: "none",
26-
marginRight: "10px",
27-
}}
28-
>
29-
{menu.node.label}
30-
</a>
31-
</Link>
32-
);
33-
})}
34-
</div>
35-
</header>
9+
<Header menus={ menus }/>
3610
{children}
3711
</div>
3812
);

frontend/src/styles/index.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@
55

66
// NProgress style.
77
@import 'nprogress/nprogress.css';
8+
9+
#nprogress .bar {
10+
background-color: #fff;
11+
}
12+

0 commit comments

Comments
 (0)