Skip to content

Commit 14aef62

Browse files
committed
chore(ui): toggle sidebar icon on sidebar open
1 parent 2966fc1 commit 14aef62

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

_javascript/modules/layouts/sidebar.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const ATTR_DISPLAY = 'sidebar-display';
22
const $sidebar = document.getElementById('sidebar');
33
const $trigger = document.getElementById('sidebar-trigger');
4+
const $icon = $trigger.querySelector('i');
45
const $mask = document.getElementById('mask');
56

67
class SidebarUtil {
@@ -10,6 +11,8 @@ class SidebarUtil {
1011
this.#isExpanded = !this.#isExpanded;
1112
document.body.toggleAttribute(ATTR_DISPLAY, this.#isExpanded);
1213
$sidebar.classList.toggle('z-2', this.#isExpanded);
14+
$icon.classList.toggle('fa-bars', !this.#isExpanded);
15+
$icon.classList.toggle('fa-close', this.#isExpanded);
1316
$mask.classList.toggle('d-none', !this.#isExpanded);
1417
}
1518
}

0 commit comments

Comments
 (0)