Flip boolean config
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
'@backstage/plugin-techdocs': minor
|
||||
---
|
||||
|
||||
Add two config values to the `page:techdocs/reader` extension that configure default layout, `withSearch` and `withHeader`. Default are unchanged to `true`.
|
||||
Add two config values to the `page:techdocs/reader` extension that configure default layout, `withoutSearch` and `withoutHeader`. Default are unchanged to `false`.
|
||||
|
||||
E.g. to disable the search and header on the Techdocs Reader Page:
|
||||
|
||||
@@ -11,6 +11,6 @@ app:
|
||||
extensions:
|
||||
- page:techdocs/reader:
|
||||
config:
|
||||
withSearch: false
|
||||
withHeader: false
|
||||
withoutSearch: true
|
||||
withoutHeader: true
|
||||
```
|
||||
|
||||
@@ -5,7 +5,7 @@ app:
|
||||
- sign-in-page:app: false
|
||||
- page:techdocs/reader:
|
||||
config:
|
||||
withSearch: false
|
||||
withoutSearch: true
|
||||
|
||||
backend:
|
||||
baseUrl: http://localhost:3000
|
||||
|
||||
@@ -30,7 +30,7 @@ jest.mock('./config', () => ({
|
||||
{
|
||||
'page:techdocs/reader': {
|
||||
config: {
|
||||
withSearch: false,
|
||||
withoutSearch: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -308,13 +308,13 @@ const _default: OverridableFrontendPlugin<
|
||||
}>;
|
||||
'page:techdocs/reader': OverridableExtensionDefinition<{
|
||||
config: {
|
||||
withSearch: boolean;
|
||||
withHeader: boolean;
|
||||
withoutSearch: boolean;
|
||||
withoutHeader: boolean;
|
||||
path: string | undefined;
|
||||
};
|
||||
configInput: {
|
||||
withSearch?: boolean | undefined;
|
||||
withHeader?: boolean | undefined;
|
||||
withoutSearch?: boolean | undefined;
|
||||
withoutHeader?: boolean | undefined;
|
||||
path?: string | undefined;
|
||||
};
|
||||
output:
|
||||
|
||||
@@ -158,18 +158,12 @@ const techDocsReaderPage = PageBlueprint.makeWithOverrides({
|
||||
},
|
||||
config: {
|
||||
schema: {
|
||||
withSearch: z => z.boolean().default(true),
|
||||
withHeader: z => z.boolean().default(true),
|
||||
withoutSearch: z => z.boolean().default(false),
|
||||
withoutHeader: z => z.boolean().default(false),
|
||||
},
|
||||
},
|
||||
factory(originalFactory, { inputs, config }) {
|
||||
factory(originalFactory, { apis, inputs, config }) {
|
||||
const addonsApi = apis.get(techdocsAddonsApiRef);
|
||||
const addons = inputs.addons.map(output => {
|
||||
const options = output.get(AddonBlueprint.dataRefs.addon);
|
||||
const Addon = options.component;
|
||||
attachTechDocsAddonComponentData(Addon, options);
|
||||
return <Addon key={options.name} />;
|
||||
});
|
||||
|
||||
return originalFactory({
|
||||
path: '/docs/:namespace/:kind/:name',
|
||||
@@ -195,8 +189,8 @@ const techDocsReaderPage = PageBlueprint.makeWithOverrides({
|
||||
return import('../Router').then(({ TechDocsReaderRouter }) => (
|
||||
<TechDocsReaderRouter>
|
||||
<TechDocsReaderLayout
|
||||
withSearch={config.withSearch}
|
||||
withHeader={config.withHeader}
|
||||
withSearch={!config.withoutSearch}
|
||||
withHeader={!config.withoutHeader}
|
||||
/>
|
||||
<TechDocsAddons>{addons}</TechDocsAddons>
|
||||
</TechDocsReaderRouter>
|
||||
|
||||
Reference in New Issue
Block a user