Skip to content

Commit

Permalink
Merge pull request #285 from yammmt/update_styles
Browse files Browse the repository at this point in the history
Bump Bulma from 0.9.4 to 1.0.1
  • Loading branch information
yammmt authored Jul 15, 2024
2 parents 670ce59 + 98ede49 commit e324a96
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 18 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

Simple ToDo list based on last date I did.

![index page image](./img/index.jpg)
![index page image (light)](./img/index_light.png)
![index page image (dark)](./img/index_dark.png)

## Purpose

Expand Down
Binary file removed img/index.jpg
Binary file not shown.
Binary file added img/index_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/index_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/base.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{% endblock title %}</title>
<link rel="stylesheet" href="/css/mystyles.css">
<script src="/js/scripts.js"></script>
{% endblock head %}
</head>

Expand Down
2 changes: 1 addition & 1 deletion static/bulma
Submodule bulma updated 5340 files
2 changes: 1 addition & 1 deletion static/css/mystyles.css

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions static/js/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function applyTheme() {
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;

if (prefersDarkScheme) {
let lights = document.querySelectorAll(".is-light");
for (let l of lights) {
l.classList.remove("is-light");
l.classList.add("is-dark");
}
} else {
let darks = document.querySelectorAll(".is-dark");
for (let d of darks) {
d.classList.remove("is-dark");
d.classList.add("is-light");
}
}
}

// https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event#checking_whether_loading_is_already_complete
if (document.readyState === "loading") {
// loading hasn't finished yet
document.addEventListener("DOMContentLoaded", applyTheme);
} else {
applyTheme();
}

window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", applyTheme);
2 changes: 1 addition & 1 deletion static/label/index.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{% for label in labels %}
<tr>
<td>
<button class="button is-outlined" style="background-color: {{ label.color_hex }}" onclick="location.href='/label/{{ label.id }}'">
<button class="button is-outlined label-button" style="background-color: {{ label.color_hex }}" onclick="location.href='/label/{{ label.id }}'">
{{ label.name }}
</button>
</td>
Expand Down
31 changes: 19 additions & 12 deletions static/mystyles.scss
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
@charset "utf-8";

@use "bulma/sass/utilities";

@use "bulma/sass/base";
@use "bulma/sass/elements/button";
@use "bulma/sass/elements/notification";
@use "bulma/sass/elements/table";
@use "bulma/sass/elements/title";
@use "bulma/sass/form";
@use "bulma/sass/grid";
@use "bulma/sass/layout/footer";
@use "bulma/sass/layout/hero";
@use "bulma/sass/layout/section";
@use "bulma/sass/themes";

$section-padding: 1rem 1.5rem;

.table tbody tr td { vertical-align: middle; }
.button { margin: 0.2em auto; }

@import "bulma/sass/utilities/_all.sass";
@import "bulma/sass/base/_all.sass";
@import "bulma/sass/helpers/_all.sass";
@import "bulma/sass/elements/button.sass";
@import "bulma/sass/elements/container.sass";
@import "bulma/sass/elements/notification.sass";
@import "bulma/sass/elements/table.sass";
@import "bulma/sass/elements/title.sass";
@import "bulma/sass/form/_all.sass";
@import "bulma/sass/grid/_all.sass";
@import "bulma/sass/layout/hero.sass";
@import "bulma/sass/layout/section.sass";
// Use the same font color for both light and dark modes
// to avoid buttons with inappropriately low contrast.
// Note that button's background color is decided by the user.
.button.label-button { color: black; }
.tag.label-tag { color: black; }
2 changes: 1 addition & 1 deletion static/task/bylabel.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<section class="section">
<div class="container">
Tasks belong to
<span class="tag is-medium" style="background-color: {{ label.color_hex }}">
<span class="tag is-medium label-tag" style="background-color: {{ label.color_hex }}">
{{ label.name }}
</span>

Expand Down
2 changes: 1 addition & 1 deletion static/task/index.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
{% if task.label_id %}
{% for label in labels %}
{% if label.id == task.label_id %}
<button class="button is-outlined" style="background-color: {{ label.color_hex }}" onclick="location.href='/label/{{ task.label_id }}'">
<button class="button is-outlined label-button" style="background-color: {{ label.color_hex }}" onclick="location.href='/label/{{ task.label_id }}'">
{{ label.name }}
</button>
{% break %}
Expand Down

0 comments on commit e324a96

Please sign in to comment.