Skip to content

Commit 02721e8

Browse files
committed
fix(ui-stylus): Move demo pages into a sidebar
1 parent 212681c commit 02721e8

2 files changed

Lines changed: 48 additions & 15 deletions

File tree

packages/ui-stylus/demo/_layout.pug

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ html(lang="en")
1111
title Demo - #{currentPage.title}
1212
body
1313
.demo-header
14-
.demo-header__inner
15-
a.demo-header__title(href="index.html") Orbit UI
14+
button.demo-header__menu.ui-button-icon(type="button")
15+
i.ui-icon menu
16+
h1.demo-header__title
17+
a.demo-header__title__link(href="index.html") Orbit UI
1618

17-
each page in pages.slice(1)
18-
a.demo-header__link(
19-
href= page.slug + ".html",
19+
.demo-side-nav
20+
each page in pages.slice(1)
21+
a.demo-side-nav__link(
22+
href= page.slug + ".html",
2023
class= page.slug === currentPage.slug ? "active" : ""
2124
)= page.title
2225

@@ -28,3 +31,11 @@ html(lang="en")
2831
.demo-footer
2932
.demo-container
3033
a(href=repository)= `v ${version}`
34+
35+
script.
36+
var sideNavElm = document.querySelector('.demo-side-nav');
37+
var menuBtnElm = document.querySelector('.demo-header__menu');
38+
39+
menuBtnElm.addEventListener('click', function () {
40+
sideNavElm.classList.toggle('visible');
41+
});

packages/ui-stylus/demo/styles/_demo.styl

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,32 @@
99

1010
.demo-header {
1111
fixed(left top right)
12+
inner-space($space-xxsmall);
1213
z-index: 1000;
14+
flex();
15+
align-items: center;
1316
background: $dark;
17+
color: $light;
1418

15-
&__inner {
16-
margin: 0 auto;
17-
padding: 0 $space-medium;
18-
max-width: $container-max-width;
19+
&__menu {
20+
color: $light;
1921
}
2022

2123
&__title {
22-
padding: $space-xsmall $space-xsmall $space-xsmall 0;
24+
margin: 0;
2325
font-weight: bold;
24-
type-scale(medium)
25-
text-decoration: none;
26+
type-scale(large)
2627
}
2728

28-
&__link {
29+
&__title__link {
2930
inline-block();
3031
relative();
31-
padding: $space-xsmall;
3232
color: $light;
3333
font-weight: bold;
3434
text-decoration: none;
3535

3636
&:hover {
37-
color: rgba($light, 0.8);
37+
color: rgba($light, 0.6);
3838
}
3939

4040
&.active::after {
@@ -45,6 +45,28 @@
4545
}
4646
}
4747

48+
.demo-side-nav {
49+
fixed(left top 56px bottom);
50+
box(240px, 100%);
51+
inner-space($space-xxsmall 0)
52+
bg($gray-dark);
53+
color: $light;
54+
z-index: 1001;
55+
56+
display: none;
57+
58+
&.visible {
59+
display: block;
60+
}
61+
}
62+
63+
.demo-side-nav__link {
64+
block();
65+
inner-space($space-xxxsmall $space-small);
66+
color: inherit;
67+
text-decoration: none;
68+
}
69+
4870
.demo-content {
4971
box(cover);
5072
debug-baseline(rgba($gray, 0.2));

0 commit comments

Comments
 (0)