Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
]
}
}
}
}
10 changes: 0 additions & 10 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@
</nav>

<div class="sidebar-bottom d-flex flex-wrap align-items-center w-100">
{% unless site.theme_mode %}
<button type="button" class="btn btn-link nav-link" aria-label="Switch Mode" id="mode-toggle">
<i class="fas fa-adjust"></i>
</button>

{% if site.data.contact.size > 0 %}
<span class="icon-border"></span>
{% endif %}
{% endunless %}

{% for entry in site.data.contact %}
{% case entry.type %}
{% when 'github', 'twitter' %}
Expand Down
67 changes: 49 additions & 18 deletions _includes/topbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,55 @@
{{- site.data.locales[include.lang].layout[page.layout] | default: page.layout | capitalize -}}
{% endif %}
</div>
{% comment %} Container for buttons {% endcomment %}
<div class="d-flex">
{% unless site.theme_mode %}
<button
type="button"
class="btn btn-link nav-link"
aria-label="Switch Mode"
id="mode-toggle"
onClick="iconSwap()"
>
{% comment %} <i class="fas fa-adjust"></i> {% endcomment %}
<i class="bi bi-brightness-high-fill"></i>
</button>
{% endunless %}
<button type="button" id="search-trigger" class="btn btn-link" aria-label="Search">
<i class="fas fa-search fa-fw"></i>
</button>

<button type="button" id="search-trigger" class="btn btn-link" aria-label="Search">
<i class="fas fa-search fa-fw"></i>
</button>

<search id="search" class="align-items-center ms-3 ms-lg-0">
<i class="fas fa-search fa-fw"></i>
<input
class="form-control"
id="search-input"
type="search"
aria-label="search"
autocomplete="off"
placeholder="{{ site.data.locales[include.lang].search.hint | capitalize }}..."
>
</search>
<button type="button" class="btn btn-link text-decoration-none" id="search-cancel">
{{- site.data.locales[include.lang].search.cancel -}}
</button>
<search id="search" class="align-items-center">
<i class="fas fa-search fa-fw"></i>
<input
class="form-control"
id="search-input"
type="search"
aria-label="search"
autocomplete="off"
placeholder="{{ site.data.locales[include.lang].search.hint | capitalize }}..."
>
</search>
<button type="button" class="btn btn-link text-decoration-none" id="search-cancel">
{{- site.data.locales[include.lang].search.cancel -}}
</button>
{% comment %} Theme button {% endcomment %}
</div>
</div>
</header>

<script>
$toggle = document.getElementById('mode-toggle');
if (Theme.visualState == 'dark') {
$toggle.innerHTML = '<i class="bi bi-brightness-high-fill"></i>';
} else if (Theme.visualState == 'light') {
$toggle.innerHTML = '<i class="bi bi-moon-stars"></i>';
}
function iconSwap() {
if (Theme.visualState == 'dark') {
$toggle.innerHTML = '<i class="bi bi-moon-stars"></i>';
} else if (Theme.visualState == 'light') {
$toggle.innerHTML = '<i class="bi bi-brightness-high-fill"></i>';
}
}
</script>
4 changes: 2 additions & 2 deletions _javascript/modules/components/mode-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* Add listener for theme mode toggle
*/

const $toggle = document.getElementById('mode-toggle');

export function modeWatcher() {
const $toggle = document.getElementById('mode-toggle');
console.log('Mode watcher initialized');
if (!$toggle) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions _sass/base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@use '../abstracts/placeholders';
@use '../themes/light';
@use '../themes/dark';
@import "https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css";

:root {
font-size: 16px;
Expand Down
6 changes: 1 addition & 5 deletions _sass/layout/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,7 @@ $sidebar-display: 'sidebar-display'; /* the attribute for sidebar display */
line-height: $btn-size;
}

#mode-toggle {
@extend %button;
@extend %sidebar-links;
@extend %sidebar-link-hover;
}


.icon-border {
@extend %no-cursor;
Expand Down
4 changes: 4 additions & 0 deletions _sass/layout/_topbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
}
}

#mode-toggle {
margin-right: 1.5rem;
}

#topbar {
@extend %btn-color;

Expand Down