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
inherit (bahaghariLib.tinted-theming) importScheme;
@ -36,6 +36,11 @@ in
flavorText = "For your local productivity";
textOnly = true;
weight = (-50);
icon = {
iconset = "material-design-icons";
name = "room-service";
};
};
}
@ -50,6 +55,13 @@ in
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%;
margin: 0;
background: var(--background);
font-family: "Source Sans Pro", sans-serif;
}
#links {
--width: 30ch;
--gap: 0.5em;
--header-font-size: 1.5em;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--width), 1fr));
grid-template-rows: max-content;
gap: 0.5em;
gap: var(--gap);
margin: calc(var(--gap) * 2);
section[id^="section-"] {
background: var(--foreground);
color: var(--background);
font-family: sans-serif;
border: 0.5em solid var(--accent-color);
padding: 1rem;
border: var(--gap) solid var(--accent-color);
padding: calc(var(--gap) * 2);
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 {
font-size: 1.5em;
font-size: var(--header-font-size);
font-weight: bolder;
}

View File

@ -10,7 +10,8 @@ links = [
{ url = "https://login.tailscale.com", text = "Tailscale" },
{ url = "https://devdocs.io", text = "Devdocs" },
]
grid.row = 2
icon.iconset = "material-design-icons"
icon.name = "fast-forward"
[applications]
name = "Applications"
@ -23,6 +24,8 @@ links = [
{ url = "https://pass.foodogsquared.one", icon = "bitwarden", text = "Password manager" },
{ url = "https://monitoring.foodogsquared.one", icon = "grafana", text = "Monitoring application" },
]
icon.iconset = "material-design-icons"
icon.name = "developer-board"
[dev]
name = "Software dev"
@ -35,19 +38,27 @@ links = [
{ url = "https://vscode.dev", text = "Online Visual Studio Code" },
{ url = "https://cloud.oracle.com", text = "Oracle 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
icon.iconset = "simple-icons"
icon.name = "github"
[design]
name = "Design"
flavorText = "No matter how hard I try, it's pretty crap"
textOnly = true
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://dribbble.com", text = "Dribbble" },
{ url = "https://simpleicons.org/", text = "Simple Icons" },
{ url = "https://pictogrammers.com/library/mdi/", text = "Material Design Icons" },
]
icon.iconset = "material-design-icons"
icon.name = "pencil-ruler"
[music]
name = "Music"
@ -59,10 +70,12 @@ links = [
{ url = "https://www.last.fm", text = "last.fm" },
{ url = "https://modarchive.org/", text = "The Mod Archive" },
]
icon.iconset = "material-design-icons"
icon.name = "music"
[YOHOOHOOHOOHOO]
name = "🏴💀🏴"
flavorText = "Sailing on the high seas"
name = "YOHOOHOOHOOHOO"
flavorText = "Fly away, glum blue sea"
textOnly = true
weight = 100
links = [
@ -72,3 +85,5 @@ links = [
{ url = "https://annas-archive.se/", text = "Anna's Archive" },
{ 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 -}}
<section
id="section-{{ $name }}"
tabindex="1"
{{ with $value.grid }}
style="{{ with .column }}grid-column: span {{ . }};{{ end }}{{ with .row }}grid-row: span {{ . }};{{ 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 }}
<span class="flavor-text">{{ . }}</span>
<div class="flavor-text">{{ . }}</div>
{{ end }}
<hr />

View File

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

View File

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