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

[next] fix(NcVNodes): add re-export in root export and add docs #5667

Merged
merged 3 commits into from
Jun 10, 2024
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
49 changes: 49 additions & 0 deletions src/components/NcVNodes/NcVNodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,55 @@
-
-->

<docs>
A util component to render a VNode or an array of VNodes from the prop or the default slot.

### Render the given or generated VNodes

```vue
<template>
<NcVNodes :vnodes="renderDiv()" />
</template>

<script>
import { h } from 'vue'

export default {
methods: {
renderDiv() {
return h('div', 'This div was created programmatically as a VNode')
},
}
}
</script>
```

### Render content in a conditional wrapper

```vue
<template>
<div>
<p>
<NcCheckboxRadioSwitch v-model="shouldRenderNcNoteCard">Render text inside "NcNoteCard"</NcCheckboxRadioSwitch>
</p>
<component :is="shouldRenderNcNoteCard ? 'NcNoteCard' : 'NcVNodes'">
<p>This content is rendered {{ shouldRenderNcNoteCard ? 'with' : 'without' }} a "NcNoteCard" wrapper</p>
</component>
</div>
</template>

<script>
export default {
data() {
return {
shouldRenderNcNoteCard: true,
}
},
}
</script>
```
</docs>

<script>
export default {
name: 'NcVNodes',
Expand Down
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export { default as NcListItem } from './NcListItem/index.js'
export { default as NcListItemIcon } from './NcListItemIcon/index.js'
export { default as NcLoadingIcon } from './NcLoadingIcon/index.js'
export { default as NcModal } from './NcModal/index.js'
export { default as NcVNodes } from './NcVNodes/index.js'
export { default as NcNoteCard } from './NcNoteCard/index.js'
export { default as NcPasswordField } from './NcPasswordField/index.js'
export { default as NcPopover } from './NcPopover/index.js'
Expand Down
1 change: 0 additions & 1 deletion styleguide.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ module.exports = async () => {
'src/components/NcSettings*/*.vue',
'src/components/NcTextArea/*.vue',
'src/components/NcUserBubble/NcUserBubbleDiv.vue',
'src/components/NcVNodes*/*.vue',
],
sections: [
{
Expand Down
Loading