-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PR] Add ability for users to add custom pages
- Loading branch information
Showing
18 changed files
with
305 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import { useParams } from 'react-router'; | ||
import { getOverride } from 'veda'; | ||
|
||
import { LayoutProps } from '$components/common/layout-root'; | ||
import { PageMainContent } from '$styles/page'; | ||
import PageHero from '$components/common/page-hero'; | ||
import { FoldProse } from '$components/common/fold'; | ||
import { ContentOverride } from '$components/common/page-overrides'; | ||
import { resourceNotFound } from '$components/uhoh'; | ||
|
||
function UserPages(props: { id: any }) { | ||
const page = getOverride(props.id); | ||
|
||
const params = useParams(); | ||
|
||
if (!page) throw resourceNotFound(); | ||
|
||
return ( | ||
<PageMainContent> | ||
<LayoutProps title='UserPages' /> | ||
<PageHero | ||
title={page.data.title || 'Page title is missing'} | ||
description={page.data.description} | ||
/> | ||
<ContentOverride with={props.id} {...params}> | ||
<FoldProse> | ||
<p>Content for this page comes from the relevant mdx file.</p> | ||
</FoldProse> | ||
</ContentOverride> | ||
</PageMainContent> | ||
); | ||
} | ||
|
||
export default UserPages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Custom pages | ||
|
||
To adapt the Veda dashboard to the individual needs of you instance you can create additional content pages. | ||
|
||
These pages are defined under the `pageOverrides` property of `veda.config.js`. The `key` should be the desired url of the page (staring with a forward slash `/`), and the value should be a path to the MDX file to load. | ||
|
||
```js | ||
pageOverrides: { | ||
'/custom-page': './pages/custom.mdx' | ||
} | ||
``` | ||
|
||
The example above will make a page available at `/custom-page` with the content from the `custom.mdx` file. | ||
|
||
![](./media/custom-page.png) | ||
|
||
## Frontmatter and content | ||
|
||
Each custom page has the following properties: | ||
|
||
**menu** | ||
`string` | ||
The menu label for this page. | ||
|
||
**title** | ||
`string` | ||
Title for this page shown on the header. | ||
|
||
**description** | ||
`string` | ||
Brief optional description of this page, shown on the header. | ||
|
||
The content of the custom pages can be written using the different blocks available. Check the [MDX Blocks documentation](./MDX_BLOCKS.md) to see all the possibilities. | ||
If you are looking for something more custom, check the [creating complex overrides](./PAGE_OVERRIDES.md#creating-complex-overrides) section of PAGE_OVERRIDES. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.