Fix styling of blog, photos, term, ruby

So many fixes!
This commit is contained in:
Eryn Wells 2023-09-26 09:37:04 -07:00
parent b7070ccfd5
commit a9cfddec80
21 changed files with 212 additions and 149 deletions

View file

@ -1,11 +1,12 @@
/* Eryn Wells <eryn@erynwells.me> */
a:has(> img) {
:has(> img) {
grid-column: content-start / content-end;
line-height: 0;
}
@media (max-width: 639px) {
a:has(> img) {
:has(> img) {
grid-column: gutter-start / gutter-end;
}
}
@ -14,6 +15,6 @@ main {
gap: var(--body-item-spacing) 0;
}
main > article > :not(:last-child) {
margin-block-end: var(--body-item-spacing);
article > :is(h1, h2, h3, h4, h5, h6) {
grid-column: content-start / content-end;
}

View file

@ -32,6 +32,7 @@
.photos.list > * {
margin-block-end: 0;
grid-column: auto;
}
.photos.list > a {
@ -40,13 +41,11 @@
}
.photos.list > a > img {
border-radius: 3px;
image-orientation: from-image;
}
.photos.list > div {
background-color: var(--date-item-background-color);
border-radius: 3px;
width: 100%;
height: 100%;
display: flex;

View file

@ -80,25 +80,6 @@
}
@layer root {
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
text-decoration-style: solid;
}
a.hover-only {
color: var(--color);
transition: color 0.2s;
}
a.hover-only:hover {
text-decoration: underline;
transition: color 0.2s;
}
blockquote {
--line-width: 4px;
@ -110,9 +91,6 @@
code {
background-color: var(--body-code-background-color);
border-radius: 0.25rem;
display: inline-block;
padding-inline: 0.6rem;
}
code.nobg {

View file

@ -1,9 +1,9 @@
@layer root {
:root {
--margin-min-width: var(--body-item-spacing);
--margin-max-width: 1fr;
}
:root {
--margin-min-width: var(--body-item-spacing);
--margin-max-width: 1fr;
}
@layer root {
main {
--content-columns: 5;
--gutter-width: 3rem;
@ -17,7 +17,12 @@
[wide-content-left-end gutter-start gutter-left-start]
var(--gutter-width)
[gutter-left-end content-start]
repeat(var(--content-columns), min(calc((100% - 2 * var(--gutter-width)) / var(--content-columns)), calc(var(--content-width) / var(--content-columns))))
repeat(var(--content-columns),
min(
calc((100% - 2 * var(--gutter-width)) / var(--content-columns)),
calc(var(--content-width) / var(--content-columns))
)
)
[content-end gutter-right-start]
var(--gutter-width)
[gutter-right-end gutter-end wide-content-right-start]
@ -66,7 +71,12 @@
}
}
main > :is(header, article, footer) {
grid-column: gutter-start / gutter-end;
main > * {
grid-column: content-start / content-end;
}
main > figure,
main > a.to-photo-post {
grid-column: wide-content-start / wide-content-end;
}
}

View file

@ -0,0 +1,34 @@
@layer root {
a {
text-decoration: none;
}
a[href] {
color: var(--a-color);
}
a[href]:visited {
color: var(--a-color);
}
a[href]:hover {
text-decoration: underline;
text-decoration-style: solid;
}
a.hover-only {
color: var(--color);
transition: color 0.2s;
}
a.hover-only:hover {
text-decoration: underline;
transition: color 0.2s;
}
a.hover-only { color: var(--color); }
a.hover-only:hover { color: var(--a-color); }
a rt, a:hover rt { color: var(--a-ruby-color); }
}

View file

@ -8,7 +8,7 @@
}
figure {
grid-column: content-start / content-end;
grid-column: gutter-start / gutter-end;
margin: 0;
margin-inline: 0;
min-width: fit-content;
@ -42,7 +42,6 @@
figure img {
display: block;
height: auto;
max-width: var(--content-width);
}
@media (max-width: 414px) {

View file

@ -17,9 +17,6 @@
}
}
.page > header > time {
}
.page > header,
.page > footer {
grid-column: content-start / content-end;
@ -37,8 +34,8 @@
grid-column: gutter-start / gutter-end;
}
.page > article > :not(blockquote, figure.code) {
margin-inline: var(--gutter-width);
.page > :not(blockquote, figure.code, :has(> img)) {
grid-column: content-start / content-end;
}
.page > article > :not(:last-child) {

View file

@ -1,18 +1,23 @@
:root {
--list-item-block-gap: var(--body-item-spacing);
}
@layer section {
.blog.list {
gap: 8rem 0;
.list {
gap: var(--list-item-block-gap) 0;
}
.blog.list > h1.date {
.list > h1,
.list > header {
grid-column: content-start / content-end;
}
.blog.list > .post {
.list > .post {
grid-column: wide-content-start / wide-content-end;
}
@supports (grid-template-columns: subgrid) {
.blog.list > .post {
.list > .post {
--body-item-spacing: 2rem;
display: grid;
@ -21,32 +26,32 @@
}
}
.post header {
.list .post header {
grid-column: wide-content-start / content-end;
}
@supports (grid-template-columns: subgrid) {
.post header {
.list .post header {
display: grid;
grid-template-columns: subgrid;
}
}
.post time {
.list .post time {
font-variant-numeric: tabular-nums;
grid-column: wide-content-start;
justify-self: end;
}
@media (max-width: 960px) {
.post time {
.list .post time {
grid-column: content-start / content-end;
justify-self: start;
line-height: var(--line-height);
}
}
article.post {
.post {
grid-column: gutter-start / gutter-end;
}

View file

@ -0,0 +1 @@

View file

@ -1,27 +1,33 @@
@layer root {
body:has(fieldset#ruby-controls > input[value=NONE]:checked) rt { display: none; }
#ruby-controls {
align-items: baseline;
display: flex;
padding: calc(var(--body-item-spacing) / 2);
}
body:has(#ruby-controls > input[value=NONE]:checked) rt { display: none; }
/* When ruby-controls is set to hidden, hide the ruby base and only show the <rt> */
body:has(fieldset#ruby-controls > input[value=HIDDEN]:checked) ruby > span { display: none; }
body:has(#ruby-controls > input[value=HIDDEN]:checked) ruby > span { display: none; }
body:has(fieldset#ruby-controls > input[value=HIDDEN]:checked) rt {
body:has(#ruby-controls > input[value=HIDDEN]:checked) rt {
color: inherit;
display: inline;
font-size: inherit;
white-space: inherit;
}
body:has(fieldset#ruby-controls > input[value=HIDDEN]:checked) :is(h1, h2, h3, h4, h5, h6) rt {
body:has(#ruby-controls > input[value=HIDDEN]:checked) :is(h1, h2, h3, h4, h5, h6) rt {
font-family: var(--font-family-heading);
font-weight: bold;
}
fieldset#ruby-controls input[type=radio] {
margin-inline-end: calc(var(--body-item-spacing) / 6);
fieldset#ruby-controls input[type=radio]:not(:last-child) {
margin-inline-end: 0.5rem;
}
fieldset#ruby-controls label {
margin-inline-end: calc(var(--body-item-spacing));
fieldset#ruby-controls label:not(:last-child) {
margin-inline-end: 2rem;
}
rt { transition: color 0.3s; }

View file

@ -18,7 +18,11 @@
}
header.site h1 > a:hover { text-decoration: none; }
header.site a[href],
header.site a[href]:hover {
color: inherit;
text-decoration: none;
}
header.site {
display: flex;

View file

@ -1,11 +1,24 @@
.highlight code {
background-color: inherit;
margin-block: 0.5em;
@supports (grid-template-columns: subgrid) {
figure.code,
figure.code > .highlight,
figure.code > .highlight > .chroma,
figure.code > .highlight > .chroma > code,
figure.code > .highlight > .chroma > code > .line {
display: grid;
grid-template-columns: subgrid;
}
.line > .ln {
grid-column: gutter-start;
}
.line > .cl {
grid-column: content-start / content-end;
}
}
.highlight .line {
display: grid;
grid-template-columns: max-content auto;
.highlight code {
background-color: inherit;
}
.highlight .ln a {
@ -17,4 +30,4 @@
.highlight .cl {
white-space: pre-wrap;
}

View file

@ -1,5 +1,3 @@
aside#table-of-contents {
grid-column: wide-content-right / margin-right;
grid-row: 1 / -1;
grid-column: content-start / content-end;
}

View file

@ -45,12 +45,6 @@
}
}
a { color: var(--a-color); }
a:visited { color: var(--a-color); }
a.hover-only { color: var(--color); }
a.hover-only:hover { color: var(--a-color); }
a rt, a:hover rt { color: var(--a-ruby-color); }
body {
font-size: var(--font-size);
}

View file

@ -3,29 +3,26 @@
{{ end }}
{{ define "main" }}
<header class="page">
<h1>{{ .Title }}</h1>
</header>
<header>
<h1>{{ .Title }}</h1>
</header>
{{ partial "table_of_contents.html" . }}
{{ partial "ruby_controls.html" . }}
{{ partial "ruby_controls.html" . }}
{{- $hasContent := false -}}
{{ with .Content }}
{{- $hasContent = true -}}
{{ . }}
{{ end }}
{{ if .Params.posts | default true }}
{{ if and $hasContent }}
<h2>Posts</h2>
{{- $hasContent := false -}}
{{ with .Content }}
{{- $hasContent = true -}}
{{ . }}
{{ end }}
<ul>
{{- range .Pages -}}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{- end -}}
</ul>
{{ if .Params.posts | default true }}
{{ if $hasContent }}
<h2>Posts</h2>
{{ end }}
{{- range .Pages -}}
{{ .Render "li_grid_with_date" }}
{{- end -}}
{{ end }}
{{ end }}

View file

@ -3,20 +3,38 @@
{{ end }}
{{ define "main" }}
<header class="page">
<h1>{{ .Title }}</h1>
</header>
<header class="page">
<h1>{{ .Title }}</h1>
</header>
<article>
{{ .Content }}
{{ .Content }}
{{- range .Data.Terms.Alphabetical -}}
<h2>{{ .Name | title }}</h2>
{{- range .Data.Terms.Alphabetical -}}
<h2>{{ .Name | title }}</h2>
<ul>
{{- range .WeightedPages -}}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{- end -}}
</ul>
{{- end -}}
{{- range .WeightedPages -}}
<article class="post">
<header>
<time class="nobreak" datetime="{{ .Date | time.Format "2006-01-02" }}">{{ .Date | time.Format "Jan 2, 2006" }}</time>
<h1 class="title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
</header>
{{ if .Description }}
<p>{{ .Description }}</p>
{{ else if lt .WordCount 110 }}
{{ .Content }}
{{ else }}
{{ warnf "Post \"%s\" doesn't have a description or content suitable for the blog list" .Title }}
<p>{{ .WordCount }} words</p>
{{ end }}
{{ partial "footer_tags.html" . }}
{{ partial "development/draft_tag.html" . }}
</article>
{{- end -}}
{{- end -}}
</article>
{{ end }}
{{ define "footer" }}

View file

@ -5,6 +5,7 @@
{{ define "main" }}
{{- range .Pages.ByDate.GroupByDate "2006" -}}
<h1 class="date"><a id="{{ .Key }}">{{ .Key | title }}</a></h1>
{{- range .Pages -}}
{{- if or (not .Draft) (not hugo.IsProduction) -}}
{{- .Render "li_grid_with_date" -}}

View file

@ -1,13 +1,13 @@
{{ if .HasShortcode "ruby" -}}
<aside>
<fieldset id="ruby-controls">
<fieldset id=ruby-controls>
<legend>Ruby</legend>
<input id="none" type="radio" name="ruby-controls" value="NONE">
<label for="none">Japanese Only</label>
<input id="both" type="radio" name="ruby-controls" value="BOTH" checked>
<label for="both">Both</label>
<input id=hidden type=radio name=ruby-controls value=HIDDEN>
<label for=hidden>English Only</label>
<input id=ruby-controls-none type=radio name=ruby-controls value=NONE>
<label for=ruby-controls-none>Japanese Only</label>
<input id=ruby-controls-both type=radio name=ruby-controls value=BOTH checked>
<label for=ruby-controls-both>Both</label>
<input id=ruby-controls-hidden type=radio name=ruby-controls value=HIDDEN>
<label for=ruby-controls-hidden>English Only</label>
</fieldset>
</aside>
{{- end }}

View file

@ -1,9 +1,16 @@
{{ partial "content_header.html" . }}
{{ partial "table_of_contents.html" . }}
{{- $layout := .Params.layout -}}
<article{{ with $layout }} class="{{ . }}"{{ end }}>
{{ .Content }}
</article>
{{- $content := .Content -}}
{{ with $layout := .Params.layout }}
<article class="{{ $layout }}">
{{ $content }}
</article>
{{ else }}
{{ $content }}
{{ end}}
<footer>
{{ partial "footer_tags.html" . }}

View file

@ -3,41 +3,42 @@
{{ end }}
{{ define "main" }}
{{- if .Title -}}
{{ partial "content_header.html" . }}
{{- end -}}
{{- $photos := partial "photos/list.html" . -}}
{{ if eq (len $photos) 0 }}
{{ errorf "Missing photo from photos page %q" .Path }}
{{ end }}
{{- $photos := partial "photos/list.html" . -}}
{{ if eq (len $photos) 0 }}
{{ errorf "Missing photo from photos page %q" .Path }}
{{ end }}
{{ if eq (len $photos) 1 }}
{{- $img := index $photos 0 -}}
<figure>
<img src="{{ $img.RelPermalink }}"{{ with $img.Params.alt }} alt="{{ . }}"{{ end }}>
</figure>
{{ if eq (len $photos) 1 }}
{{- $img := index $photos 0 -}}
<figure><img src="{{ $img.RelPermalink }}"{{ with $img.Params.alt }} alt="{{ . }}"{{ end }}></figure>
<article>
<h1>{{ .Title }}</h1>
{{ .Content }}
</article>
{{ .Content }}
{{- if .Params.photo_details | default true -}}
{{- partial "photo_exif_table.html" $img.Exif -}}
{{- if .Params.photo_details | default true -}}
{{- partial "photo_exif_table.html" $img.Exif -}}
{{- if in ($.Site.BaseURL | string) "localhost" -}}
{{- partial "development/photo_exif_table.html" $img.Exif -}}
{{- end -}}
{{- end -}}
{{ else }}
<figure>
<ul class="carousel">
{{- range $photos -}}
<li>{{ . }}</li>
{{- if in ($.Site.BaseURL | string) "localhost" -}}
{{- partial "development/photo_exif_table.html" $img.Exif -}}
{{- end -}}
</ul>
</figure>
{{ end }}
{{- end -}}
{{ else }}
<figure>
<ul class="carousel">
{{- range $photos -}}
<li>{{ . }}</li>
{{- end -}}
</ul>
</figure>
{{ end }}
<footer>
{{ partial "footer_tags.html" . }}
</footer>
<footer>
{{ partial "footer_tags.html" . }}
</footer>
{{ end }}
{{ define "footer" }}

View file

@ -1,7 +1,7 @@
{{- with $photoPage := $.Page.GetPage (printf "photos/%s" (.Get 0)) -}}
{{- $thumbnail := partial "photos/thumbnail.html" (dict "Page" . "Width" 1280 "Height" 1280) -}}
{{- $altText := $thumbnail.Params.alt | default .Title -}}
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
<a class="to-photo-post" href="{{ .RelPermalink }}" title="{{ .Title }}">
<img src="{{ $thumbnail.RelPermalink }}"{{ with $altText }} alt="{{ . }}"{{ end }}>
</a>
{{- else -}}