Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(DrawerList): refactor jsx examples to tsx #2209

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,19 @@ const data = [
content: ['Item 4 Content A', <>Custom Component</>],
},
]

export const DrawerListExampleOptionsRender = () => (
<Wrapper>
<ComponentBox scope={{ data }} hidePreview hideToolbar>
<DrawerList
options_render={({ Items, Item, data }) => (
<>
<Items />
<Item>Addition</Item>
{data.length > 1 && <li>Addition</li>}
</>
)}
/>
</ComponentBox>
</Wrapper>
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
showTabs: true
---

import { DrawerListExampleOptionsRender } from 'Docs/uilib/components/fragments/drawer-list/Examples'

## Description

The DrawerList component is a fragment inside other components.
Expand Down Expand Up @@ -46,19 +48,7 @@ const data = {

### Example usage of `options_render`

```jsx
render(
<DrawerList
options_render={({ Items, Item, data }) => (
<>
<Items />
<Item>Addition</Item>
{data.length > 1 && <li>Addition</li>}
</>
)}
/>
)
```
<DrawerListExampleOptionsRender />

### data-dnb-drawer-list-active

Expand Down