File tree Expand file tree Collapse file tree 5 files changed +40
-30
lines changed Expand file tree Collapse file tree 5 files changed +40
-30
lines changed Original file line number Diff line number Diff line change 3
3
< head id ="main ">
4
4
< title > cd-bash</ title >
5
5
< script type ="module " src ="/src/heads/default.ts "> </ script >
6
-
7
-
8
6
</ head >
9
- < body class ="home-page ">
7
+
8
+ < body >
10
9
< script type ="module " src ="/src/index.ts "> </ script >
11
10
</ body >
12
11
</ html >
Original file line number Diff line number Diff line change 1
- import './views/home-view/styles.css'
1
+ import './views/home-view/styles.css' ;
2
2
import { ProjectPage } from "./content/projects/tank" ;
3
3
import { VerticalNav } from "./components/vertical-nav" ;
4
+ import { createContentBase , renderContent } from "./views/utils" ;
4
5
5
- const nav = VerticalNav ( ) ;
6
6
7
7
function init ( ) {
8
- document . querySelector < HTMLBodyElement > ( '.home-page' ) ! . appendChild ( ProjectPage ( ) ) ;
9
- document . querySelector < HTMLBodyElement > ( '.home-page' ) ! . appendChild ( nav ) ;
8
+ createContentBase ( ) ;
10
9
10
+ const contentPage = document . getElementById ( 'content-page' )
11
+ const verticalNav = VerticalNav ( ) ;
12
+
13
+ contentPage ?. appendChild ( verticalNav ) ;
14
+
15
+ renderContent ( ProjectPage ) ;
11
16
}
12
17
13
18
init ( ) ;
Original file line number Diff line number Diff line change 1
- . home-page {
1
+ body {
2
2
background : # 141518 ;
3
3
height : 100% ;
4
4
margin : 0 ;
5
5
}
6
6
7
- .home-page . corner-triangle {
7
+ .corner-triangle {
8
8
position : absolute;
9
9
top : 0 ;
10
10
left : 0 ;
13
13
border-top : 55vh solid # 3BFFC5 ;
14
14
}
15
15
16
- .home-page . hero-visual {
16
+ .hero-visual {
17
17
position : absolute;
18
18
top : 0 ;
19
19
right : 0 ;
26
26
z-index : -1 ;
27
27
}
28
28
29
- .home-page . main-title {
29
+ .main-title {
30
30
position : relative;
31
31
}
32
32
33
- .home-page . main-title h3 {
33
+ .main-title h3 {
34
34
font-size : 12vw ;
35
35
font-family : "Cabin" , sans-serif;
36
36
color : white;
40
40
text-shadow : 0px 0px 22px black;
41
41
}
42
42
43
- .home-page . business-card {
43
+ .business-card {
44
44
position : absolute;
45
45
bottom : 10vh ;
46
46
left : 5vw ;
47
47
width : 33vw ;
48
48
}
49
49
50
- .home-page . business-card img {
50
+ .business-card img {
51
51
float : left;
52
52
width : 10vw ;
53
53
image-rendering : pixelated;
54
54
}
55
55
56
- .home-page . business-card article {
56
+ .business-card article {
57
57
float : left;
58
58
color : white;
59
59
font-family : "Handjet" , serif;
60
60
margin : 1.2vw 0 0 2vw ;
61
61
}
62
62
63
- .home-page . business-card article h2 {
63
+ .business-card article h2 {
64
64
font-size : 2vw ;
65
65
font-weight : 700 ;
66
66
margin : 0px ;
67
67
}
68
68
69
- .home-page . business-card article h1 {
69
+ .business-card article h1 {
70
70
font-size : 5vw ;
71
71
font-weight : 300 ;
72
72
margin : 0vw 0 0 0 ;
73
73
}
74
74
75
75
76
- . home-page footer {
76
+ footer {
77
77
position : fixed;
78
78
bottom : 0 ;
79
79
width : 100% ;
80
80
height : 40px ;
81
81
background : # 000 ;
82
82
}
83
83
84
- . home-page footer .logs-title {
84
+ footer .logs-title {
85
85
float : left;
86
86
background : white;
87
87
height : 100% ;
88
88
text-transform : uppercase;
89
89
}
90
90
91
- . home-page footer .logs-title h6 {
91
+ footer .logs-title h6 {
92
92
color : # 000 ;
93
93
font-family : "Handjet" , serif;
94
94
font-size : 1em ;
Original file line number Diff line number Diff line change 1
1
import {
2
- createContentPage ,
3
2
writeTitle ,
4
3
createVideoShowcase ,
5
4
writeParagraph ,
@@ -19,22 +18,22 @@ export type ProjectContent = {
19
18
20
19
21
20
export function renderProjectPage ( content : ProjectContent ) {
22
- const projectPage = createContentPage ( )
21
+ const wrapper = document . getElementById ( 'wrapper' ) ;
23
22
const projectTitle = writeTitle ( "h1" , content . name ) ;
24
23
const projectShowcase = createVideoShowcase ( content . heroVideo ) ;
25
24
const projectSubtitle = writeTitle ( "h2" , content . tagline )
26
25
27
- projectPage [ 1 ] . appendChild ( projectTitle ) ;
28
- projectPage [ 1 ] . appendChild ( projectShowcase ) ;
29
- projectPage [ 1 ] . appendChild ( projectSubtitle ) ;
26
+ wrapper ? .appendChild ( projectTitle ) ;
27
+ wrapper ? .appendChild ( projectShowcase ) ;
28
+ wrapper ? .appendChild ( projectSubtitle ) ;
30
29
31
30
content . paragraphs . forEach ( paragraph => {
32
31
const text = writeParagraph ( paragraph ) ;
33
- projectPage [ 1 ] . appendChild ( text ) ;
32
+ wrapper ? .appendChild ( text ) ;
34
33
} )
35
34
36
35
const projectGallery = createContentGallery ( content . imageGallery ) ;
37
- projectPage [ 1 ] . appendChild ( projectGallery ) ;
36
+ wrapper ? .appendChild ( projectGallery ) ;
38
37
39
- return projectPage [ 0 ] ;
38
+ return wrapper ;
40
39
}
Original file line number Diff line number Diff line change 4
4
They are mostly used when building templates.
5
5
*/
6
6
7
- export function createContentPage ( ) {
7
+ export function createContentBase ( ) {
8
8
const page = document . createElement ( 'div' ) ;
9
9
const wrapper = document . createElement ( 'div' ) ;
10
10
page . id = 'content-page' ;
11
11
wrapper . id = 'wrapper' ;
12
12
13
13
page . appendChild ( wrapper ) ;
14
- return [ page , wrapper ] ;
15
14
}
16
15
16
+ export function renderContent ( contentFn : Function ) {
17
+ const wrapper = clearWrapper ( ) ;
18
+ const content = contentFn ( ) ;
19
+
20
+ wrapper ?. appendChild ( content ) ;
21
+ }
22
+
23
+
17
24
function clearWrapper ( ) {
18
25
const cleanWrapper = document . getElementById ( 'wrapper' ) ;
19
26
cleanWrapper ?. childNodes . forEach ( ( childNode ) => {
You can’t perform that action at this time.
0 commit comments