hugo: migrate font icons to svg

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2024-01-25 12:26:59 +01:00
parent 558fbdfabc
commit 0ff3eb3aab
15 changed files with 44 additions and 56 deletions

View File

@ -19,8 +19,8 @@
} }
.external-link { .external-link {
.icon:after { .icon-svg svg {
@apply text-base ml-1; @apply text-base ml-1 align-top;
} }
} }

View File

@ -4,25 +4,8 @@
font-size: 24px; font-size: 24px;
width: 1em; width: 1em;
height: 1em; height: 1em;
display: inline-block;
fill: currentColor; fill: currentColor;
} }
} }
.icon {
font-family: "Material Symbols Rounded";
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
}
.icon:after {
content: attr(data-icon);
}
} }

View File

@ -21,7 +21,7 @@ grid:
link: /admin/organization/registry-access/ link: /admin/organization/registry-access/
- title: General settings - title: General settings
description: Configure general information or create a company. description: Configure general information or create a company.
icon: settings_suggest icon: settings
link: /admin/organization/general-settings/ link: /admin/organization/general-settings/
- title: SSO & SCIM - title: SSO & SCIM
description: 'Set up [Single Sign-On](/security/for-admins/single-sign-on/) description: 'Set up [Single Sign-On](/security/for-admins/single-sign-on/)

View File

@ -26,7 +26,7 @@ grid:
link: /compose/compose-file/07-volumes/ link: /compose/compose-file/07-volumes/
- title: Configs top-level element - title: Configs top-level element
description: Find out about configs in Compose. description: Find out about configs in Compose.
icon: settings_suggest icon: settings
link: /compose/compose-file/08-configs/ link: /compose/compose-file/08-configs/
- title: Secrets top-level element - title: Secrets top-level element
description: Learn about secrets in Compose. description: Learn about secrets in Compose.

View File

@ -51,8 +51,8 @@ grid:
icon: "publish" icon: "publish"
description: Icon name = publish description: Icon name = publish
- title: "Interacting" - title: "Interacting"
icon: "multiple_stops" icon: "multiple_stop"
description: Icon name = multiple_stops description: Icon name = multiple_stop
- title: "Storage" - title: "Storage"
icon: "database" icon: "database"
description: Icon name = database description: Icon name = database
@ -141,8 +141,8 @@ grid:
description: Icon name = supervised_user_circle description: Icon name = supervised_user_circle
icon: supervised_user_circle icon: supervised_user_circle
- title: "General settings" - title: "General settings"
icon: "settings_suggest" icon: "settings"
description: Icon name = settings_suggest description: Icon name = settings
--- ---
Below is an inventory of the icons we use to represent different topics or features across docs. To be used with the [cards component](cards.md). Below is an inventory of the icons we use to represent different topics or features across docs. To be used with the [cards component](cards.md).

View File

@ -41,7 +41,7 @@ grid_apis:
link: /docker-hub/api/latest/ link: /docker-hub/api/latest/
- title: DVP Data API - title: DVP Data API
description: API for Docker Verified Publishers to fetch analytics data. description: API for Docker Verified Publishers to fetch analytics data.
icon: auto_graph icon: area_chart
link: /docker-hub/api/dvp/ link: /docker-hub/api/dvp/
grid_specs: grid_specs:
- title: Image specification - title: Image specification

View File

@ -7,7 +7,7 @@ grid:
icon: web_asset icon: web_asset
link: /desktop/release-notes/ link: /desktop/release-notes/
- title: Docker Engine - title: Docker Engine
icon: settings_suggest icon: developer_board
link: /engine/release-notes/ link: /engine/release-notes/
- title: Docker Compose - title: Docker Compose
icon: storage icon: storage

View File

@ -1,13 +1,14 @@
<div class="group relative"> <div class="group relative">
<button <button
x-data="{ code: '{{encoding.Base64Encode .Inner}}' }" x-data="{ code: '{{encoding.Base64Encode .Inner}}', copying: false }"
class="material-symbols-rounded hidden group-hover:block absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600"
title="Copy" title="Copy"
@click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, '')); @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
$el.textContent='check_circle'; copying = true;
setTimeout(() => $el.textContent='content_copy', 2000);" setTimeout(() => copying = false, 2000);"
> >
content_copy <span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg">{{ partial "icon" "content_copy" }}</span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg">{{ partial "icon" "check_circle" }}</span>
</button> </button>
{{ $result := transform.HighlightCodeBlock . }} {{ $result := transform.HighlightCodeBlock . }}
<div class="syntax-light dark:syntax-dark"> <div class="syntax-light dark:syntax-dark">

View File

@ -34,9 +34,9 @@
class="fixed z-20 inset-0 flex items-center justify-center bg-black/70 p-6" class="fixed z-20 inset-0 flex items-center justify-center bg-black/70 p-6"
> >
<button <button
class="material-symbols-rounded fixed z-30 top-6 right-8 text-white text-5xl" class="text-white fixed z-30 top-6 right-8 icon-svg"
> >
close {{ partial "icon" "close" }}
</button> </button>
<img <img
class="rounded max-w-full max-h-full" class="rounded max-w-full max-h-full"

View File

@ -5,9 +5,11 @@
class="link external-link" class="link external-link"
href="{{ $url | safeURL }}" href="{{ $url | safeURL }}"
target="_blank" target="_blank"
rel="noopener" rel="noopener">
>{{ .Text | safeHTML }}<span {{- .Text | safeHTML -}}
class="icon" data-icon="open_in_new"></span></a> <span class="icon-svg">
{{- partial "icon" "open_in_new" -}}
</span></a>
{{- else if (strings.HasPrefix $url "/") -}} {{- else if (strings.HasPrefix $url "/") -}}
{{/* absolute link, use url as-is */}} {{/* absolute link, use url as-is */}}
<a class="link" href="{{ $url }}">{{ .Text | safeHTML }}</a> <a class="link" href="{{ $url }}">{{ .Text | safeHTML }}</a>

View File

@ -1,10 +1,8 @@
<div x-data="{ open: false }" class="border border-gray-light-200 dark:border-gray-dark-200 bg-white dark:bg-gray-dark-100"> <div x-data="{ open: false }" class="border border-gray-light-200 dark:border-gray-dark-200 bg-white dark:bg-gray-dark-100">
<button class="not-prose w-full py-2 px-4 flex justify-between" x-on:click="open = ! open"> <button class="not-prose w-full py-2 px-4 flex justify-between" x-on:click="open = ! open">
<span>{{ .title }}</span> <span>{{ .title }}</span>
<span <span :class="{ 'hidden' : !open }" class="icon-svg">{{ partial "icon" "expand_less" }}</span>
class="material-symbols-rounded text-gray-light dark:text-gray-dark" <span :class="{ 'hidden' : open }" class="icon-svg">{{ partial "icon" "expand_more" }}</span>
x-text="open ? 'expand_less' : 'expand_more'"
></span>
</button> </button>
<div x-show="open" x-collapse class="px-4"> <div x-show="open" x-collapse class="px-4">

View File

@ -33,7 +33,7 @@
<img class="w-[32px] invertible" src="{{ . }}" alt=""> <img class="w-[32px] invertible" src="{{ . }}" alt="">
{{ else }} {{ else }}
{{/* icon ligature */}} {{/* icon ligature */}}
<span class="material-symbols-rounded text-[32px]">{{ . }}</span> <span class="icon-svg">{{ partial "icon" . }}</span>
{{ end }} {{ end }}
{{ end }} {{ end }}
<div> <div>

View File

@ -2,19 +2,22 @@
{{ with .File }} {{ with .File }}
{{ if not (in .Filename "/_vendor/") }} {{ if not (in .Filename "/_vendor/") }}
<p class="flex items-center gap-2"> <p class="flex items-center gap-2">
<span class="material-symbols-rounded">edit</span> <span class="icon-svg">{{ partial "icon" "edit" }}</span>
<a class="link external-link" target="_blank" rel="noopener" <a class="link external-link" target="_blank" rel="noopener"
href="{{ site.Params.repo }}/edit/main/content/{{ .Path }}">{{ T "editPage" }} href="{{ site.Params.repo }}/edit/main/content/{{ .Path }}">{{ T "editPage" }}
<span class="icon" data-icon="open_in_new"></span> <span class="icon-svg">
</a> {{- partial "icon" "open_in_new" -}}
</span></a>
</p> </p>
{{ end }} {{ end }}
{{ end }} {{ end }}
<p class="flex items-center gap-2"> <p class="flex items-center gap-2">
<span class="material-symbols-rounded">done</span> <span class="icon-svg">{{ partial "icon" "done" }}</span>
<a class="link external-link" target="_blank" rel="noopener" <a class="link external-link" target="_blank" rel="noopener"
href="{{ site.Params.repo }}/issues/new?template=doc_issue.yml&location={{ .Permalink }}&labels=status%2Ftriage">{{ T "requestChanges" }} href="{{ site.Params.repo }}/issues/new?template=doc_issue.yml&location={{ .Permalink }}&labels=status%2Ftriage">{{ T "requestChanges" }}
<span class="icon" data-icon="open_in_new"></span> <span class="icon-svg">
{{- partial "icon" "open_in_new" -}}
</span></a>
</a> </a>
</p> </p>
{{ end }} {{ end }}

View File

@ -39,7 +39,6 @@
<link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,500&display=optional" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,500&display=optional" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto+Mono&display=optional" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto+Mono&display=optional" />
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:FILL@1" rel="stylesheet" />
{{ partial "utils/css.html" . }} {{ partial "utils/css.html" . }}
{{ $theme := resources.Get "js/theme.js" | js.Build (dict "minify" true) }} {{ $theme := resources.Get "js/theme.js" | js.Build (dict "minify" true) }}
<script>{{ $theme.Content | safeJS }}</script> <script>{{ $theme.Content | safeJS }}</script>

View File

@ -9,9 +9,8 @@
} else { } else {
sidebar.classList.replace('md:block', 'md:hidden'); sidebar.classList.replace('md:block', 'md:hidden');
} }
}" class="btn-icon-round menu-btn material-symbols-rounded hidden h-full px-4 md:block" aria-label="Menu" }" class="icon-svg hidden px-4 md:block" aria-label="Menu">
id="menu-btn"> {{ partial "icon" "menu" }}
menu
</button> </button>
<div> <div>
{{/* main logo */}} {{/* main logo */}}
@ -25,11 +24,14 @@
</div> </div>
<div class="flex items-center gap-6"> <div class="flex items-center gap-6">
<div id="docsearch"></div> <div id="docsearch"></div>
<button id="theme-switch" tabindex="1" class="material-symbols-rounded" <button id="theme-switch" tabindex="1" class="svg-icon"
x-data="{ theme: localStorage.getItem('theme-preference') }" x-init="$watch('theme', value => { x-data="{ theme: localStorage.getItem('theme-preference') }" x-init="$watch('theme', value => {
localStorage.setItem('theme-preference', value); localStorage.setItem('theme-preference', value);
document.firstElementChild.className = value; document.firstElementChild.className = value;
})" @click="theme = (theme === 'dark' ? 'light' : 'dark')" x-text="`${theme}_mode`"></button> })" @click="theme = (theme === 'dark' ? 'light' : 'dark')">
<span class="icon-svg dark:hidden">{{ partial "icon" "light_mode"}}</span>
<span class="icon-svg hidden dark:block">{{ partial "icon" "dark_mode"}}</span>
</button>
</div> </div>
</div> </div>