Skip to content

Commit

Permalink
allow config option on custom pages (keystonejs#2415)
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamsi authored Feb 23, 2020
1 parent d8a7b8a commit 7c552a1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .changeset/light-mirrors-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@keystonejs/app-admin-ui': minor
---

Allowed use of `config` object in custom pages. This enables passing on any custom config or even a function to the custom Page component in `admin-ui`

you can now add config like this

```js
{
label: 'About this project',
path: 'about',
config: {
option: 'value',
},
component: About,
},

```
3 changes: 2 additions & 1 deletion packages/app-admin-ui/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ export const KeystoneAdminUI = () => {
.filter(page => typeof page.path === 'string')
.map(page => {
const Page = page.component;
const config = page.config || {};
return {
path: `${adminPath}/${page.path}`,
component: () => {
return <Page />;
return <Page {...config} />;
},
exact: true,
};
Expand Down

0 comments on commit 7c552a1

Please sign in to comment.