mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-07 22:28:48 +00:00
further restructuring
This commit is contained in:
parent
9b07f3eb90
commit
4386999c38
55 changed files with 224 additions and 224 deletions
24
src/components/widgets/widget.jsx
Normal file
24
src/components/widgets/widget.jsx
Normal file
|
@ -0,0 +1,24 @@
|
|||
import dynamic from "next/dynamic";
|
||||
|
||||
const widgetMappings = {
|
||||
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")),
|
||||
};
|
||||
|
||||
export default function Widget({ widget }) {
|
||||
const InfoWidget = widgetMappings[widget.type];
|
||||
|
||||
if (InfoWidget) {
|
||||
return <InfoWidget options={widget.options} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex-none flex flex-row items-center justify-center">
|
||||
Missing <strong>{widget.type}</strong>
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue