Skip to content

Commit

Permalink
add custom sections readme
Browse files Browse the repository at this point in the history
  • Loading branch information
scespinoza committed Mar 29, 2023
1 parent fc60ab2 commit 8dcffe9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions example-next/pages/profile/[...members].js
Expand Up @@ -26,6 +26,8 @@ function ProfilePage({profile, formatters}) {
profile={profile}
linkify={profile => profile.reduce((href, member) => `${href}/${member.slug}/${member.memberSlug || member.id}`, "/profile")}
// you can also specify the configuration for ProfileSearch here:
searchProps={{placeholder: "Seach profiles"}}
// and your custom sections mapping object:
customSections={customSections}
t={t}
/>
Expand Down
27 changes: 27 additions & 0 deletions packages/next/README.md
Expand Up @@ -121,3 +121,30 @@ export default function App(props) {
}

```

## Custom Sections

If your CMS instance implements Custom Section, you can add custom JSX renderers to your profiles by passing a mapping object to the `Profile` component. For more information on the usage of Custom Sections see the `canon-cms` [documentation](https://github.com/Datawheel/canon/tree/master/packages/cms#custom-sections).

Example:

```jsx

...

const customSections = {
CustomSectionName: CustomSectionComponent
}

export default function ProfilePage(props) {
(...)
return (
<Profile
(...)
customSections={customSections}
/>
);
}
...

```

0 comments on commit 8dcffe9

Please sign in to comment.