Skip to content

Commit

Permalink
Please the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Comeza committed May 24, 2024
1 parent 4163f7f commit 0b78531
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
8 changes: 3 additions & 5 deletions liberica/src/lib/theme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import THEMES_JSON from "assets/themes.json";
import Values from "values.js"
import Values from "values.js";

export const THEMES: Record<string, Theme> = THEMES_JSON;

Expand All @@ -11,15 +11,13 @@ export interface Theme {
accent: string;
}



export function applyTheme(theme: Theme) {
const style = document.documentElement.style;
for (const key of Object.keys(theme)) {
const shades = new Values(theme[key as keyof Theme], "base").all(22);
for (const [i, shade] of shades.entries()) {
style.setProperty(`--${key}-${i * 100 + 100}`, '#' + shade.hex);
const name = (i * 100 + 100).toString();
style.setProperty(`--${key}-${name}`, "#" + shade.hex);
}
}
}

2 changes: 1 addition & 1 deletion liberica/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ i18n.use(LanguageDetector)
e instanceof Error && console.error("i18n init error", e.message),
);

applyTheme(THEMES["Lila Pause"])
applyTheme(THEMES["Lila Pause"]);

const rootElement = document.getElementById("root") as HTMLElement;
ReactDOM.createRoot(rootElement).render(
Expand Down
6 changes: 1 addition & 5 deletions liberica/src/page/Admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ import { useTranslation } from "react-i18next";

export function Admin() {
const { t } = useTranslation();

return <>
<div className="h-10 w-10 m-10 rounded-md bg-cyan-500" />
<div className="h-10 w-10 m-10 rounded-md bg-surface" />
</>;
return <>{t("AdminPage")}</>;
}

0 comments on commit 0b78531

Please sign in to comment.