From 09b9b76c8f55a4617c64d1d15981a8da8a84de03 Mon Sep 17 00:00:00 2001 From: wz2k <87819279+wz2k@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:14:28 +0800 Subject: [PATCH] refactor: rename MenuItemConfig to ComponentConfig for clarity --- helpers/factory.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/helpers/factory.tsx b/helpers/factory.tsx index 0b23125..a42e002 100644 --- a/helpers/factory.tsx +++ b/helpers/factory.tsx @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { FC } from "react"; -interface MenuItemConfig { +interface ComponentConfig { Component: FC; key: string; getProps: (baseProps: any) => any; @@ -9,14 +9,15 @@ interface MenuItemConfig { } export interface FactoryConfig { - items: MenuItemConfig[]; + items: ComponentConfig[]; } export const createDynamicComponentFactory = (config: FactoryConfig) => ({ generateItems: (baseProps: any) => { return config.items .filter( - (itemConfig) => !itemConfig.condition || itemConfig.condition(baseProps) + (componentConfig) => + !componentConfig.condition || componentConfig.condition(baseProps) ) .map(({ Component, key, getProps }) => (