💫 Update MenuConfig To Use ImageItemConfig

This commit is contained in:
Dominic Go 2021-11-20 23:56:12 +08:00
parent e02d96e187
commit e1764385c3
2 changed files with 23 additions and 5 deletions

View File

@ -92,6 +92,13 @@ export type ImageGradientConfig = Partial<Pick<ImageRectConfig,
type?: 'axial' | 'conic' | 'radial'
};
/**
* A configuration object for images.
*
* This configuration object is used to either programmatically create images,
* (e.g. gradients, rects, SFSymbols icons, etc)., or refer to existing image assets
* in the project (e.g. js image assets, XCAssets).
*/
export type ImageItemConfig = {
type: 'IMAGE_ASSET';
/** The corresponding key of asset item in the asset catalog */

View File

@ -29,15 +29,26 @@ export type MenuActionConfig = {
menuAttributes?: MenuAttributes;
discoverabilityTitle?: string;
icon?: IconConfig;
// subtitle - TODO: TBA
/**
* `IconConfig` is deprecated, use `ImageItemConfig` instead.
* Used to configure what icon or image to show in the menu action.
*/
icon?: IconConfig | ImageItemConfig;
};
export type MenuConfig = {
menuTitle: string;
menuOptions?: Array<UIMenuOptions>;
menuItems?: Array<MenuConfig | MenuActionConfig>;
icon?: IconConfig;
/**
* `IconConfig` is deprecated, use `ImageItemConfig` instead.
* Used to configure what icon or image to show in the submenu.
*
* Note: The icon is only shown if the menu is a submenu. If the menu
* is the root menu, the icon will not be visible.
*/
icon?: IconConfig | ImageItemConfig;
};