Skip to content

Commit

Permalink
docs(DrawerList): refactor jsx examples to tsx (#2209)
Browse files Browse the repository at this point in the history
  • Loading branch information
langz committed May 31, 2023
1 parent 0e05d32 commit 3f32856
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
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

0 comments on commit 3f32856

Please sign in to comment.