File tree Expand file tree Collapse file tree 3 files changed +66
-2
lines changed Expand file tree Collapse file tree 3 files changed +66
-2
lines changed Original file line number Diff line number Diff line change 1
- type NavLinkItem = [
1
+ import './styles.css' ;
2
+
3
+ type LinkItem = [
2
4
name : string ,
3
5
path : string ,
4
6
]
5
7
6
- const navLinks : NavLinkItem [ ] = [
8
+ const navLinks : LinkItem [ ] = [
7
9
[ 'Side Quests' , '/projects' ] ,
8
10
[ 'About' , '/about' ] ,
9
11
[ 'Logs' , '/logs' ] ,
10
12
[ 'Contact' , '/contact' ] ,
11
13
]
12
14
15
+ //-----------------------------------------------------------------------
16
+
13
17
export function buildTopNav ( ) {
14
18
const navBox = document . createElement ( "div" ) ;
15
19
const ul = document . createElement ( "ul" ) ;
16
20
21
+ navBox . id = "top-nav" ;
22
+
23
+ navLinks . forEach ( link => {
24
+ const [ name , path ] = link ;
25
+ const li = document . createElement ( "li" ) ;
26
+ const a = document . createElement ( "a" ) ;
17
27
28
+ a . href = path ;
29
+ a . textContent = name ;
18
30
31
+ li . appendChild ( a ) ;
32
+ ul . appendChild ( li ) ;
33
+ } )
19
34
35
+ navBox . appendChild ( ul ) ;
36
+ return navBox
20
37
}
Original file line number Diff line number Diff line change
1
+ # top-nav {
2
+ position : fixed;
3
+ top : 40px ;
4
+ left : 50% ;
5
+ transform : translateX (-50% );
6
+ display : flex;
7
+ text-align : center;
8
+ padding : 0 50px ;
9
+ z-index : 10 ;
10
+
11
+ ul {
12
+ display : flex;
13
+ align-items : center;
14
+ justify-content : space-between;
15
+ gap : 50px ;
16
+ height : 60px ;
17
+ margin : 0 ;
18
+ padding : 0 35px ;
19
+ list-style : none;
20
+
21
+ border : 2px solid rgba (255 , 255 , 255 , 0.1 );
22
+ border-radius : 30px ;
23
+ background-color : rgba (255 , 255 , 255 , 0.05 );
24
+
25
+ backdrop-filter : blur (30px );
26
+ -webkit-backdrop-filter : blur (30px );
27
+ overflow : hidden;
28
+ }
29
+
30
+ li a {
31
+ font-family : "Handjet" , sans-serif;
32
+ font-size : 1.5em ;
33
+ font-weight : 500 ;
34
+ text-transform : lowercase;
35
+ text-decoration : none;
36
+ color : # ffffff ;
37
+ cursor : pointer;
38
+ transition : color 0.3s ease;
39
+
40
+ & : hover {
41
+ color : # 3BFFC5 ;
42
+ }
43
+ }
44
+ }
Original file line number Diff line number Diff line change 1
1
import { buildMainLogo } from "./components/logo" ;
2
2
import { router } from "./core/router" ;
3
3
import { homeView , buildViewBase , renderView } from "./views" ;
4
+ import { buildTopNav } from "./components/top-nav" ;
4
5
5
6
6
7
const routes = [
@@ -15,8 +16,10 @@ function init() {
15
16
const body = document . getElementsByTagName ( "body" ) [ 0 ] ;
16
17
const contentPage = buildViewBase ( ) ;
17
18
const mainLogo = buildMainLogo ( ) ;
19
+ const nav = buildTopNav ( ) ;
18
20
19
21
body . appendChild ( mainLogo ) ;
22
+ body . appendChild ( nav ) ;
20
23
body . appendChild ( contentPage ) ;
21
24
22
25
You can’t perform that action at this time.
0 commit comments