Rewrite _nav.scss (fixes #63)
Not the cleanest stylesheet but still a bit better than what it was.
This commit is contained in:
221
sass/_nav.scss
221
sass/_nav.scss
@ -53,6 +53,7 @@
|
||||
gap: 0.25rem;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
display: flex;
|
||||
@ -60,12 +61,47 @@
|
||||
list-style: none;
|
||||
|
||||
@media only screen and (max-width: 480px) {
|
||||
&:not(.circle) {
|
||||
&:not(:has(.circle)) {
|
||||
flex: 0 0 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&#home {
|
||||
a,
|
||||
summary {
|
||||
flex: 1;
|
||||
transition: var(--transition);
|
||||
border-radius: 999px;
|
||||
background-color: transparent;
|
||||
padding: 0.5rem 0.75rem;
|
||||
color: var(--fg-muted-4);
|
||||
font-weight: bold;
|
||||
line-height: 1.25;
|
||||
list-style: none;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.active {
|
||||
box-shadow: var(--edge-highlight);
|
||||
background-color: var(--primary-color-alpha);
|
||||
color: var(--primary-color);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--primary-color);
|
||||
color: var(--contrast-color);
|
||||
|
||||
.icon {
|
||||
background-color: var(--contrast-color);
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
background-color: var(--primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
#home {
|
||||
position: relative;
|
||||
margin-inline-end: 0.625rem;
|
||||
|
||||
@ -81,10 +117,6 @@
|
||||
:root[dir*="rtl"] & {
|
||||
right: unset;
|
||||
left: -0.5rem;
|
||||
|
||||
@media only screen and (max-width: 480px) {
|
||||
left: -0.125rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 480px) {
|
||||
@ -131,11 +163,11 @@
|
||||
}
|
||||
|
||||
a,
|
||||
&#search button,
|
||||
&#language-switcher summary,
|
||||
&#theme-switcher summary,
|
||||
&#theme-switcher button,
|
||||
details summary {
|
||||
#search button,
|
||||
#language-switcher summary,
|
||||
#theme-switcher summary,
|
||||
#theme-switcher button,
|
||||
summary {
|
||||
&:hover {
|
||||
box-shadow: var(--edge-highlight);
|
||||
background-color: var(--fg-muted-1);
|
||||
@ -146,47 +178,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
transition: var(--transition);
|
||||
border-radius: 999px;
|
||||
padding: 0.5rem 0.75rem;
|
||||
color: var(--fg-muted-4);
|
||||
line-height: 1.25;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
&.active {
|
||||
box-shadow: var(--edge-highlight);
|
||||
background-color: var(--primary-color-alpha);
|
||||
color: var(--primary-color);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--primary-color);
|
||||
color: var(--contrast-color);
|
||||
|
||||
.icon {
|
||||
background-color: var(--contrast-color);
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
background-color: var(--primary-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&#search button,
|
||||
&#language-switcher summary,
|
||||
&#theme-switcher summary,
|
||||
&#theme-switcher button,
|
||||
&#feed a,
|
||||
&#repo a {
|
||||
.circle {
|
||||
padding: 0.5rem 0.625rem;
|
||||
|
||||
.icon {
|
||||
@ -210,34 +202,8 @@
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
&#search .icon {
|
||||
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M6.57.063c-3.578 0-6.5 2.921-6.5 6.5 0 3.578 2.922 6.5 6.5 6.5a6.46 6.46 0 0 0 3.83-1.256l2.975 2.974c.957.938 2.363-.5 1.406-1.437l-2.96-2.961a6.46 6.46 0 0 0 1.25-3.82c0-3.579-2.923-6.5-6.5-6.5m0 2c2.5 0 4.5 2.003 4.5 4.5 0 2.5-2 4.5-4.5 4.5-2.496 0-4.5-2-4.5-4.5 0-2.497 2.004-4.5 4.5-4.5'/%3E%3C/svg%3E");
|
||||
-webkit-mask-image: var(--icon);
|
||||
mask-image: var(--icon);
|
||||
|
||||
:root[dir*="rtl"] & {
|
||||
transform: scaleX(-100%);
|
||||
}
|
||||
}
|
||||
|
||||
&#feed .icon {
|
||||
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M1.988 1.988V3c.008.547.453.984 1 .988.004-.004.008-.004.012-.004v.028A8.977 8.977 0 0 1 11.988 13a.991.991 0 0 0 1 .984h1V13h-.004c0-.004 0-.004.004-.008C13.984 7.02 9.184 2.148 3.242 2.02A1.004 1.004 0 0 0 3 1.988v-.004zm0 4V7c.008.547.453.984 1 .988.004-.004.008-.004.012-.004V8a4.985 4.985 0 0 1 4.996 4.844 1.002 1.002 0 0 0 .988 1.145c.008-.005.012-.005.016-.005v.004h.984V13H10c0-3.793-3.047-6.898-6.82-6.992 0-.004-.004-.004-.004-.004A.892.892 0 0 0 3 5.988v-.004zm2 4a1.999 1.999 0 1 0-.002 3.998 1.999 1.999 0 0 0 .002-3.998m0 0'%3E%3C/path%3E%3C/svg%3E");
|
||||
-webkit-mask-image: var(--icon);
|
||||
mask-image: var(--icon);
|
||||
|
||||
:root[dir*="rtl"] & {
|
||||
transform: scaleX(-100%);
|
||||
}
|
||||
}
|
||||
|
||||
&#repo .icon {
|
||||
// --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M5 4c-.309 0-.55.09-.75.281L.594 8l3.656 3.719c.2.191.441.281.75.281h1v-1c0-.258-.129-.527-.312-.719L3.438 8l2.25-2.281C5.87 5.527 6 5.258 6 5V4zm5 0v1c0 .258.129.527.313.719L12.563 8l-2.25 2.281c-.184.192-.313.461-.313.719v1h1c.309 0 .55-.09.75-.281L15.406 8 11.75 4.281C11.55 4.09 11.309 4 11 4z'/%3E%3C/svg%3E");
|
||||
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M8 0a1 1 0 0 0-.707.293L5.707 1.875l5.238 5.234c.176-.07.364-.109.555-.109A1.5 1.5 0 1 1 10 8.5q0-.276.102-.535L8.05 5.915v4.19a1.5 1.5 0 1 1-1-.035V4.914L4.859 2.727.293 7.293a1 1 0 0 0 0 1.414l7 7a1 1 0 0 0 1.414 0l7-7a1.007 1.007 0 0 0 0-1.414l-7-7A1 1 0 0 0 8 0m0 0'/%3E%3C/svg%3E");
|
||||
-webkit-mask-image: var(--icon);
|
||||
mask-image: var(--icon);
|
||||
}
|
||||
|
||||
details {
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex: 1;
|
||||
box-shadow: none;
|
||||
@ -245,38 +211,8 @@
|
||||
background-color: transparent;
|
||||
padding: 0;
|
||||
|
||||
summary {
|
||||
transition: var(--transition);
|
||||
border-radius: 999px;
|
||||
background-color: transparent;
|
||||
padding: 0.5rem 0.75rem;
|
||||
color: var(--fg-muted-4);
|
||||
font-weight: bold;
|
||||
line-height: 1.25;
|
||||
list-style: none;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
|
||||
&::marker,
|
||||
&::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.icon.arrow {
|
||||
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='m2.293 6.707 5 5a1 1 0 0 0 1.414 0l5-5a1 1 0 1 0-1.414-1.414L8 9.586 3.707 5.293a1 1 0 1 0-1.414 1.414m0 0'/%3E%3C/svg%3E");
|
||||
-webkit-mask-image: var(--icon);
|
||||
vertical-align: -0.125em;
|
||||
mask-image: var(--icon);
|
||||
transition: var(--transition);
|
||||
margin-inline-end: 0.25rem;
|
||||
background-color: var(--fg-muted-4);
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
&[open] {
|
||||
.icon.arrow {
|
||||
.arrow {
|
||||
transform: scaleY(-100%);
|
||||
}
|
||||
|
||||
@ -292,11 +228,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
summary {
|
||||
|
||||
&::marker,
|
||||
&::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='m2.293 6.707 5 5a1 1 0 0 0 1.414 0l5-5a1 1 0 1 0-1.414-1.414L8 9.586 3.707 5.293a1 1 0 1 0-1.414 1.414m0 0'/%3E%3C/svg%3E");
|
||||
-webkit-mask-image: var(--icon);
|
||||
vertical-align: -0.125em;
|
||||
mask-image: var(--icon);
|
||||
transition: var(--transition);
|
||||
margin-inline-end: 0.25rem;
|
||||
background-color: var(--fg-muted-4);
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
-webkit-backdrop-filter: var(--blur);
|
||||
text-wrap: nowrap;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
flex-direction: column;
|
||||
transform: translate(-50%, 1rem);
|
||||
z-index: 1;
|
||||
backdrop-filter: var(--blur);
|
||||
@ -322,20 +278,44 @@
|
||||
}
|
||||
}
|
||||
|
||||
&#language-switcher .icon {
|
||||
#search .icon {
|
||||
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M6.57.063c-3.578 0-6.5 2.921-6.5 6.5 0 3.578 2.922 6.5 6.5 6.5a6.46 6.46 0 0 0 3.83-1.256l2.975 2.974c.957.938 2.363-.5 1.406-1.437l-2.96-2.961a6.46 6.46 0 0 0 1.25-3.82c0-3.579-2.923-6.5-6.5-6.5m0 2c2.5 0 4.5 2.003 4.5 4.5 0 2.5-2 4.5-4.5 4.5-2.496 0-4.5-2-4.5-4.5 0-2.497 2.004-4.5 4.5-4.5'/%3E%3C/svg%3E");
|
||||
-webkit-mask-image: var(--icon);
|
||||
mask-image: var(--icon);
|
||||
|
||||
:root[dir*="rtl"] & {
|
||||
transform: scaleX(-100%);
|
||||
}
|
||||
}
|
||||
|
||||
#feed .icon {
|
||||
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M1.988 1.988V3c.008.547.453.984 1 .988.004-.004.008-.004.012-.004v.028A8.977 8.977 0 0 1 11.988 13a.991.991 0 0 0 1 .984h1V13h-.004c0-.004 0-.004.004-.008C13.984 7.02 9.184 2.148 3.242 2.02A1.004 1.004 0 0 0 3 1.988v-.004zm0 4V7c.008.547.453.984 1 .988.004-.004.008-.004.012-.004V8a4.985 4.985 0 0 1 4.996 4.844 1.002 1.002 0 0 0 .988 1.145c.008-.005.012-.005.016-.005v.004h.984V13H10c0-3.793-3.047-6.898-6.82-6.992 0-.004-.004-.004-.004-.004A.892.892 0 0 0 3 5.988v-.004zm2 4a1.999 1.999 0 1 0-.002 3.998 1.999 1.999 0 0 0 .002-3.998m0 0'%3E%3C/path%3E%3C/svg%3E");
|
||||
-webkit-mask-image: var(--icon);
|
||||
mask-image: var(--icon);
|
||||
|
||||
:root[dir*="rtl"] & {
|
||||
transform: scaleX(-100%);
|
||||
}
|
||||
}
|
||||
|
||||
#repo .icon {
|
||||
// --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M5 4c-.309 0-.55.09-.75.281L.594 8l3.656 3.719c.2.191.441.281.75.281h1v-1c0-.258-.129-.527-.312-.719L3.438 8l2.25-2.281C5.87 5.527 6 5.258 6 5V4zm5 0v1c0 .258.129.527.313.719L12.563 8l-2.25 2.281c-.184.192-.313.461-.313.719v1h1c.309 0 .55-.09.75-.281L15.406 8 11.75 4.281C11.55 4.09 11.309 4 11 4z'/%3E%3C/svg%3E");
|
||||
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M8 0a1 1 0 0 0-.707.293L5.707 1.875l5.238 5.234c.176-.07.364-.109.555-.109A1.5 1.5 0 1 1 10 8.5q0-.276.102-.535L8.05 5.915v4.19a1.5 1.5 0 1 1-1-.035V4.914L4.859 2.727.293 7.293a1 1 0 0 0 0 1.414l7 7a1 1 0 0 0 1.414 0l7-7a1.007 1.007 0 0 0 0-1.414l-7-7A1 1 0 0 0 8 0m0 0'/%3E%3C/svg%3E");
|
||||
-webkit-mask-image: var(--icon);
|
||||
mask-image: var(--icon);
|
||||
}
|
||||
|
||||
#language-switcher .icon {
|
||||
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M3.98 1v3H1v2h2.947a4.8 4.8 0 0 1-.592 1.871c-.425.758-1.101 1.488-2.062 2.45l1.414 1.413c.92-.92 1.703-1.728 2.283-2.697.38.632.844 1.196 1.377 1.768l.668-2.309a6 6 0 0 1-.41-.625A4.75 4.75 0 0 1 6.033 6h1.53l.511-2H6V1zm5.24 1L6 15h2l.781-3h4.438L14 15h2L12.781 2zm1.562 2h.438l1.5 6H9.28z'/%3E%3C/svg%3E");
|
||||
-webkit-mask-image: var(--icon);
|
||||
mask-image: var(--icon);
|
||||
}
|
||||
|
||||
&#theme-switcher {
|
||||
#theme-switcher {
|
||||
ul {
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
border-radius: 999px;
|
||||
|
||||
li {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
#theme-system .icon,
|
||||
@ -368,8 +348,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#search-container {
|
||||
transform: translateY(-2.75rem);
|
||||
@ -386,6 +364,7 @@
|
||||
height: 2.75rem;
|
||||
pointer-events: all;
|
||||
}
|
||||
}
|
||||
|
||||
#search-bar {
|
||||
box-shadow: var(--edge-highlight);
|
||||
@ -445,8 +424,7 @@
|
||||
|
||||
div {
|
||||
margin-block-start: 0.5rem;
|
||||
border-block-start: max(1px, 0.0625rem) solid
|
||||
var(--fg-muted-2);
|
||||
border-block-start: max(1px, 0.0625rem) solid var(--fg-muted-2);
|
||||
padding-block-start: 0.25rem;
|
||||
color: var(--fg-muted-5);
|
||||
|
||||
@ -457,4 +435,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
{#- Based on https://github.com/welpo/tabi/blob/main/templates/partials/language_switcher.html -#}
|
||||
|
||||
<li id="language-switcher" class="circle">
|
||||
<li id="language-switcher">
|
||||
<details>
|
||||
<summary title="{{ macros_translate::translate(key='language', default='Language', language_strings=language_strings) }}">
|
||||
<summary class="circle" title="{{ macros_translate::translate(key='language', default='Language', language_strings=language_strings) }}">
|
||||
<i class="icon"></i>
|
||||
</summary>
|
||||
<ul>
|
||||
|
@ -69,8 +69,8 @@
|
||||
{%- endif %}
|
||||
{%- endfor -%}
|
||||
{%- if config.build_search_index %}
|
||||
<li id="search" class="circle">
|
||||
<button onclick="toggleSearch()" title="{{ macros_translate::translate(key='search', default='Search', language_strings=language_strings) }}">
|
||||
<li id="search">
|
||||
<button class="circle" onclick="toggleSearch()" title="{{ macros_translate::translate(key='search', default='Search', language_strings=language_strings) }}">
|
||||
<i class="icon"></i>
|
||||
</button>
|
||||
</li>
|
||||
@ -79,24 +79,24 @@
|
||||
{%- include "partials/language_switcher.html" %}
|
||||
{%- endif -%}
|
||||
{%- if config.extra.nav.show_theme_switcher %}
|
||||
<li id="theme-switcher" class="circle">
|
||||
<li id="theme-switcher">
|
||||
<details>
|
||||
<summary title="{{ macros_translate::translate(key='theme', default='Theme', language_strings=language_strings) }}">
|
||||
<summary class="circle" title="{{ macros_translate::translate(key='theme', default='Theme', language_strings=language_strings) }}">
|
||||
<i class="icon"></i>
|
||||
</summary>
|
||||
<ul>
|
||||
<li>
|
||||
<button id="theme-light" onclick="switchTheme('light')" title="{{ macros_translate::translate(key='theme_light', default='Switch to light theme', language_strings=language_strings) }}">
|
||||
<button class="circle" id="theme-light" onclick="switchTheme('light')" title="{{ macros_translate::translate(key='theme_light', default='Switch to light theme', language_strings=language_strings) }}">
|
||||
<i class="icon"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button id="theme-dark" onclick="switchTheme('dark')" title="{{ macros_translate::translate(key='theme_dark', default='Switch to dark theme', language_strings=language_strings) }}">
|
||||
<button class="circle" id="theme-dark" onclick="switchTheme('dark')" title="{{ macros_translate::translate(key='theme_dark', default='Switch to dark theme', language_strings=language_strings) }}">
|
||||
<i class="icon"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button id="theme-system" onclick="switchTheme('system')" title="{{ macros_translate::translate(key='theme_system', default='Use system theme', language_strings=language_strings) }}">
|
||||
<button class="circle" id="theme-system" onclick="switchTheme('system')" title="{{ macros_translate::translate(key='theme_system', default='Use system theme', language_strings=language_strings) }}">
|
||||
<i class="icon"></i>
|
||||
</button>
|
||||
</li>
|
||||
@ -105,15 +105,15 @@
|
||||
</li>
|
||||
{%- endif %}
|
||||
{%- if config.generate_feeds and config.extra.nav.show_feed %}
|
||||
<li id="feed" class="circle">
|
||||
<a href="{{ get_url(path=config.feed_filenames[0], lang=lang) }}" title="{{ macros_translate::translate(key='feed', default='Feed', language_strings=language_strings) }}">
|
||||
<li id="feed">
|
||||
<a class="circle" href="{{ get_url(path=config.feed_filenames[0], lang=lang) }}" title="{{ macros_translate::translate(key='feed', default='Feed', language_strings=language_strings) }}">
|
||||
<i class="icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif %}
|
||||
{%- if config.extra.source_url and config.extra.nav.show_repo %}
|
||||
<li id="repo" class="circle">
|
||||
<a href="{{ config.extra.source_url }}" title="{{ macros_translate::translate(key='repo', default='Repository', language_strings=language_strings) }}">
|
||||
<li id="repo">
|
||||
<a class="circle" href="{{ config.extra.source_url }}" title="{{ macros_translate::translate(key='repo', default='Repository', language_strings=language_strings) }}">
|
||||
<i class="icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
Reference in New Issue
Block a user