File tree Expand file tree Collapse file tree 4 files changed +66
-7
lines changed Expand file tree Collapse file tree 4 files changed +66
-7
lines changed Original file line number Diff line number Diff line change 1
1
.page-with-menu {
2
2
$margin-top : 24px ;
3
+ $sidebar-width : 250px ;
3
4
4
5
display : grid ;
5
6
grid-gap : 24px ;
9
10
10
11
@media #{$bp-tablet-landscape-up } {
11
12
margin-top : $margin-top ;
12
- grid-template-columns : 250 px 1fr ;
13
+ grid-template-columns : $sidebar-width 1fr ;
13
14
grid-template-areas : ' menu content' ;
14
15
}
15
16
28
29
29
30
position : sticky ;
30
31
top : calc (var (--header-height ) + #{$margin-top } );
31
- height : calc (100vh - var (--header-height ) - #{$margin-top } );
32
+ height : calc (100vh - var (--header-height ) - #{$margin-top * 2 } );
32
33
overflow-y : auto ;
33
34
padding-bottom : $margin-top ;
34
35
}
37
38
grid-area : content ;
38
39
overflow-x : hidden ;
39
40
}
41
+
42
+ & --news {
43
+ @media #{$bp-tablet-landscape-up } {
44
+ grid-template-columns : 1fr $sidebar-width ;
45
+ grid-template-areas : ' content menu' ;
46
+ }
47
+ }
40
48
}
Original file line number Diff line number Diff line change 16
16
{% endblock %}
17
17
18
18
{% block content %}
19
- < div class ="page-with-menu ">
19
+ < div class ="page-with-menu {% block page_with_menu_extra_class %}{% endblock %} ">
20
20
< div class ="page-with-menu__menu-wrapper ">
21
21
< div class ="page-with-menu__menu ">
22
22
{% block page_menu %}{% endblock %}
Original file line number Diff line number Diff line change
1
+ {% macro news_menu_row(header, max_levels, level) %}
2
+ {% set id = 'news-menu-' ~ level ~ '-' ~ header.title | slugify %}
3
+ {% set label_class = "tree-menu__label" %}
4
+ {% set total_children = header.children | length %}
5
+ {% set has_children = total_children > 0 %}
6
+ {% set show_children = has_children and level < max _levels %}
7
+
8
+ {% if show_children %}
9
+ {% set label_class = label_class ~ " tree-menu__label--with-chevron" %}
10
+ < input id="{{id}} " class ="tree-menu__state " type ="checkbox " checked >
11
+ {% endif %}
12
+
13
+ < li class ="tree-menu__item ">
14
+ < div class ="{{label_class}} ">
15
+ < a class ="tree-menu__link " href ="{{ header.permalink | safe }} "> {{ header.title }}</ a >
16
+ {% if show_children %}
17
+ < label class ="tree-menu__toggle " for ="{{id}} ">
18
+ < img class ="tree-menu__chevron " src ="/assets/icon-chevron-down.svg ">
19
+ </ label >
20
+ {% endif %}
21
+ </ div >
22
+ {% if show_children %}
23
+ < ul class ="tree-menu ">
24
+ {% for sub_header in header.children %}
25
+ {{ self::news_menu_row(header=sub_header, max_levels=max_levels, level=level + 1)}}
26
+ {% endfor %}
27
+ </ ul >
28
+ {% endif %}
29
+ </ li >
30
+ {% endmacro %}
31
+
32
+ {% macro news_menu(toc, max_levels) %}
33
+ {% if toc %}
34
+ < ul class ="tree-menu ">
35
+ {% for header in toc %}
36
+ {{ self::news_menu_row(header=header, max_levels=max_levels, level=1)}}
37
+ {% endfor %}
38
+ </ ul >
39
+ {% endif %}
40
+ {% endmacro %}
Original file line number Diff line number Diff line change 1
- {% extends "layouts/base.html" %}
1
+ {% extends "layouts/page-with-menu.html" %}
2
+ {% import "macros/news.html" as news_macros %}
2
3
3
- {% block content %}
4
- < div class ="padded-content ">
4
+ {% block page_with_menu_extra_class %}page-with-menu--news{% endblock %}
5
+
6
+ {% block page_name %}Post{% endblock %}
7
+
8
+ {% block mobile_page_menu %}
9
+ {{news_macros::news_menu(toc=page.toc, max_levels=1)}}
10
+ {% endblock %}
11
+
12
+ {% block page_menu %}
13
+ {{news_macros::news_menu(toc=page.toc, max_levels=2)}}
14
+ {% endblock %}
15
+
16
+ {% block page_content %}
5
17
< h1 class ="news-title ">
6
18
{{ page.title }}
7
19
</ h1 >
@@ -44,5 +56,4 @@ <h2 class="news-subtitle">Posted on {{ page.date | date(format="%B %d, %Y") }} b
44
56
</ div >
45
57
{% endif %}
46
58
< div class ="media-content news-content "> {{ page.content | safe }}</ div >
47
- </ div >
48
59
{% endblock content %}
You can’t perform that action at this time.
0 commit comments