mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 09:39:17 +02:00
See #890: improved report card design, to include relevant context
This commit is contained in:
parent
f48f74dcb3
commit
6e82780e0d
8 changed files with 584 additions and 41 deletions
32
front/src/components/common/ExpandableDiv.vue
Normal file
32
front/src/components/common/ExpandableDiv.vue
Normal file
|
@ -0,0 +1,32 @@
|
|||
<template>
|
||||
<div class="expandable-wrapper">
|
||||
<div :class="['expandable-content', {expandable: truncated.length < content.length}, {expanded: isExpanded}]">
|
||||
<slot>{{ content }}</slot>
|
||||
</div>
|
||||
<a v-if="truncated.length < content.length" role="button" @click.prevent="isExpanded = !isExpanded">
|
||||
<br>
|
||||
<translate v-if="isExpanded" key="1" translate-context="*/*/Button,Label">Show less</translate>
|
||||
<translate v-else key="2" translate-context="*/*/Button,Label">Show more</translate>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import sanitize from "@/sanitize"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
content: {type: String, required: true},
|
||||
length: {type: Number, default: 150, required: false},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
isExpanded: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
truncated () {
|
||||
return this.content.substring(0, this.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue