-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
95 lines (86 loc) · 3.02 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<head>
<head>
<title>side-menu demo</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2.0.0/webcomponents-loader.js"></script>
<script type="module">
import "./side-menu.js"
import "./side-menu-item.js"
</script>
<style type="text/css">
#drawer {
min-width: 15rem;
height: 100%;
box-shadow: 0 2px 4px -1px hsla(214, 53%, 23%, 0.16), 0 3px 12px -1px hsla(214, 50%, 22%, 0.26);
padding: 5px;
display: flex;
flex-direction: column;
justify-content: space-between;
position:fixed;
top: 0;
left: 0;
}
#drawer.collapsed {
min-width: 0;
}
#toggleIcon{
margin-bottom: 10px;
cursor: pointer;
align-self: center;
color: rgb(235, 89, 5);
}
</style>
</head>
<body>
<div id="drawer">
<side-menu id="menu">
<side-menu-item label="Home">
<iron-icon icon="home" slot="icon"></iron-icon>
</side-menu-item>
<side-menu-item label="Accounts">
<iron-icon icon="account-circle" slot="icon"></iron-icon>
</side-menu-item>
<side-menu-item label="Assignments">
<iron-icon icon="assignment-turned-in" slot="icon"></iron-icon>
</side-menu-item>
<side-menu-item label="Timeline">
<iron-icon icon="timeline" slot="icon"></iron-icon>
</side-menu-item>
<side-menu-item label="Favorites">
<iron-icon icon="favorite" slot="icon"></iron-icon>
<side-menu-item label="Learn">
<side-menu-item
label="How to"
href="https://www.w3schools.com/howto/"
target="_blank"
></side-menu-item>
</side-menu-item>
<side-menu-item
label="Web Components"
href="https://www.webcomponents.org/"
target="_blank"
></side-menu-item>
<side-menu-item label="Guides" href="guides"></side-menu-item>
<side-menu-item label="Colors" href="colors"></side-menu-item>
</side-menu-item>
</side-menu>
<iron-icon id="toggleIcon" icon="chevron-left"></iron-icon>
</div>
<script>
const toggleIcon = document.getElementById("toggleIcon");
const menu = document.getElementById("menu");
const drawer = document.getElementById("drawer");
toggleIcon.addEventListener("click", () => {
menu.compact = !menu.compact;
if (menu.compact) {
drawer.classList.add("collapsed");
toggleIcon['icon']='chevron-right';
} else {
drawer.classList.remove("collapsed");
toggleIcon['icon']='chevron-left';
}
});
</script>
</body>