Skip to content

Commit 14d4ed7

Browse files
author
Roshan Jossy
committed
update navbar
1 parent 58580a3 commit 14d4ed7

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
"ecmaVersion": 12,
1818
"sourceType": "module"
1919
},
20+
"rules": {
21+
"@next/next/no-html-link-for-pages": "off"
22+
},
2023
"plugins": ["@typescript-eslint"]
2124
}

src/components/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Button = ({ children, onClick: onClick }: ButtonProps) => {
99
return (
1010
<button
1111
type="button"
12-
className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
12+
className="text-white font-bold bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 rounded-lg text-sm px-5 py-2.5 text-center mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
1313
onClick={onClick}
1414
>
1515
{children}

src/components/navbar/Navbar.tsx

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
1-
export default function Navbar () {
2-
return( <div className="flex fixed p-4 w-full bg-blue-400 top-0 z-10">
3-
Logo
4-
<div>bu</div>
5-
</div>)
6-
}
1+
import { useRouter } from 'next/router'
2+
import React from 'react'
3+
import Button from '../Button'
4+
5+
export default function Navbar() {
6+
const router = useRouter()
7+
const { pathname } = router
8+
return (
9+
<nav className="fixed top-0 left-0 right-0 z-10 w-full h-16 bg-white p-3 shadow-sm">
10+
<div className="container m-auto flex justify-between">
11+
<a href="/">
12+
<div className="logo w-10 h-10"></div>
13+
</a>
14+
{pathname !== '/story' && (
15+
<Button>
16+
<a href="/story">
17+
<a>Create Post </a>
18+
</a>
19+
</Button>
20+
)}
21+
</div>
22+
<style jsx>{`
23+
.logo {
24+
background: url('https://avatars1.githubusercontent.com/u/65761570?s=460&u=640f39b808c75c6b86460aa907dd030bcca2f3c7&v=4');
25+
background-repeat: no-repeat;
26+
background-size: contain;
27+
}
28+
`}</style>
29+
</nav>
30+
)
31+
}

0 commit comments

Comments
 (0)