Skip to content

Build your personal knowledge base with Trilium Notes

client/icon pack/preview: display the icon count

Adorian Doran3ff6d1c559e7
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 9f0de34937..763e054787 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1255,7 +1255,9 @@
"preview_title": "Icon pack preview",
"invalid_manifest": "The icon pack manifest could not be parsed. Check that it is valid JSON.",
"no_icons": "This icon pack contains no icons.",
- "tooltip": "Class: {{- class}}\nGlyph code: {{- code}}\nTerms: {{- terms}}"
+ "tooltip": "Class: {{- class}}\nGlyph code: {{- code}}\nTerms: {{- terms}}",
+ "count_one": "{{count}} icon",
+ "count_other": "{{count}} icons"
},
"editable_text": {
"placeholder": "Type the content of your note here...",
diff --git a/apps/client/src/widgets/type_widgets/icon_pack/IconPackPreview.tsx b/apps/client/src/widgets/type_widgets/icon_pack/IconPackPreview.tsx
index 0fc2408888..56cb3a2baa 100644
--- a/apps/client/src/widgets/type_widgets/icon_pack/IconPackPreview.tsx
+++ b/apps/client/src/widgets/type_widgets/icon_pack/IconPackPreview.tsx
@@ -18,7 +18,8 @@ const PREVIEW_CSS_VARS = [
"--main-text-color",
"--main-background-color",
"--hover-item-background-color",
- "--hover-item-text-color"
+ "--hover-item-text-color",
+ "--accented-background-color"
];
interface IconPackPreviewProps {
@@ -65,6 +66,7 @@ export function IconPackPreview({ note, content, interactive = true }: IconPackP
</div>
))}
</div>
+ <div className="ip-count">{t("icon_pack.count", { count: parsed.icons.length })}</div>
</IsolatedFrame>
);
}
diff --git a/apps/client/src/widgets/type_widgets/icon_pack/icon_pack_preview.css b/apps/client/src/widgets/type_widgets/icon_pack/icon_pack_preview.css
index 76940f0958..6ef9d8bc76 100644
--- a/apps/client/src/widgets/type_widgets/icon_pack/icon_pack_preview.css
+++ b/apps/client/src/widgets/type_widgets/icon_pack/icon_pack_preview.css
@@ -3,8 +3,8 @@
* with the dynamically generated @font-face in IconPack.tsx, then injected into the frame's <head> —
* it is intentionally NOT a side-effect import, so these rules never touch the host document.
*
- * The `.ip-glyph` font family must match PREVIEW_FONT_FAMILY in IconPack.tsx.
- * The CSS variables used here should be present in the PREVIEW_CSS_VARS array in IconPack.tsx.
+ * The `.ip-glyph` font family must match PREVIEW_FONT_FAMILY in IconPackPreview.tsx.
+ * The CSS variables used here should be present in the PREVIEW_CSS_VARS array in IconPackPreview.tsx.
*/
html,
@@ -56,3 +56,15 @@ body {
font-size: 32px;
line-height: 1;
}
+
+.ip-count {
+ display: inline-block;
+ position: fixed;
+ right: 16px;
+ bottom: 8px;
+ padding: 4px 8px;
+ border-radius: 6px;
+ font-family: sans-serif;
+ background: var(--accented-background-color, gray);
+ font-size: .85rem;
+}
\ No newline at end of file