Skip to content

Commit

Permalink
update latest bulma
Browse files Browse the repository at this point in the history
  • Loading branch information
phineas-pta committed Jul 28, 2024
1 parent 7d02ed1 commit 8f22502
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 41 deletions.
18 changes: 9 additions & 9 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
/*
const sitemap = require("@quasibit/eleventy-plugin-sitemap"); // doesn’t with pathPrefix, doing my own
const sitemap = require("@quasibit/eleventy-plugin-sitemap"); // doesn’t work with pathPrefix, doing my own
const EleventyRenderPlugin = require("@11ty/eleventy"); // doesn’t auto transform weblinks in markdown
const EleventyHtmlBasePlugin = require("@11ty/eleventy"); // doesn’t work as expected: see 11ty/eleventy#3035
*/
Expand Down Expand Up @@ -45,17 +45,17 @@ module.exports = (eleventyConfig) => {

/**
* Returns correct timestamp format for sitemap, instead of "luxon" things
* @param {!Date} value
* @param {!Date} datetime (already UTC timezone)
* @returns {!string}
*/
function sitemapDate(value) {
var year = value.getFullYear(),
var year = value.getFullYear(),
month = `${value.getMonth() + 1}`.padStart(2, "0"),
day = `${value.getDate()}`.padStart(2, "0"),
hour = `${value.getHours()}`.padStart(2, "0"),
minut = `${value.getMinutes()}`.padStart(2, "0"),
sec = `${value.getSeconds()}`.padStart(2, "0");
return `${year}-${month}-${day}T${hour}:${minut}:${sec}+00:00`; // already UTC timezone
day = `${value.getDate() }`.padStart(2, "0"),
hour = `${value.getHours() }`.padStart(2, "0"),
minut = `${value.getMinutes() }`.padStart(2, "0"),
sec = `${value.getSeconds() }`.padStart(2, "0");
return `${year}-${month}-${day}T${hour}:${minut}:${sec}+00:00`;
}

/**
Expand All @@ -75,7 +75,7 @@ function findNextPrevious(key, nodes) {
}

return {
"prev_url": prev_i < 0 ? null : nodes[prev_i]["url"],
"prev_url": prev_i < 0 ? null : nodes[prev_i]["url"],
"next_url": next_i < nodes.length ? nodes[next_i]["url"] : null
}
}
2 changes: 1 addition & 1 deletion _includes/breadcrumbs.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{# all pages must have eleventyNavigation.key except root homepage #}

<nav class="breadcrumb is-large is-centered has-succeeds-separator" role="navigation" aria-label="breadcrumbs">
<nav class="breadcrumb is-large is-centered is-spaced has-arrow-separator" role="navigation" aria-label="breadcrumbs">
{% set navPages = collections.all | eleventyNavigationBreadcrumb(eleventyNavigation.key, { includeSelf: true }) %}
<ul>
<li><a rel="prev" href="{{ '/' | url }}" class="MUC-LUC">Home</a></li>
Expand Down
2 changes: 1 addition & 1 deletion _includes/lay-chap.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% include "breadcrumbs.njk" %}

{# main content #}
<main id="main"><article class="content is-large">
<main class="skeleton-block" id="main"><article class="content is-large">
{{ content | safe }}{# coz content is html already #}
</article></main>

Expand Down
2 changes: 1 addition & 1 deletion _includes/lay-not-chap.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% include "breadcrumbs.njk" %}

{# main content #}
<main id="main"><article class="content is-large">
<main class="skeleton-block" id="main"><article class="content is-large">

{{ content | safe }}{# coz content is html already #}

Expand Down
2 changes: 1 addition & 1 deletion _includes/navbar.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{# top nav bar with hamburger + dark mode switch #}
<nav class="navbar is-info is-fixed-top is-size-4 has-shadow" role="navigation" aria-label="main navigation">
<nav class="navbar is-primary is-fixed-top is-size-4" role="navigation" aria-label="main navigation">
<div class="navbar-brand" style="flex-grow: 1; justify-content: center;">
{# center navbar ref: https://github.com/jgthms/bulma/issues/1604#issuecomment-422407761 #}
<div class="navbar-item">
Expand Down
6 changes: 3 additions & 3 deletions _includes/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ window.onload = () => {
el.onclick = noHistoryChange;

// remove blur once page loaded
document.getElementById("main").style.filter = "none";
document.getElementById("main").classList.remove("skeleton-block");
};

// event: click back/forward button in browser => change url without reloading
Expand All @@ -46,11 +46,11 @@ window.onpopstate = (e) => {
// dark mode toggle
function darkToggle() {
if (this.checked) {
document.documentElement.setAttribute("data-theme", dkey); // do not set for <body> because it breaks position fixed of sidenav
document.documentElement.setAttribute("data-theme", "dark");
this.nextSibling.textContent = "\uD83C\uDF19"; // \u{1F319} 🌙 surrogate pair
return window.localStorage.setItem(dkey, y); // save state
} else {
document.documentElement.removeAttribute("data-theme");
document.documentElement.setAttribute("data-theme", "light");
this.nextSibling.textContent = "\u2600\uFE0F"; // ☀️ with modifier
return window.localStorage.setItem(dkey, "tdyutrghjtucvghjtc"); // something random not important
}
Expand Down
43 changes: 20 additions & 23 deletions assets/style.sass
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
/* ********************************* bulma ********************************* */

// always need
@use "../node_modules/bulma/sass/base"
@use "../node_modules/bulma/sass/themes"

// on-demand
@use "../node_modules/bulma/sass/elements/button"
@use "../node_modules/bulma/sass/elements/content"
@use "../node_modules/bulma/sass/elements/title"
@use "../node_modules/bulma/sass/components/breadcrumb"
@use "../node_modules/bulma/sass/components/navbar"
@use "../node_modules/bulma/sass/components/pagination"
@use "../node_modules/bulma/sass/form/checkbox-radio"
@use "../node_modules/bulma/sass/layout/container"
@use "../node_modules/bulma/sass/layout/footer"

/* ************************************************************************* */

[data-theme="dark"]
word-spacing: .05em // more readable against dark backgrounds: a tiny amount of extra space
filter: invert(1) hue-rotate(180deg) // photoshop trick: inverted luminance

main
filter: blur(5px) // at preload, to be remove once page loaded
// bulma now has built-in dark mode, no need “inverted luminance” trick anymore
a.MY-REF
font-family: monospace
Expand Down Expand Up @@ -62,22 +78,3 @@ rt
text-align: left // to work together with rb margin
font-family: "SinoViet-font"
font-size: larger // because font unexpectedly got smaller

/* ********************************* bulma ********************************* */

// always need
@import "../node_modules/bulma/sass/base/_all.sass"
@import "../node_modules/bulma/sass/helpers/_all.sass"
@import "../node_modules/bulma/sass/utilities/_all.sass"
@import "../node_modules/bulma/sass/form/shared.sass"

// on-demand
@import "../node_modules/bulma/sass/components/breadcrumb.sass"
@import "../node_modules/bulma/sass/components/navbar.sass"
@import "../node_modules/bulma/sass/components/pagination.sass"
@import "../node_modules/bulma/sass/elements/button.sass"
@import "../node_modules/bulma/sass/elements/container.sass"
@import "../node_modules/bulma/sass/elements/content.sass"
@import "../node_modules/bulma/sass/elements/title.sass"
@import "../node_modules/bulma/sass/form/checkbox-radio.sass"
@import "../node_modules/bulma/sass/layout/footer.sass"
1 change: 0 additions & 1 deletion src/_misc/sitemap.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ permalink: /sitemap.xml
layout: null
eleventyExcludeFromCollections: true
---

<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
{% for page in collections.all %}
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

{% include "navbar.njk" %}

<main id="main"><article class="content is-large">
<main class="skeleton-block" id="main"><article class="content is-large">
<header style="margin-top: 1em;"><h1 class="title">
<!-- cox no breadcrumb so navbar overlap header -->
<span lang="zh-Hant">
Expand Down

0 comments on commit 8f22502

Please sign in to comment.