14 lines
440 B
TypeScript
14 lines
440 B
TypeScript
import type { ComponentType } from "react";
|
|||
|
|
import type { Widget } from "@/lib/config/schema";
|
||
|
|
import { BookmarkWidget } from "./bookmark/Widget";
|
||
|
|
import { SearchWidget } from "./search/Widget";
|
||
|
|
|
||
|
|
type WidgetComponent<T extends Widget["type"]> = ComponentType<{
|
||
|
|
widget: Extract<Widget, { type: T }>;
|
||
|
|
}>;
|
||
|
|
|
||
|
|
export const widgetRegistry: { [K in Widget["type"]]: WidgetComponent<K> } = {
|
||
|
|
bookmark: BookmarkWidget,
|
||
|
|
search: SearchWidget,
|
||
|
|
};
|