add greeting and datetime info widgets

This commit is contained in:
Ben Phelps 2022-09-16 10:53:12 +03:00
parent 43f7ccd166
commit 0075429e08
4 changed files with 66 additions and 4 deletions

View file

@ -2,6 +2,8 @@ import WeatherApi from "components/widgets/weather/weather";
import OpenWeatherMap from "components/widgets/openweathermap/weather";
import Resources from "components/widgets/resources/resources";
import Search from "components/widgets/search/search";
import Greeting from "components/widgets/greeting/greeting";
import DateTime from "components/widgets/datetime/datetime";
const widgetMappings = {
weather: WeatherApi, // This key will be deprecated in the future
@ -9,13 +11,15 @@ const widgetMappings = {
openweathermap: OpenWeatherMap,
resources: Resources,
search: Search,
greeting: Greeting,
datetime: DateTime,
};
export default function Widget({ widget }) {
const ServiceWidget = widgetMappings[widget.type];
const InfoWidget = widgetMappings[widget.type];
if (ServiceWidget) {
return <ServiceWidget options={widget.options} />;
if (InfoWidget) {
return <InfoWidget options={widget.options} />;
}
return (