Updated the customization.md

Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
bnechyporenko
2022-07-07 10:38:37 +02:00
parent 6f4678a285
commit 68209b33fd
+17 -9
View File
@@ -18,11 +18,12 @@ customizable elements. For example
```typescript jsx
const plugin = createPlugin({
id: 'my-plugin',
configure(options?: PluginInputOptions): PluginOptions {
const defaultOptions = { createButtonTitle: 'Create' };
if (!options) {
return defaultOptions;
}
__experimentalConfigure(
options?: CatalogInputPluginOptions,
): CatalogPluginOptions {
const defaultOptions = {
createButtonTitle: 'Create',
};
return { ...defaultOptions, ...options };
},
});
@@ -31,12 +32,19 @@ const plugin = createPlugin({
And the rendering part of the exposed component can retrieve that metadata as:
```typescript jsx
export type CatalogPageOptionsProps = {
export type CatalogPluginOptions = {
createButtonTitle: string;
};
export type CatalogInputPluginOptions = {
createButtonTitle: string;
};
export const useCatalogPluginOptions = () =>
usePluginOptions<CatalogPluginOptions>();
export function DefaultMyPluginWelcomePage() {
const { createButtonTitle } = usePluginOptions<CatalogPageOptionsProps>();
const { createButtonTitle } = useCatalogPluginOptions();
return (
<div>
@@ -54,7 +62,7 @@ plugin. Example:
```typescript jsx
import { myPlugin } from '@backstage/my-plugin';
myPlugin.reconfigure({
createButtonTitle: 'Maybe Create',
myPlugin.__experimentalReconfigure({
createButtonTitle: 'New',
});
```