1
1
//Navbar toggle
2
2
const navToggle = ( ) => {
3
- const burger = document . querySelector ( '.burger' ) ;
4
- const navList = document . querySelector ( '.nav-list' ) ;
5
- const navLinks = document . querySelectorAll ( '.nav-list li' ) ;
6
-
7
- burger . addEventListener ( 'click' , ( ) => {
8
- // Toggle Navbar
9
- navList . classList . toggle ( 'active' ) ;
10
- burger . classList . toggle ( 'toggle' ) ;
11
-
12
- // Animate Links
13
- navLinks . forEach ( ( link , index ) => {
14
- if ( link . style . animation ) {
15
- link . style . animation = '' ;
16
- } else {
17
- link . style . animation = `navLinkFade 0.5s ease forwards ${ index / 7 + 0.2 } s` ;
18
- }
19
- } ) ;
3
+ const burger = document . querySelector ( '.burger' ) ;
4
+ const navList = document . querySelector ( '.nav-list' ) ;
5
+ const navLinks = document . querySelectorAll ( '.nav-list li' ) ;
6
+
7
+ burger . addEventListener ( 'click' , ( ) => {
8
+ // Toggle Navbar
9
+ navList . classList . toggle ( 'active' ) ;
10
+ burger . classList . toggle ( 'toggle' ) ;
11
+
12
+ // Animate Links
13
+ navLinks . forEach ( ( link , index ) => {
14
+ if ( link . style . animation ) {
15
+ link . style . animation = '' ;
16
+ } else {
17
+ link . style . animation = `navLinkFade 0.5s ease forwards ${
18
+ index / 7 + 0.2
19
+ } s`;
20
+ }
21
+ } ) ;
22
+ } ) ;
23
+ } ;
24
+
25
+ navToggle ( ) ;
26
+
27
+ // GitHub Projects
28
+ // ##############################################
29
+
30
+ var githubprojectsdomelement = document . getElementById ( 'githubprojects' ) ;
31
+
32
+ let githubprojects = [
33
+ {
34
+ name : 'chryz-hub/chryz-hub.github.io' ,
35
+ icon : 'description' ,
36
+ } ,
37
+ {
38
+ name : 'chryz-hub/chryz-hub.github.io' ,
39
+ icon : 'article' ,
40
+ } ,
41
+ {
42
+ name : 'chryz-hub/chryz-hub.github.io' ,
43
+ icon : 'person' ,
44
+ } ,
45
+ // Here can be added some more projets if needed
46
+ ] ;
47
+
48
+ githubprojects . forEach ( ( project ) => {
49
+ getproject ( project . name , project . icon ) ;
50
+ } ) ;
51
+
52
+ function getproject ( project , icon ) {
53
+ fetch ( `https://api.github.com/repos/${ project } ` )
54
+ . then ( ( response ) => {
55
+ return response . json ( ) ;
56
+ } )
57
+ . then ( ( project ) => {
58
+ // we add the project card directly to the html dom
59
+ githubprojectsdomelement . innerHTML += createprojectcard ( project , icon ) ;
20
60
} ) ;
21
61
}
22
62
23
- navToggle ( ) ;
63
+ function createprojectcard ( project , icon ) {
64
+ // removing github emojis cause they are not usable in html
65
+ project . description = project . description . replace ( / : [ ^ } ] * : / , '' ) ;
66
+
67
+ // TODO: add Project Card
68
+ let projectcard = `` ;
69
+ return projectcard ;
70
+ }
71
+
0 commit comments