users/foo-dogsquared: add ability to set icons for custom homepage

This commit is contained in:
Gabriel Arazas 2024-09-10 08:10:02 +08:00
parent f6ac08e3dc
commit a3a3ea98f8
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
6 changed files with 66 additions and 25 deletions

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, foodogsquaredLib, bahaghariLib, ... }: { config, lib, pkgs, foodogsquaredLib, bahaghariLib, ... }@attrs:
let let
inherit (bahaghariLib.tinted-theming) importScheme; inherit (bahaghariLib.tinted-theming) importScheme;
@ -36,6 +36,11 @@ in
flavorText = "For your local productivity"; flavorText = "For your local productivity";
textOnly = true; textOnly = true;
weight = (-50); weight = (-50);
icon = {
iconset = "material-design-icons";
name = "room-service";
};
}; };
} }
@ -50,6 +55,13 @@ in
text = "ArchiveBox webserver"; text = "ArchiveBox webserver";
}); });
}) })
(lib.mkIf (attrs.nixosConfig.suites.filesystem.setups.archive.enable or false) {
YOHOOHOOHOOHOO.links = lib.mkBefore (lib.singleton {
url = "file://${attrs.nixosConfig.state.paths.archive}";
text = "Personal archive";
});
})
]; ];
}; };
}; };

View File

@ -11,26 +11,40 @@ body {
min-height: 100%; min-height: 100%;
margin: 0; margin: 0;
background: var(--background); background: var(--background);
font-family: "Source Sans Pro", sans-serif;
} }
#links { #links {
--width: 30ch; --width: 30ch;
--gap: 0.5em;
--header-font-size: 1.5em;
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--width), 1fr)); grid-template-columns: repeat(auto-fill, minmax(var(--width), 1fr));
grid-template-rows: max-content; grid-template-rows: max-content;
gap: 0.5em; gap: var(--gap);
margin: calc(var(--gap) * 2);
section[id^="section-"] { section[id^="section-"] {
background: var(--foreground); background: var(--foreground);
color: var(--background); color: var(--background);
font-family: sans-serif;
border: 0.5em solid var(--accent-color); border: var(--gap) solid var(--accent-color);
padding: 1rem; padding: calc(var(--gap) * 2);
text-align: center; text-align: center;
.nav-icon {
color: currentColor;
fill: currentColor;
svg {
--size: calc(var(--header-font-size) * 2);
width: var(--size);
height: var(--size);
}
}
.nav-header { .nav-header {
font-size: 1.5em; font-size: var(--header-font-size);
font-weight: bolder; font-weight: bolder;
} }

View File

@ -10,7 +10,8 @@ links = [
{ url = "https://login.tailscale.com", text = "Tailscale" }, { url = "https://login.tailscale.com", text = "Tailscale" },
{ url = "https://devdocs.io", text = "Devdocs" }, { url = "https://devdocs.io", text = "Devdocs" },
] ]
grid.row = 2 icon.iconset = "material-design-icons"
icon.name = "fast-forward"
[applications] [applications]
name = "Applications" name = "Applications"
@ -23,6 +24,8 @@ links = [
{ url = "https://pass.foodogsquared.one", icon = "bitwarden", text = "Password manager" }, { url = "https://pass.foodogsquared.one", icon = "bitwarden", text = "Password manager" },
{ url = "https://monitoring.foodogsquared.one", icon = "grafana", text = "Monitoring application" }, { url = "https://monitoring.foodogsquared.one", icon = "grafana", text = "Monitoring application" },
] ]
icon.iconset = "material-design-icons"
icon.name = "developer-board"
[dev] [dev]
name = "Software dev" name = "Software dev"
@ -35,19 +38,27 @@ links = [
{ url = "https://vscode.dev", text = "Online Visual Studio Code" }, { url = "https://vscode.dev", text = "Online Visual Studio Code" },
{ url = "https://cloud.oracle.com", text = "Oracle Cloud" }, { url = "https://cloud.oracle.com", text = "Oracle Cloud" },
{ url = "https://cloud.hetzner.com", text = "Hetzner Cloud" }, { url = "https://cloud.hetzner.com", text = "Hetzner Cloud" },
{ url = "https://portal.azure.com", text = "Azure Cloud" },
{ url = "https://manpages.debian.org", text = "Debian Manpages" },
] ]
grid.row = 2 grid.row = 2
icon.iconset = "simple-icons"
icon.name = "github"
[design] [design]
name = "Design" name = "Design"
flavorText = "No matter how hard I try, it's pretty crap" flavorText = "No matter how hard I try, it's pretty crap"
textOnly = true textOnly = true
links = [ links = [
{ url = "https://app.diagrams.net/", text = "lazy way of drawing things" },
{ url = "https://figma.com", text = "Figma..." },
{ url = "https://www.awwwards.com/", text = "Awwwards" }, { url = "https://www.awwwards.com/", text = "Awwwards" },
{ url = "https://dribbble.com", text = "Dribbble" }, { url = "https://dribbble.com", text = "Dribbble" },
{ url = "https://simpleicons.org/", text = "Simple Icons" }, { url = "https://simpleicons.org/", text = "Simple Icons" },
{ url = "https://pictogrammers.com/library/mdi/", text = "Material Design Icons" }, { url = "https://pictogrammers.com/library/mdi/", text = "Material Design Icons" },
] ]
icon.iconset = "material-design-icons"
icon.name = "pencil-ruler"
[music] [music]
name = "Music" name = "Music"
@ -59,10 +70,12 @@ links = [
{ url = "https://www.last.fm", text = "last.fm" }, { url = "https://www.last.fm", text = "last.fm" },
{ url = "https://modarchive.org/", text = "The Mod Archive" }, { url = "https://modarchive.org/", text = "The Mod Archive" },
] ]
icon.iconset = "material-design-icons"
icon.name = "music"
[YOHOOHOOHOOHOO] [YOHOOHOOHOOHOO]
name = "🏴💀🏴" name = "YOHOOHOOHOOHOO"
flavorText = "Sailing on the high seas" flavorText = "Fly away, glum blue sea"
textOnly = true textOnly = true
weight = 100 weight = 100
links = [ links = [
@ -72,3 +85,5 @@ links = [
{ url = "https://annas-archive.se/", text = "Anna's Archive" }, { url = "https://annas-archive.se/", text = "Anna's Archive" },
{ url = "https://archive.softwareheritage.org", text = "Software Heritage" }, { url = "https://archive.softwareheritage.org", text = "Software Heritage" },
] ]
icon.iconset = "material-design-icons"
icon.name = "skull-crossbones"

View File

@ -11,14 +11,16 @@
{{- $name := default $key $value.name -}} {{- $name := default $key $value.name -}}
<section <section
id="section-{{ $name }}" id="section-{{ $name }}"
tabindex="1"
{{ with $value.grid }} {{ with $value.grid }}
style="{{ with .column }}grid-column: span {{ . }};{{ end }}{{ with .row }}grid-row: span {{ . }};{{ end }}" style="{{ with .column }}grid-column: span {{ . }};{{ end }}{{ with .row }}grid-row: span {{ . }};{{ end }}"
{{ end }} {{ end }}
> >
<span class="nav-header">{{ $name }}</span> {{ with $value.icon }}
<div class="nav-icon">{{ partial "icon.html" . }}</div>
{{ end }}
<div class="nav-header">{{ $name }}</div>
{{ with $value.flavorText }} {{ with $value.flavorText }}
<span class="flavor-text">{{ . }}</span> <div class="flavor-text">{{ . }}</div>
{{ end }} {{ end }}
<hr /> <hr />

View File

@ -1,15 +1,13 @@
{{- /* {{- /*
A partial for easily using icons from Simple Icons set. A partial for easily using icons from Simple Icons set.
*/ -}} */ -}}
{{- $name := default .id .name }} {{ if eq .iconset "simple-icons" }}
{{- $iconset := .iconset }} {{- $res := resources.ExecuteAsTemplate (printf "svg/brands/%s.svg" .name)
(dict "id" .name
{{- $output := cond "" "" "" }} "name" .name)
{{- $template := cond "" "" "" }} (resources.Get "templates/simple-icon.svg") }}
{{- $res := resources.ExecuteAsTemplate (printf $output .id) {{ $res.Content | safeHTML }}
(dict "id" .id {{ else if eq .iconset "material-design-icons" }}
"name" $name) {{- $res := resources.Get (printf "svg/material-design-icons/%s.svg" .name) }}
(resources.Get $template) }} {{ $res.Content | safeHTML }}
<svg class="site__icon"> {{ end }}
<use href="{{ $res.RelPermalink }}#{{ $name }}"></use>
</svg>

View File

@ -5,7 +5,7 @@
buildHugoSite { buildHugoSite {
pname = "foodogsquared-hm-startpage"; pname = "foodogsquared-hm-startpage";
version = "0.2.0"; version = "0.3.0";
src = lib.cleanSource ./.; src = lib.cleanSource ./.;
vendorHash = "sha256-Mi61QK1yKWIneZ+i79fpJqP9ew5r5vnv7ptr9YGq0Uk="; vendorHash = "sha256-Mi61QK1yKWIneZ+i79fpJqP9ew5r5vnv7ptr9YGq0Uk=";