You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
845 B
25 lines
845 B
2 years ago
|
import dynamic from "next/dynamic";
|
||
2 years ago
|
|
||
|
const widgetMappings = {
|
||
2 years ago
|
weatherapi: dynamic(() => import("components/widgets/weather/weather")),
|
||
|
openweathermap: dynamic(() => import("components/widgets/openweathermap/weather")),
|
||
|
resources: dynamic(() => import("components/widgets/resources/resources")),
|
||
|
search: dynamic(() => import("components/widgets/search/search")),
|
||
|
greeting: dynamic(() => import("components/widgets/greeting/greeting")),
|
||
|
datetime: dynamic(() => import("components/widgets/datetime/datetime")),
|
||
2 years ago
|
};
|
||
|
|
||
|
export default function Widget({ widget }) {
|
||
2 years ago
|
const InfoWidget = widgetMappings[widget.type];
|
||
2 years ago
|
|
||
2 years ago
|
if (InfoWidget) {
|
||
|
return <InfoWidget options={widget.options} />;
|
||
2 years ago
|
}
|
||
|
|
||
|
return (
|
||
|
<div className="flex-none flex flex-row items-center justify-center">
|
||
|
Missing <strong>{widget.type}</strong>
|
||
|
</div>
|
||
|
);
|
||
|
}
|