Skip to content

Commit d4a7715

Browse files
authored
Fix: Add nav drawer icon override support (fixes #417) (#498)
* Set up nav drawer btn icon override * Removed drawer css icon, converted label margin css * Added new sidebar icons
1 parent f52c863 commit d4a7715

File tree

8 files changed

+28
-8
lines changed

8 files changed

+28
-8
lines changed

fonts/selection.json

100755100644
+1-1
Large diffs are not rendered by default.

fonts/vanilla.woff

100755100644
436 Bytes
Binary file not shown.

fonts/vanilla.woff2

316 Bytes
Binary file not shown.

less/_defaults/icons.less

+4
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,7 @@
272272
.icon-youku { &:before { content: "\e9eb"; } }
273273
.icon-youtube-2 { &:before { content: "\e9ec"; } }
274274
.icon-youtube { &:before { content: "\e9ed"; } }
275+
.icon-sidebar-01 { &:before { content: "\e9ee"; } }
276+
.icon-sidebar-02 { &:before { content: "\e9ef"; } }
277+
.icon-sidebar-03 { &:before { content: "\e9f0"; } }
278+
.icon-sidebar-04 { &:before { content: "\e9f1"; } }

less/core/nav.less

+2-6
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ html.is-nav-bottom #wrapper {
7878
order: -1;
7979
}
8080

81-
&.has-label-left &__btn-label {
81+
&.has-label-left .icon ~ .nav__btn-label {
8282
margin-inline-end: @icon-padding / 2;
8383
}
8484

85-
&.has-label-auto .nav__btn-label {
85+
&.has-label-auto .icon ~ .nav__btn-label {
8686
margin-inline-start: @icon-padding / 2;
8787
}
8888

@@ -111,10 +111,6 @@ html.is-nav-bottom #wrapper {
111111
&__back-btn .icon {
112112
.icon-controls-small-left;
113113
}
114-
115-
&__drawer-btn .icon {
116-
.icon-list;
117-
}
118114
}
119115

120116
// Show nav label at breakpoints

schema/config.model.schema

+9
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,15 @@
349349
"right"
350350
]
351351
}
352+
},
353+
"_iconClass": {
354+
"type": "string",
355+
"required": false,
356+
"default": "icon-list",
357+
"title": "Drawer icon class",
358+
"inputType": "Text",
359+
"validators": [],
360+
"help": "CSS class name to be applied to the drawer sidebar icon."
352361
}
353362
}
354363
},

schema/config.schema.json

+6
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@
305305
"left",
306306
"right"
307307
]
308+
},
309+
"_iconClass": {
310+
"type": "string",
311+
"title": "Drawer icon class",
312+
"description": "CSS class name to be applied to the drawer sidebar icon.",
313+
"default": "icon-list"
308314
}
309315
},
310316
"_adapt": {

templates/nav.hbs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{! make the _globals object in course.json available to this template}}
22
{{import_globals}}
3+
{{import_adapt}}
34

45
{{! All links in the nav bar should have an attribute of data-event, navigationView uses this to fire a global event}}
56
<div class="nav__inner">
@@ -20,8 +21,12 @@
2021
{{/each}}
2122

2223
<button name="drawer" class="btn-icon nav__btn nav__drawer-btn js-nav-drawer-btn is-position-{{_config._drawer._position}}" data-event="toggleDrawer" aria-expanded="false" aria-label="{{_globals._accessibility._ariaLabels.navigationDrawer}}" data-order="{{_globals._extensions._drawer._navOrder}}" data-tooltip-id="drawer">
23-
<span class="icon" aria-hidden="true"></span>
24+
{{#if _config._drawer._iconClass}}
25+
<span class="icon {{_config._drawer._iconClass}}" aria-hidden="true"></span>
26+
{{/if}}
27+
{{#if Adapt.course._navigation._showLabel}}
2428
<span class='nav__btn-label' aria-hidden="true">{{_globals._accessibility._ariaLabels.navigationDrawer}}</span>
29+
{{/if}}
2530
</button>
2631

2732
</div>

0 commit comments

Comments
 (0)