1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-05-15 17:34:28 -04:00

refactor font loaders/declarations

This commit is contained in:
2025-04-02 13:49:43 -04:00
parent 5c0e473bbe
commit 2b7f3c66a9
21 changed files with 237 additions and 227 deletions
+14
View File
@@ -0,0 +1,14 @@
import hash from "@emotion/hash";
// a little hacky-hack to have react combine all of these css var declarations into a single <style> tag up top. see:
// https://react.dev/reference/react-dom/components/style#rendering-an-inline-css-stylesheet
export const setRootCssVariables = (vars: Record<string, string>) => {
const root = Object.entries(vars)
.map(([key, value]) => `--${key}:${value}`)
.join(";");
return {
href: hash(root),
dangerouslySetInnerHTML: { __html: `:root{${root}}` },
};
};