feat: add widget preview pages (#9)

* feat: add widget definition system

* fix: wrong typecheck command in turbo generator

* chore: fix formatting

* feat: add widget preview page

* chore: fix formatting and type errors

* chore: fix from widget edit modal and remove some never casts

* chore: address pull request feedback
This commit is contained in:
Meier Lukas
2024-01-02 15:36:59 +01:00
committed by GitHub
parent fa19966fcc
commit 782897527f
48 changed files with 1226 additions and 81 deletions

View File

@@ -0,0 +1,7 @@
import type { WidgetComponentProps } from "../definition";
export default function WeatherWidget({
options,
}: WidgetComponentProps<"weather">) {
return <pre>{JSON.stringify(options)}</pre>;
}

View File

@@ -0,0 +1,15 @@
import { IconCloud } from "@homarr/ui";
import { createWidgetDefinition } from "../definition";
import { opt } from "../options";
export const { definition, componentLoader } = createWidgetDefinition(
"weather",
{
icon: IconCloud,
options: opt.from((fac) => ({
location: fac.location(),
showCity: fac.switch(),
})),
},
).withDynamicImport(() => import("./component"));