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

feat(NcListItem): introduce 'details' slot #5146

Merged
merged 1 commit into from
Jan 28, 2024
Merged
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
26 changes: 17 additions & 9 deletions src/components/NcListItem/NcListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@
:name="'This is an active element with normal counter'"
:bold="false"
:active="true"
:details="'1h'"
:counter-number="44">
<template #icon>
<NcAvatar :size="44" user="janedoe" display-name="Jane Doe" />
</template>
<template #subname>
In this slot you can put both text and other components such as icons
</template>
<template #details>
<LinkIcon :size="16"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it not be 20 as that's our default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as bubble icon below, and close to the font size. But that's up to end developer anyway, I believe

</template>
<template #indicator>
<!-- Color dot -->
<CheckboxBlankCircle :size="16" fill-color="#fff" />
Expand Down Expand Up @@ -194,6 +196,9 @@
<template #subname>
In this slot you can put both text and other components such as icons
</template>
<template #details>
<LinkIcon :size="16"/>
</template>
<template #indicator>
<!-- Color dot -->
<CheckboxBlankCircle :size="16" fill-color="#0082c9"/>
Expand Down Expand Up @@ -230,10 +235,12 @@

<script>
import CheckboxBlankCircle from 'vue-material-design-icons/CheckboxBlankCircle'
import LinkIcon from 'vue-material-design-icons/Link'

export default {
components: {
CheckboxBlankCircle,
LinkIcon,
}
}
</script>
Expand Down Expand Up @@ -345,7 +352,8 @@
</span>
<span v-if="showDetails"
class="line-one__details">
{{ details }}
<!-- @slot This slot is used for some details in form of icon (prop `details` as a fallback) -->
<slot name="details">{{ details }}</slot>
</span>
</div>

Expand Down Expand Up @@ -566,15 +574,11 @@ export default {
displayActionsOnHoverFocus: false,
menuOpen: false,
hasIndicator: false,
hasDetails: false,
}
},

computed: {

hasDetails() {
return this.details !== ''
},

oneLine() {
return !this.hasSubname && !this.showDetails
},
Expand All @@ -584,7 +588,8 @@ export default {
},

showDetails() {
return this.hasDetails && (!this.displayActionsOnHoverFocus || this.forceDisplayActions)
return (this.details !== '' || this.hasDetails)
&& (!this.displayActionsOnHoverFocus || this.forceDisplayActions)
},

computedActionsAriaLabel() {
Expand Down Expand Up @@ -702,6 +707,9 @@ export default {
if (this.hasIndicator !== !!this.$slots.indicator) {
this.hasIndicator = !!this.$slots.indicator
}
if (this.hasDetails !== !!this.$slots.details) {
this.hasDetails = !!this.$slots.details
}
},
},
}
Expand Down Expand Up @@ -822,7 +830,7 @@ export default {

&__details {
color: var(--color-text-maxcontrast);
margin: 0 8px;
margin: 0 9px;
font-weight: normal;
}
}
Expand Down
Loading