Skip to content

Commit

Permalink
feat(NcListItem): migrate to vue 3
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <[email protected]>
  • Loading branch information
raimund-schluessler committed Oct 31, 2023
1 parent ff400ec commit b07b5b9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
18 changes: 5 additions & 13 deletions src/components/NcListItem/NcListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,10 @@
<!-- This wrapper can be either a router link or a `<li>` -->
<component :is="to ? 'router-link' : 'NcVNodes'"
v-slot="{ href: routerLinkHref, navigate, isActive }"
:custom="to ? true : null"
:to="to"
:exact="to ? exact : null">
v-bind="{ ...to && { custom: true, to } }">
<li class="list-item__wrapper"
:class="{ 'list-item__wrapper--active' : isActive || active }">
:class="{ 'list-item__wrapper--active' : isActive || active }"
v-bind="$attrs">
<a :id="anchorId"
ref="list-item"
:href="routerLinkHref || href"
Expand Down Expand Up @@ -323,6 +322,8 @@ export default {
NcVNodes,
},
inheritAttrs: false,
props: {
/**
* The details text displayed in the upper right part of the component
Expand All @@ -340,15 +341,6 @@ export default {
required: true,
},
/**
* Pass in `true` if you want the matching behavior to
* be non-inclusive: https://router.vuejs.org/api/#exact
*/
exact: {
type: Boolean,
default: false,
},
/**
* The route for the router link.
*/
Expand Down
5 changes: 2 additions & 3 deletions src/components/NcVNodes/NcVNodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ export default {
/**
* The render function to display the component
*
* @param {Function} h The function to create VNodes
* @return {object} The created VNode
*/
render(h) {
return this.vnodes || this.$slots?.default || this.$scopedSlots?.default?.()
render() {
return this.vnodes || this.$slots?.default?.({})
},
}
</script>
3 changes: 1 addition & 2 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ export { default as NcIconSvgWrapper } from './NcIconSvgWrapper/index.js'
// Not exported on purpose as it is only meant as a base component
// export { default as NcInputField } from './NcInputField/index.js'

// Not yet adjusted for vue3
// export { default as NcListItem } from './NcListItem/index.js'
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'
Expand Down
3 changes: 1 addition & 2 deletions styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ module.exports = async () => {
{
name: 'NcListItems',
components: [
//'src/components/NcListItem*/*.vue',
'src/components/NcListItemIcon/*.vue',
'src/components/NcListItem*/*.vue',
],
},
{
Expand Down

0 comments on commit b07b5b9

Please sign in to comment.