fix: use flexbox to align heading anchors (#434)

This commit is contained in:
Robert Kaussow 2023-09-01 22:42:06 +02:00 committed by GitHub
parent c964f46de2
commit 945b31d146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 9 deletions

View File

@ -1 +0,0 @@
/home/rknet/rkau2905/Devel/private/hugo/hugo-geekblog/

View File

@ -3,16 +3,16 @@
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
{{- if $showAnchor -}} {{- if $showAnchor -}}
<div class="gblog-post__anchorwrap"> <div class="flex align-center gblog-post__anchorwrap">
<h{{ .Level }} id="{{ .Anchor | safeURL }}" {{- with .Attributes.class }} <h{{ .Level }} id="{{ .Anchor | safeURL }}" {{- with .Attributes.class }}
class="{{ . }}" class="{{ . }}"
{{- end }} {{- end }}
> >
{{ .Text | safeHTML }} {{ .Text | safeHTML }}
</h{{ .Level }}>
<a data-clipboard-text="{{ .Page.Permalink }}#{{ .Anchor | safeURL }}" class="gblog-post__anchor clip flex align-center" aria-label="Anchor {{ .Text | safeHTML }}" href="#{{ .Anchor | safeURL }}"> <a data-clipboard-text="{{ .Page.Permalink }}#{{ .Anchor | safeURL }}" class="gblog-post__anchor clip flex align-center" aria-label="Anchor {{ .Text | safeHTML }}" href="#{{ .Anchor | safeURL }}">
<svg class="gblog-icon gblog_link"><use xlink:href="#gblog_link"></use></svg> <svg class="gblog-icon gblog_link"><use xlink:href="#gblog_link"></use></svg>
</a> </a>
</h{{ .Level }}>
</div> </div>
{{- else -}} {{- else -}}
<div class="gblog-post__anchorwrap"> <div class="gblog-post__anchorwrap">

View File

@ -331,17 +331,17 @@ svg.gblog-icon {
} }
&__anchorwrap { &__anchorwrap {
gap: 0.5em;
&:hover .gblog-post__anchor svg.gblog-icon { &:hover .gblog-post__anchor svg.gblog-icon {
color: var(--control-icons); color: var(--control-icons);
} }
} }
&__anchor { &__anchor {
margin-left: $padding-8;
svg.gblog-icon { svg.gblog-icon {
width: 1.25em; width: 1.85em;
height: 1.25em; height: 1.85em;
color: transparent; color: transparent;
} }