✨ Change rendering from id to type
This commit is contained in:
@@ -6,7 +6,7 @@ import ErrorBoundary from './boundary';
|
||||
import { IWidget } from './widgets';
|
||||
|
||||
interface WidgetWrapperProps {
|
||||
widgetId: string;
|
||||
widgetType: string;
|
||||
widget: IWidget<string, any>;
|
||||
className: string;
|
||||
WidgetComponent: ComponentType<{ widget: IWidget<string, any> }>;
|
||||
@@ -14,7 +14,7 @@ interface WidgetWrapperProps {
|
||||
|
||||
// If a property has no value, set it to the default value
|
||||
const useWidget = <T extends IWidget<string, any>>(widget: T): T => {
|
||||
const definition = Widgets[widget.id as keyof typeof Widgets];
|
||||
const definition = Widgets[widget.type as keyof typeof Widgets];
|
||||
|
||||
return useMemo(() => {
|
||||
const newProps = { ...widget.properties };
|
||||
@@ -33,7 +33,7 @@ const useWidget = <T extends IWidget<string, any>>(widget: T): T => {
|
||||
};
|
||||
|
||||
export const WidgetWrapper = ({
|
||||
widgetId,
|
||||
widgetType: widgetId,
|
||||
widget,
|
||||
className,
|
||||
WidgetComponent,
|
||||
|
||||
Reference in New Issue
Block a user