Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: moved theme toggle next to search bar#2500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
vinayak19th wants to merge4 commits intocotes2020:master
base:master
Choose a base branch
Loading
fromvinayak19th:togglefix
Open
Show file tree
Hide file tree
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,4 +26,4 @@
]
}
}
}
}
10 changes: 0 additions & 10 deletions_includes/sidebar.html
View file
Open in desktop
Original file line numberDiff line numberDiff 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 %}
{%- assign url = null -%}

Expand Down
67 changes: 49 additions & 18 deletions_includes/topbar.html
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@
@use '../abstracts/placeholders';
@use '../themes/light';
@use '../themes/dark';
@import "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css";

:root {
font-size: 16px;
Expand Down
6 changes: 1 addition & 5 deletions_sass/layout/_sidebar.scss
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,10 @@
}
}

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

#topbar {
@extend %btn-color;

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp