From dd964ed51f2012f2d6b118198a2447ca93b61cef Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 14 Aug 2025 23:19:26 +0200 Subject: [PATCH] refactor(css): use css to scale svg icons There is no need to specify `class="icon"` on al svg icons, as all svg are used as icons anyway. But just in case, let's specify this in the css only for svg directly under `a` and `buttons`, to be on the safe-side. --- internal/template/functions.go | 2 +- internal/ui/static/css/common.css | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/template/functions.go b/internal/template/functions.go index 52d1daaf..6a3be598 100644 --- a/internal/template/functions.go +++ b/internal/template/functions.go @@ -86,7 +86,7 @@ func (f *funcMap) Map() template.FuncMap { "theme_color": model.ThemeColor, "icon": func(iconName string) template.HTML { return template.HTML(fmt.Sprintf( - ``, + ``, route.Path(f.router, "appIcon", "filename", "sprite.svg"), iconName, )) diff --git a/internal/ui/static/css/common.css b/internal/ui/static/css/common.css index d9f1a04a..a7735b57 100644 --- a/internal/ui/static/css/common.css +++ b/internal/ui/static/css/common.css @@ -175,8 +175,8 @@ a:hover { white-space: nowrap; } -#header-menu .icon, -.page-header ul a .icon { +#header-menu a>svg, +.page-header ul a>svg { margin-bottom: 2px; } @@ -929,14 +929,16 @@ article.category-has-unread { } /* Icons */ -.icon, +a>svg, +button>svg, .icon-label { vertical-align: text-bottom; display: inline-block; margin-right: 2px; } -.icon { +a>svg, +button>svg { width: 16px; height: 16px; }