Skip to content

Commit aa4b151

Browse files
authored
Make bigpicture more mobile friendly (#3889)
1 parent 9dba0f9 commit aa4b151

File tree

3 files changed

+111
-34
lines changed

3 files changed

+111
-34
lines changed

esp/esp/themes/theme_data/bigpicture/less/main.less

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,13 @@ body {
8080
}
8181
.container {
8282
margin: 0 auto;
83-
width: 1180px;
8483
}
8584
body, .jumbotron {
8685
box-sizing: border-box;
87-
min-width: 940px;
86+
width: 100%;
8887
}
8988
.header-cell {
90-
display: table-cell;
89+
display: inline-block;
9190
vertical-align: bottom;
9291
}
9392

@@ -107,7 +106,7 @@ div.nav-collapse.collapse {
107106

108107
.sidebar {
109108
& {
110-
color: @navbarText;
109+
color: @navbarText;
111110
background: @sidebarBackground;
112111
margin-bottom: 2em;
113112
}
@@ -122,7 +121,7 @@ div.nav-collapse.collapse {
122121
&, &:hover {
123122
color: @sidebarActive;
124123
background-color: @sidebarActiveBackground;
125-
}
124+
}
126125
}
127126
> li > a {
128127
padding: 8px 18px;
@@ -141,6 +140,44 @@ div.nav-collapse.collapse {
141140
}
142141
}
143142

143+
#nav_accordion {
144+
& {
145+
border-radius: 4px;
146+
}
147+
.accordion-heading {
148+
& a {
149+
color: @sidebarLink;
150+
font-size: 17px;
151+
&:active, &:hover, &:focus {
152+
text-decoration: none;
153+
}
154+
}
155+
}
156+
.accordion-body {
157+
.sidebar {
158+
margin-bottom: 0px;
159+
border-top: white 1px solid;
160+
}
161+
}
162+
}
163+
164+
@media (max-width: 767px) {
165+
#nav_sidebar {
166+
display: none;
167+
}
168+
#nav_accordion {
169+
display: block;
170+
}
171+
}
172+
173+
@media (min-width: 768px) {
174+
#nav_sidebar {
175+
display: block;
176+
}
177+
#nav_accordion {
178+
display: none;
179+
}
180+
}
144181

145182
.btn:hover {
146183
background-position: 0;
@@ -204,7 +241,7 @@ div.nav-collapse.collapse {
204241

205242

206243
.logo {
207-
max-width: 300px;
244+
max-width: ~"min(100%, 300px)";
208245
max-height: 300px;
209246
margin: 0 80px 0 0;
210247
}

esp/esp/themes/theme_data/bigpicture/templates/main.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@
8080
<div class="row">
8181
{% block sidebar %}
8282
<div id="sidebar" class="span3">
83-
<ul class="nav nav-list sidebar">
84-
{% include "sidebar/nav.html" %}
85-
{% include "sidebar/admin.html" %}
86-
</ul>
83+
{% include "sidebar/nav.html" %}
84+
{% include "sidebar/admin.html" %}
8785

8886
{% load preview %}
8987
{% if request.path == "/teach/index.html" %}
Lines changed: 66 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,68 @@
1-
{% for section in theme.nav_structure %}
2-
{% if section.header %}
3-
<li class="nav-header">
4-
{# links on headers are optional #}
5-
{% if section.header_link %}
6-
<a href="{{section.header_link}}">
7-
{% endif %}
8-
{{section.header}}
9-
{% if section.header_link %}
10-
</a>
1+
<ul class="nav nav-list sidebar" id="nav_sidebar">
2+
{% for section in theme.nav_structure %}
3+
{% if section.header %}
4+
<li class="nav-header">
5+
{# links on headers are optional #}
6+
{% if section.header_link %}
7+
<a href="{{section.header_link}}">
8+
{% endif %}
9+
{{section.header}}
10+
{% if section.header_link %}
11+
</a>
12+
{% endif %}
13+
</li>
1114
{% endif %}
12-
</li>
13-
{% endif %}
1415

15-
{% for item in section.links %}
16-
{# TODO(benkraft): allow adding classes to items so we can do logged-in only #}
17-
<li>
18-
<a href="{{item.link}}">
19-
{% if item.icon %}
20-
<i class="glyphicon glyphicon-{{item.icon}}"></i>
21-
{% endif %}
22-
{{item.text}}
23-
</a>
24-
</li>
25-
{% endfor %}
26-
{% endfor %}
16+
{% for item in section.links %}
17+
{# TODO(benkraft): allow adding classes to items so we can do logged-in only #}
18+
<li>
19+
<a href="{{item.link}}">
20+
{% if item.icon %}
21+
<i class="glyphicon glyphicon-{{item.icon}}"></i>
22+
{% endif %}
23+
{{item.text}}
24+
</a>
25+
</li>
26+
{% endfor %}
27+
{% endfor %}
28+
</ul>
29+
30+
<div class="accordion sidebar" id="nav_accordion">
31+
<div class="accordion-group">
32+
<div class="accordion-heading">
33+
<a class="accordion-toggle" data-toggle="collapse" data-parent="#nav_accordion" href="#collapseOne">
34+
<i class="glyphicon glyphicon-menu-hamburger"></i> Navigation
35+
</a>
36+
</div>
37+
<div id="collapseOne" class="accordion-body collapse">
38+
<ul class="nav nav-list sidebar">
39+
{% for section in theme.nav_structure %}
40+
{% if section.header %}
41+
<li class="nav-header">
42+
{# links on headers are optional #}
43+
{% if section.header_link %}
44+
<a href="{{section.header_link}}">
45+
{% endif %}
46+
{{section.header}}
47+
{% if section.header_link %}
48+
</a>
49+
{% endif %}
50+
</li>
51+
{% endif %}
52+
53+
{% for item in section.links %}
54+
{# TODO(benkraft): allow adding classes to items so we can do logged-in only #}
55+
<li>
56+
<a href="{{item.link}}">
57+
{% if item.icon %}
58+
<i class="glyphicon glyphicon-{{item.icon}}"></i>
59+
{% endif %}
60+
{{item.text}}
61+
</a>
62+
</li>
63+
{% endfor %}
64+
{% endfor %}
65+
</ul>
66+
</div>
67+
</div>
68+
</div>

0 commit comments

Comments
 (0)