Skip to content

Commit b1ddf00

Browse files
committed
restore transition for sidebar
1 parent e939b4c commit b1ddf00

4 files changed

Lines changed: 53 additions & 43 deletions

File tree

app/styles/_gist-header.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
}
9898

9999
.ember-jstree {
100+
height: calc(100% - 50px);
100101
overflow: auto;
101102
}
102103
}

app/styles/_sidebar-layout.scss

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@
2323
background-repeat: no-repeat;
2424
background-size: cover;
2525

26+
@media (min-width: $screen-md-min) {
27+
position: relative;
28+
left: 0;
29+
transition: left 0.2s ease, margin-right 0.2s ease;
30+
31+
&.sidebar-closed {
32+
left: -25rem;
33+
margin-right: -25rem;
34+
}
35+
}
36+
2637
@media (max-width: $screen-md-min) {
2738
padding: 0;
2839
width: 100%;
@@ -31,15 +42,15 @@
3142
.toggle-mobile {
3243
display: none;
3344
}
34-
35-
@media (max-width: $screen-md-min) {
45+
46+
@media (max-width: $screen-md-min) {
3647
.toggle-mobile {
3748
display: block;
3849
border: none;
3950
border-radius: 0;
4051
background-color: transparent;
4152
color: white;
42-
53+
4354
&:active:hover {
4455
background-color: transparent;
4556
color: white;
@@ -71,12 +82,12 @@
7182
right: 10px;
7283
top: 13px;
7384
}
74-
85+
7586
.dropdown-menu {
7687
.dropdown-submenu > .dropdown-menu {
7788
top: 5px !important;
7889
margin-bottom: -31px;
79-
90+
8091
@media (max-width: $screen-md-min) {
8192
left: 80px;
8293
}
@@ -117,33 +128,33 @@
117128
border: 1px solid transparent;
118129
}
119130
}
120-
131+
121132
.user-dropdown > .dropdown-toggle {
122133
padding: 0 1em 0 0;
123134
}
124-
135+
125136
.dropdown-toggle, .sign-in {
126137
height: $topbar-control-height;
127138
line-height: $topbar-control-height - 2;
128139
text-transform: uppercase;
129140
font-weight: bold;
130141
color: $bleached-orange;
131142
border: 1px solid transparent;
132-
143+
133144
&:hover, &:focus {
134145
background-color: $menu-hover-bg;
135146
}
136147
}
137-
148+
138149
.dropdown-toggle {
139150
padding: 0 1em;
140151
}
141-
152+
142153
.sign-in {
143154
cursor: pointer;
144155
padding: 0 .5em;
145156
}
146-
157+
147158
.signing-in {
148159
padding: 0 1em;
149160
height: $topbar-control-height;
@@ -161,4 +172,4 @@
161172
align-items: stretch;
162173
justify-content: stretch;
163174
}
164-
}
175+
}

app/templates/components/sidebar-layout.hbs

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
<div class="sidebar-layout" ...attributes>
2-
{{#if @isSidebarOpen}}
3-
<div class="sidebar">
4-
<button class="btn toggle-mobile" {{on "click" (fn (mut this.isMobileMenuOpen) (not this.isMobileMenuOpen))}}>
5-
{{if this.isMobileMenuOpen "Close" "Open"}} Menu
6-
</button>
2+
<div class="sidebar {{if @isSidebarOpen 'sidebar-open' 'sidebar-closed'}}">
3+
<button class="btn toggle-mobile" {{on "click" (fn (mut this.isMobileMenuOpen) (not this.isMobileMenuOpen))}}>
4+
{{if this.isMobileMenuOpen "Close" "Open"}} Menu
5+
</button>
76

8-
{{#if this.isMobileMenuOpen}}
9-
<div class="toggleable-menu">
10-
{{#if @sidebarComponent}}
11-
{{component @sidebarComponent
12-
sidebarApi=(hash
13-
showSidebar=(fn this.updateSidebar true)
14-
hideSidebar=(fn this.updateSidebar false)
15-
isSidebarOpen=@isSidebarOpen
16-
)
17-
}}
18-
{{/if}}
7+
{{#if this.isMobileMenuOpen}}
8+
<div class="toggleable-menu">
9+
{{#if @sidebarComponent}}
10+
{{component @sidebarComponent
11+
sidebarApi=(hash
12+
showSidebar=(fn this.updateSidebar true)
13+
hideSidebar=(fn this.updateSidebar false)
14+
isSidebarOpen=@isSidebarOpen
15+
)
16+
}}
17+
{{/if}}
1918

20-
<div class="menus">
21-
<hr>
22-
<UserMenu
23-
@session={{@session}}
24-
@signInViaGithub={{route-action "signInViaGithub"}}
25-
@signOut={{route-action "signOut"}}
26-
@showTwiddles={{transition-to "twiddles"}}
27-
/>
28-
</div>
19+
<div class="menus">
20+
<hr>
21+
<UserMenu
22+
@session={{@session}}
23+
@signInViaGithub={{route-action "signInViaGithub"}}
24+
@signOut={{route-action "signOut"}}
25+
@showTwiddles={{transition-to "twiddles"}}
26+
/>
2927
</div>
30-
{{/if}}
31-
</div>
32-
{{/if}}
28+
</div>
29+
{{/if}}
30+
</div>
3331

3432
<div class="content">
3533
{{yield (hash

tests/acceptance/columns-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ module('Acceptance | columns', function(hooks) {
5959
assert.ok(!urlHas('numColumns'), 'We are on the correct route for 1 columns');
6060
assert.equal(findAll(columns).length, 1, 'There are now 1 columns');
6161

62-
assert.equal(findAll('.file-tree').length, 1, "The file tree is shown");
62+
assert.equal(findAll('.sidebar-open').length, 1, "The file tree is shown");
6363
assert.ok(!urlHas('isSidebarOpen'), 'We are on the correct route when file tree is shown');
6464

6565
await click(hideFileTreeGlyph);
6666
assert.ok(urlHas('isSidebarOpen=false'), 'We are on the correct route when file tree is shown');
67-
assert.equal(findAll('.file-tree').length, 0, "The file tree is hidden");
67+
assert.equal(findAll('.sidebar-open').length, 0, "The file tree is hidden");
6868

6969
await click(showFileTreeGlyph);
70-
assert.equal(findAll('.file-tree').length, 1, "The file tree is shown");
70+
assert.equal(findAll('.sidebar-open').length, 1, "The file tree is shown");
7171
assert.ok(!urlHas('isSidebarOpen'), 'We are on the correct route when file tree is shown');
7272
});
7373

0 commit comments

Comments
 (0)