File tree Expand file tree Collapse file tree 3 files changed +19
-24
lines changed Expand file tree Collapse file tree 3 files changed +19
-24
lines changed Original file line number Diff line number Diff line change 1
1
import Link from "next/link" ;
2
2
import { useRouter } from "next/router" ;
3
- import styles from "./NavBar.module.css" ;
4
3
5
4
export default function NavBar ( ) {
6
5
const router = useRouter ( ) ;
7
6
return (
8
7
< nav >
9
8
< Link href = "/" >
10
- < a
11
- className = { `${ styles . link } ${
12
- router . pathname === "/" ? styles . active : ""
13
- } `}
14
- >
15
- Home
16
- </ a >
9
+ < a className = { router . pathname === "/" ? "active" : "" } > Home</ a >
17
10
</ Link >
18
11
< Link href = "/about" >
19
- < a
20
- className = { [
21
- styles . link ,
22
- router . pathname === "/about" ? styles . active : "" ,
23
- ] . join ( " " ) }
24
- >
25
- About
26
- </ a >
12
+ < a className = { router . pathname === "/about" ? "active" : "" } > About</ a >
27
13
</ Link >
14
+ < style jsx > { `
15
+ nav {
16
+ background-color: tomato;
17
+ }
18
+ a {
19
+ text-decoration: none;
20
+ }
21
+ .active {
22
+ color: yellow;
23
+ }
24
+ ` } </ style >
28
25
</ nav >
29
26
) ;
30
27
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -4,7 +4,12 @@ export default function Home() {
4
4
return (
5
5
< div >
6
6
< NavBar />
7
- < h1 > Hello</ h1 >
7
+ < h1 className = "active" > Hello</ h1 >
8
+ < style jsx > { `
9
+ a {
10
+ color: white;
11
+ }
12
+ ` } </ style >
8
13
</ div >
9
14
) ;
10
15
}
You can’t perform that action at this time.
0 commit comments