init darkmode pretty toggle

This commit is contained in:
gws 2024-11-09 20:49:46 +01:00
parent a05454e5f2
commit df35f5e736
4 changed files with 244 additions and 139 deletions

88
sass/darkmode_toggle.scss Normal file
View file

@ -0,0 +1,88 @@
:root {
--light: #d8dbe0;
--dark: #28292c;
--link: rgb(27, 129, 112);
--link-hover: rgb(24, 94, 82);
}
* {
/* padding: 0; */
/* margin: 0; */
/* box-sizing: border-box; */
}
body {
/* background-color: #cfafaf; */
/* display: flex; */
/* justify-content: center; */
/* align-items: center; */
/* height: 100vh; */
}
$diameter: 100;
.toggle-switch {
position: relative;
width: 200px;
}
label {
position: absolute;
width: 100%;
height: 100px;
background-color: var(--dark);
border-radius: 50px;
cursor: pointer;
}
input {
position: absolute;
display: none;
}
.slider {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50px;
transition: 0.3s;
}
input:checked~.slider {
background-color: var(--light);
}
.slider::before {
content: "";
position: absolute;
top: 13px;
left: 16px;
width: 75px;
height: 75px;
border-radius: 50%;
box-shadow: inset 28px -4px 0px 0px var(--light);
background-color: var(--dark);
transition: 0.3s;
}
input:checked~.slider::before {
transform: translateX(95px);
background-color: var(--dark);
box-shadow: none;
}
a {
position: relative;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
top: 150px;
left: 10px;
font-size: 10px;
text-decoration: none;
color: var(--link);
font-weight: bold;
text-align: center;
}
a:hover {
color: var(--link-hover);
}

View file

@ -42,10 +42,13 @@
<button _="on click toggle .dark on the closest <body/>"> toggle </button>
<div class='toggle-switch'>
<label>
<input type='checkbox'>
<span class='slider'></span>
</label>
</div>
</nav>
{% endmacro render_header %}

View file

@ -0,0 +1,6 @@
<div class='toggle-switch'>
<label>
<input type='checkbox'>
<span class='slider'></span>
</label>
</div>

View file

@ -5,8 +5,9 @@
<link rel="icon" href="/flat_blocks.svg" sizes="any" type="image/svg+xml">
<!-- <link rel="stylesheet" href="{{ get_url(path='carbon.css') }}"> -->
<link rel="stylesheet" href="{{ get_url(path='style.css') }}">
<!-- <link rel="stylesheet" href="{{ get_url(path='form.css') }}"> -->
<link rel="stylesheet" href="{{ get_url(path='style.css') }}">
<link rel="stylesheet" href="{{ get_url(path='darkmode_toggle.css') }}">
<link rel="stylesheet" type="text/css" href="/syntax-theme-dark.css" media="(prefers-color-scheme: dark)" />
<link rel="stylesheet" type="text/css" href="/syntax-theme-light.css" media="(prefers-color-scheme: light)" />
@ -36,149 +37,156 @@
{{ macros::render_header(path="/") }}
</header>
<div class="hero">
{% block hero %}
{% block body_tag%}
<script async defer src="https://buttons.github.io/buttons.js"></script>
<section class="text-center">
<h1 class="heading-text" style="font-size: 50px">
{{ config.extra.slogan }}
</h1>
<h3 class="title-text">
{{ section.extra.intro | safe }}
</h3>
<div>
<!-- <a class="github-button" href="https://github.com/huhu/juice" data-size="large" data-show-count="true" -->
<!-- aria-label="Star huhu/juice on GitHub">Star</a> -->
<!-- <a class="github-button" href="https://github.com/huhu/juice/fork" data-size="large" data-show-count="true" -->
<!-- aria-label="Fork huhu/juice on GitHub">Repos</a> -->
<body hx-boost="true">
{% endblock body_tag %}
<div class="hero">
{% block hero %}
<script async defer src="https://buttons.github.io/buttons.js"></script>
<section class="text-center">
<h1 class="heading-text" style="font-size: 50px">
{{ config.extra.slogan }}
</h1>
<h3 class="title-text">
{{ section.extra.intro | safe }}
</h3>
<div>
<!-- <a class="github-button" href="https://github.com/huhu/juice" data-size="large" data-show-count="true" -->
<!-- aria-label="Star huhu/juice on GitHub">Star</a> -->
<!-- <a class="github-button" href="https://github.com/huhu/juice/fork" data-size="large" data-show-count="true" -->
<!-- aria-label="Fork huhu/juice on GitHub">Repos</a> -->
</div>
</section>
<img class="hero-image" style="width: 50%" src="{{ get_url(path='build-blocks.svg') }}">
<div class="explore-more text" onclick="document.getElementById('features').scrollIntoView({behavior: 'smooth'})">
Explore More ⇩
</div>
</section>
<img class="hero-image" style="width: 50%" src="{{ get_url(path='build-blocks.svg') }}">
<div class="explore-more text" onclick="document.getElementById('features').scrollIntoView({behavior: 'smooth'})">
Explore More ⇩
</div>
<style>
.hero section {
padding: 0 5rem;
}
@media screen and (max-width: 768px) {
<style>
.hero section {
padding: 0 2rem;
padding: 0 5rem;
}
.hero-image {
display: none
@media screen and (max-width: 768px) {
.hero section {
padding: 0 2rem;
}
.hero-image {
display: none
}
}
}
</style>
</style>
{% endblock hero %}
{% endblock hero %}
</div>
{% endblock header %}
{% block toc %}
{% if section.toc %}
{% set toc = section.toc %}
{% elif page.toc %}
{% set toc = page.toc %}
{% endif %}
{% if toc %}
{% if page.extra.disable_toc %}
{% else %}
<div class="toc">
<div class="toc-sticky">
{% for h in toc %}
<div class="toc-item">
<a class="subtext" href="{{h.permalink | safe}}">{{ h.title }}</a>
</div>
{% if h.children %}
{% for h2 in h.children %}
<div class="toc-item-child">
<a class="subtext" href="{{h2.permalink | safe}}"><small>- {{ h2.title }}</small></a>
</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}
{% endblock toc %}
{% block sidebar %}
<!-- <div> -->
<!-- Your cool sidebar -->
<!-- </div> -->
{% endblock sidebar %}
{% block footer %}
<footer>
<!-- <small class="subtext"> -->
<!-- <a href="https://huhu.io">Huhu.io</a> © 2021 -->
<!-- </small> -->
<div class="nav-outlinks">
<!-- <a href="https://youtube.com/@fasterthanlime"> -->
<!-- <span class="inline-icon-container"> -->
<!-- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> -->
<!-- <path -->
<!-- d="M19.615 3.184c-3.604-.246-11.631-.245-15.23 0-3.897.266-4.356 2.62-4.385 8.816.029 6.185.484 8.549 4.385 8.816 3.6.245 11.626.246 15.23 0 3.897-.266 4.356-2.62 4.385-8.816-.029-6.185-.484-8.549-4.385-8.816zm-10.615 12.816v-8l8 3.993-8 4.007z"> -->
<!-- </path> -->
<!-- </svg> -->
<!-- </span> -->
<!-- YouTube -->
<!-- </a> -->
<a href="https://linkedin.com">
<span class="inline-icon-container">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path
d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z" />
</svg>
</span>
LinkedIn
</a>
<a rel="me" href="https://github.com/glennwso">
<span class="inline-icon-container">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path
d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z">
</path>
</svg>
</span>
GitHub
</a>
{% if lang =="sv"%}
<a href="/sv/contact">
<span class="inline-icon-container">
</span>
Kontakt
</a>
{% else %}
<a href="/contact">
<span class="inline-icon-container">
</span>
Contact
</a>
{% endif %}
</div>
</footer>
{% endblock footer %}
{% endblock header %}
{% block toc %}
{% if section.toc %}
{% set toc = section.toc %}
{% elif page.toc %}
{% set toc = page.toc %}
{% endif %}
{% if toc %}
{% if page.extra.disable_toc %}
{% else %}
<div class="toc">
<div class="toc-sticky">
{% for h in toc %}
<div class="toc-item">
<a class="subtext" href="{{h.permalink | safe}}">{{ h.title }}</a>
</div>
{% if h.children %}
{% for h2 in h.children %}
<div class="toc-item-child">
<a class="subtext" href="{{h2.permalink | safe}}"><small>- {{ h2.title }}</small></a>
</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}
{% endblock toc %}
{% block sidebar %}
<!-- <div> -->
<!-- Your cool sidebar -->
<!-- </div> -->
{% endblock sidebar %}
{% block footer %}
<footer>
<!-- <small class="subtext"> -->
<!-- <a href="https://huhu.io">Huhu.io</a> © 2021 -->
<!-- </small> -->
<div class="nav-outlinks">
<!-- <a href="https://youtube.com/@fasterthanlime"> -->
<!-- <span class="inline-icon-container"> -->
<!-- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> -->
<!-- <path -->
<!-- d="M19.615 3.184c-3.604-.246-11.631-.245-15.23 0-3.897.266-4.356 2.62-4.385 8.816.029 6.185.484 8.549 4.385 8.816 3.6.245 11.626.246 15.23 0 3.897-.266 4.356-2.62 4.385-8.816-.029-6.185-.484-8.549-4.385-8.816zm-10.615 12.816v-8l8 3.993-8 4.007z"> -->
<!-- </path> -->
<!-- </svg> -->
<!-- </span> -->
<!-- YouTube -->
<!-- </a> -->
<a href="https://linkedin.com">
<span class="inline-icon-container">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path
d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z" />
</svg>
</span>
LinkedIn
</a>
<a rel="me" href="https://github.com/glennwso">
<span class="inline-icon-container">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path
d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z">
</path>
</svg>
</span>
GitHub
</a>
{% if lang =="sv"%}
<a href="/sv/contact">
<span class="inline-icon-container">
</span>
Kontakt
</a>
{% else %}
<a href="/contact">
<span class="inline-icon-container">
</span>
Contact
</a>
{% endif %}
</div>
</footer>
{% endblock footer %}