Make title a more optional parameter
Signed-off-by: ivgo <ivgo@spreadgroup.com>
This commit is contained in:
@@ -55,7 +55,7 @@ export type ComponentRenderer = {
|
||||
|
||||
// @public
|
||||
export function createCardExtension<T>(options: {
|
||||
title: string;
|
||||
title?: string;
|
||||
components: () => Promise<ComponentParts>;
|
||||
name?: string;
|
||||
description?: string;
|
||||
@@ -65,14 +65,14 @@ export function createCardExtension<T>(options: {
|
||||
|
||||
// @public (undocumented)
|
||||
export type RendererProps = {
|
||||
title: string;
|
||||
title?: string;
|
||||
} & ComponentParts;
|
||||
|
||||
// @public (undocumented)
|
||||
export const SettingsModal: (props: {
|
||||
open: boolean;
|
||||
close: Function;
|
||||
componentName: string;
|
||||
componentName?: string;
|
||||
children: JSX.Element;
|
||||
}) => JSX.Element;
|
||||
```
|
||||
|
||||
@@ -27,14 +27,16 @@ import {
|
||||
export const SettingsModal = (props: {
|
||||
open: boolean;
|
||||
close: Function;
|
||||
componentName: string;
|
||||
componentName?: string;
|
||||
children: JSX.Element;
|
||||
}) => {
|
||||
const { open, close, componentName, children } = props;
|
||||
|
||||
return (
|
||||
<Dialog open={open} onClose={() => close()}>
|
||||
<DialogTitle>Settings - {componentName}</DialogTitle>
|
||||
<DialogTitle>
|
||||
{componentName ? `Settings - ${componentName}` : 'Settings'}
|
||||
</DialogTitle>
|
||||
<DialogContent>{children}</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => close()} color="primary" variant="contained">
|
||||
|
||||
@@ -42,7 +42,7 @@ export type ComponentParts = {
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type RendererProps = { title: string } & ComponentParts;
|
||||
export type RendererProps = { title?: string } & ComponentParts;
|
||||
|
||||
/**
|
||||
* @public
|
||||
@@ -79,7 +79,7 @@ export type CardConfig = {
|
||||
* @public
|
||||
*/
|
||||
export function createCardExtension<T>(options: {
|
||||
title: string;
|
||||
title?: string;
|
||||
components: () => Promise<ComponentParts>;
|
||||
name?: string;
|
||||
description?: string;
|
||||
@@ -113,7 +113,6 @@ export function createCardExtension<T>(options: {
|
||||
|
||||
type CardExtensionComponentProps<T> = CardExtensionProps<T> &
|
||||
ComponentParts & {
|
||||
title: string;
|
||||
isCustomizable?: boolean;
|
||||
overrideTitle?: string;
|
||||
};
|
||||
@@ -137,7 +136,7 @@ function CardExtension<T>(props: CardExtensionComponentProps<T>) {
|
||||
return (
|
||||
<Suspense fallback={<Progress />}>
|
||||
<Renderer
|
||||
title={title}
|
||||
{...(title && { title })}
|
||||
{...{
|
||||
Content,
|
||||
...(Actions ? { Actions } : {}),
|
||||
@@ -151,7 +150,7 @@ function CardExtension<T>(props: CardExtensionComponentProps<T>) {
|
||||
}
|
||||
|
||||
const cardProps = {
|
||||
title: title,
|
||||
...(title && { title }),
|
||||
...(Settings && !isCustomizable
|
||||
? {
|
||||
action: (
|
||||
|
||||
Reference in New Issue
Block a user