@iroco/ui 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/NavBar.svelte +36 -14
package/package.json
CHANGED
package/src/NavBar.svelte
CHANGED
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
|
|
12
12
|
const handleClickLink = (menuItem: NavigationItem) => {
|
|
13
13
|
active = menuItem.name;
|
|
14
|
-
if (typeof menuItem.hrefOrCallback ===
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (typeof menuItem.hrefOrCallback === 'function') {
|
|
15
|
+
menuItem.hrefOrCallback();
|
|
16
|
+
return false; // to avoid calling href
|
|
17
17
|
}
|
|
18
18
|
dispatch('click_link');
|
|
19
19
|
};
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
|
-
<nav data-testid={type} class=
|
|
22
|
+
<nav data-testid={type} class="nav__{type}">
|
|
23
23
|
<button on:click class="nav__{type}__close">
|
|
24
24
|
<IconClose width="3em" height="3em" />
|
|
25
25
|
</button>
|
|
@@ -27,7 +27,12 @@
|
|
|
27
27
|
<ul class="nav__{type}__item-container">
|
|
28
28
|
{#each navigationItems as item}
|
|
29
29
|
<li class="nav__{type}__item" class:active={active === item.name}>
|
|
30
|
-
<a
|
|
30
|
+
<a
|
|
31
|
+
on:click={() => handleClickLink(item)}
|
|
32
|
+
href={typeof item.hrefOrCallback === 'string' ? item.hrefOrCallback : '#'}
|
|
33
|
+
>
|
|
34
|
+
{item.name}</a
|
|
35
|
+
>
|
|
31
36
|
</li>
|
|
32
37
|
{/each}
|
|
33
38
|
</ul>
|
|
@@ -38,7 +43,8 @@
|
|
|
38
43
|
@import '../scss/containers';
|
|
39
44
|
|
|
40
45
|
.nav {
|
|
41
|
-
&__sidebar,
|
|
46
|
+
&__sidebar,
|
|
47
|
+
&__topbar {
|
|
42
48
|
&__item {
|
|
43
49
|
text-decoration: none;
|
|
44
50
|
font-size: 0.75em;
|
|
@@ -57,9 +63,11 @@
|
|
|
57
63
|
height: 100%;
|
|
58
64
|
width: 300px;
|
|
59
65
|
position: absolute;
|
|
66
|
+
top: 4.45em;
|
|
67
|
+
left: 0;
|
|
60
68
|
overflow-x: hidden;
|
|
61
69
|
border-right: 1px solid colors.$mediumGrey;
|
|
62
|
-
&
|
|
70
|
+
&__item-container {
|
|
63
71
|
margin: 0;
|
|
64
72
|
padding: 0;
|
|
65
73
|
width: 100%;
|
|
@@ -69,6 +77,9 @@
|
|
|
69
77
|
padding: 2em;
|
|
70
78
|
border-top: 1px solid colors.$mediumGrey;
|
|
71
79
|
}
|
|
80
|
+
&__item:first-child {
|
|
81
|
+
border-top: none;
|
|
82
|
+
}
|
|
72
83
|
.active {
|
|
73
84
|
border-top: 1px solid colors.$green;
|
|
74
85
|
border-bottom: 1px solid colors.$green;
|
|
@@ -79,7 +90,8 @@
|
|
|
79
90
|
flex-grow: 1;
|
|
80
91
|
display: flex;
|
|
81
92
|
justify-content: flex-end;
|
|
82
|
-
ul,
|
|
93
|
+
ul,
|
|
94
|
+
li {
|
|
83
95
|
display: inline;
|
|
84
96
|
}
|
|
85
97
|
ul {
|
|
@@ -92,7 +104,8 @@
|
|
|
92
104
|
|
|
93
105
|
@include screen-tablet {
|
|
94
106
|
.nav {
|
|
95
|
-
&__sidebar,
|
|
107
|
+
&__sidebar,
|
|
108
|
+
&__topbar {
|
|
96
109
|
position: fixed;
|
|
97
110
|
background-color: colors.$darkBlue;
|
|
98
111
|
top: 0;
|
|
@@ -106,7 +119,8 @@
|
|
|
106
119
|
padding: 0em;
|
|
107
120
|
margin-top: 2rem;
|
|
108
121
|
}
|
|
109
|
-
ul,
|
|
122
|
+
ul,
|
|
123
|
+
li {
|
|
110
124
|
display: block;
|
|
111
125
|
}
|
|
112
126
|
&__close {
|
|
@@ -119,13 +133,21 @@
|
|
|
119
133
|
color: colors.$darkBeige;
|
|
120
134
|
}
|
|
121
135
|
}
|
|
122
|
-
|
|
136
|
+
|
|
137
|
+
&__sidebar {
|
|
138
|
+
top: 0;
|
|
139
|
+
left: 0;
|
|
140
|
+
&__item:first-child {
|
|
141
|
+
border-top: 1px solid colors.$mediumGrey;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
123
145
|
&__topbar {
|
|
124
146
|
height: 100%;
|
|
125
147
|
&__item {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
148
|
+
padding: 2em;
|
|
149
|
+
border-top: 1px solid colors.$mediumGrey;
|
|
150
|
+
}
|
|
129
151
|
}
|
|
130
152
|
}
|
|
131
153
|
}
|