Update list layout and style

Not only does this make some proper RTL styling but also make it more
responsive. The nice separators are gone though. :(
This commit is contained in:
Gabriel Arazas 2023-03-16 18:02:42 +08:00
parent db5a0b48de
commit 1b8b2cbce7
5 changed files with 28 additions and 37 deletions

View File

@ -26,28 +26,24 @@ footer[aria-label="Site footer"] {
.list { .list {
display: inline-flex; display: inline-flex;
align-items: baseline;
flex-flow: row wrap; flex-flow: row wrap;
gap: 0.75em;
justify-content: space-around;
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
& > *:not(:last-child) {
border-right: 1px solid var(--base02);
margin-right: 0.5em;
padding-right: 0.5em;
}
} }
.site__title { .site__title {
--size: 2rem; font-size: 2rem;
display: inline-block;
font-size: var(--size);
margin-bottom: unset;
margin-right: 0.5rem;
} }
.site__links { .site__nav-header {
@include header-link-hover-style; display: flex;
align-items: baseline;
flex-flow: row wrap;
gap: 0.5em;
} }
.site__languages { .site__languages {
@ -55,8 +51,9 @@ footer[aria-label="Site footer"] {
} }
.site__socials { .site__socials {
@include header-link-hover-style; display: flex;
font-style: unset; font-style: unset;
gap: 1em;
} }
.site__social-icon { .site__social-icon {
@ -171,9 +168,10 @@ footer[aria-label="Site footer"] {
font-size: 0.9em; font-size: 0.9em;
margin-top: 0.5em; margin-top: 0.5em;
& > * { &-icon-label {
gap: 0.25em;
display: inline-flex; display: inline-flex;
align-items: center; align-items: normal;
} }
.post--single & { .post--single & {

View File

@ -28,13 +28,6 @@
padding: 0; padding: 0;
} }
@mixin header-link-hover-style {
> *:hover {
color: var(--accent-color);
text-decoration: none;
}
}
@import "base"; @import "base";
@import "layout"; @import "layout";
@import "extend"; @import "extend";

View File

@ -5,18 +5,18 @@
{{- $RFC3339 := "2006-01-02T15:04:05Z07:00" }} {{- $RFC3339 := "2006-01-02T15:04:05Z07:00" }}
<div class="list post__meta" aria-hidden="true"> <div class="list post__meta" aria-hidden="true">
{{- if .PublishDate -}} {{- if .PublishDate -}}
<span> <span class="post__meta-icon-label">
{{ partial "components/heroicon.html" "calendar" }} {{ partial "components/heroicon.html" "calendar" }}
<time datetime="{{ .PublishDate.Format $RFC3339 }}" title="{{ i18n "published_on" }}" style="margin-left: 0.5em;"> <time datetime="{{ .PublishDate.Format $RFC3339 }}" title="{{ i18n "published_on" }}">
{{ .PublishDate.Format "2006-01-02" }} {{ .PublishDate.Format "2006-01-02" }}
</time> </time>
</span> </span>
{{- end }} {{- end }}
{{- if ne (.PublishDate.Format "2006-01-02") (.Lastmod.Format "2006-01-02") }} {{- if ne (.PublishDate.Format "2006-01-02") (.Lastmod.Format "2006-01-02") }}
<span> <span class="post__meta-icon-label">
{{ partial "components/heroicon.html" "arrow-path" }} {{ partial "components/heroicon.html" "arrow-path" }}
<time datetime="{{ .Lastmod.Format $RFC3339 }}" title="{{ i18n "updated_on" }}" style="margin-left: 0.5em;"> <time datetime="{{ .Lastmod.Format $RFC3339 }}" title="{{ i18n "updated_on" }}">
{{ .Lastmod.Format "2006-01-02" }} {{ .Lastmod.Format "2006-01-02" }}
</time> </time>
</span> </span>
@ -27,9 +27,9 @@
{{- $names := slice }} {{- $names := slice }}
{{- range . }}{{ $names = $names | append .name }}{{ end }} {{- range . }}{{ $names = $names | append .name }}{{ end }}
{{- $author := index (first 1 $names) 0 }} {{- $author := index (first 1 $names) 0 }}
<span data-authors="{{ jsonify $names }}" title="{{ i18n "published_by" }}"> <span class="post__meta-icon-label" data-authors="{{ jsonify $names }}" title="{{ i18n "published_by" }}">
{{ partial "components/heroicon.html" "pencil" }} {{ partial "components/heroicon.html" "pencil" }}
<span style="margin-left: 0.5em;"> <span>
{{ $author }}{{ if ge (len .) 2 }}, et al.{{ end }} {{ $author }}{{ if ge (len .) 2 }}, et al.{{ end }}
</span> </span>
</span> </span>

View File

@ -16,13 +16,12 @@
<!-- List all of the social media links --> <!-- List all of the social media links -->
{{ with (index $.Site.Data "more-contentful").contacts }} {{ with (index $.Site.Data "more-contentful").contacts }}
<ul class="list site__socials"> <nav class="list site__socials">
{{ $useImage := index . "useImage" | default false }} {{ $useImage := index . "useImage" | default false }}
{{ $links := sort .links "id" "asc" }} {{ $links := sort .links "id" "asc" }}
{{ $links = sort $links "weight" "asc" }} {{ $links = sort $links "weight" "asc" }}
{{- range $links -}} {{- range $links -}}
<li>
<a {{ if $useImage }}class="site__social-icon"{{ end }} rel="me" href="{{ .url | absLangURL }}" aria-label="{{ with .name }}{{ . }}{{ else }}{{ .id }}{{ end }}"> <a {{ if $useImage }}class="site__social-icon"{{ end }} rel="me" href="{{ .url | absLangURL }}" aria-label="{{ with .name }}{{ . }}{{ else }}{{ .id }}{{ end }}">
{{- if $useImage }} {{- if $useImage }}
{{- partial "components/icon.html" (dict "id" .id "output" "icons/brand/%s.svg" "template" "templates/simple-icon.svg") }} {{- partial "components/icon.html" (dict "id" .id "output" "icons/brand/%s.svg" "template" "templates/simple-icon.svg") }}
@ -30,9 +29,8 @@
{{- .name }} {{- .name }}
{{- end }} {{- end }}
</a> </a>
</li>
{{- end -}} {{- end -}}
</ul> </nav>
{{ end }} {{ end }}
{{ $markdownOpt := dict "markup" "markdown" }} {{ $markdownOpt := dict "markup" "markdown" }}

View File

@ -1,13 +1,15 @@
<header aria-label="Site header"> <header aria-label="Site header">
<nav> <nav class="site__nav-header">
<a class="site__title" href="{{ "" | absLangURL }}">{{ $.Site.Title }}</a> <a class="site__title" href="{{ "" | absLangURL }}">{{ $.Site.Title }}</a>
<div class="list site__links"> <ul class="list">
{{ with $.Site.Menus.main }} {{ with $.Site.Menus.main }}
{{ range . -}} {{ range . -}}
<a href="{{ .URL | absLangURL }}">{{- .Name -}}</a> <li>
<a href="{{ .URL | absLangURL }}">{{- .Name -}}</a>
</li>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </ul>
</nav> </nav>
{{- partial "components/theme-button.html" . }} {{- partial "components/theme-button.html" . }}
</header> </header>