Skip to content

Commit def374d

Browse files
authored
Merge pull request #6975 from nextcloud-libraries/backport/6932/stable8
2 parents 0391bb8 + 522eb37 commit def374d

2 files changed

Lines changed: 43 additions & 17 deletions

File tree

src/assets/action.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,16 @@
109109
overflow: hidden;
110110
white-space: nowrap;
111111
max-width: 100%;
112-
display: inline-block;
112+
display: block;
113+
}
114+
115+
&__description {
116+
display: block;
117+
white-space: pre-wrap;
118+
font-size: var(--font-size-small);
119+
line-height: var(--default-line-height);
120+
color: var(--color-text-maxcontrast);
121+
cursor: pointer;
113122
}
114123

115124
&__menu-icon {

src/components/NcActionButton/NcActionButton.vue

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ This component is made to be used inside of the [NcActions](#NcActions) componen
5353
</script>
5454
```
5555

56-
If you're using a long text you can specify a name
56+
If you're using a long text, you can specify a `name` prop.
57+
58+
For the same purpose, but in a more compact way, `description` prop can be used.
5759

5860
```vue
5961
<template>
@@ -70,15 +72,23 @@ If you're using a long text you can specify a name
7072
</template>
7173
This button is associated with a very long text.\nAnd with new lines too.
7274
</NcActionButton>
75+
<NcActionButton description="Subline description for the button" @click="showMessage('Edit')">
76+
<template #icon>
77+
<Pencil :size="20" />
78+
</template>
79+
Edit
80+
</NcActionButton>
7381
</NcActions>
7482
</template>
7583
<script>
7684
import Delete from 'vue-material-design-icons/Delete.vue'
85+
import Pencil from 'vue-material-design-icons/Pencil.vue'
7786
import Plus from 'vue-material-design-icons/Plus.vue'
7887

7988
export default {
8089
components: {
8190
Delete,
91+
Pencil,
8292
Plus,
8393
},
8494
methods: {
@@ -333,27 +343,26 @@ export default {
333343
</slot>
334344

335345
<!-- long text with name -->
336-
<span v-if="name"
337-
class="action-button__longtext-wrapper">
338-
<strong class="action-button__name">
346+
<span class="action-button__longtext-wrapper">
347+
<strong v-if="name"
348+
class="action-button__name">
339349
{{ name }}
340350
</strong>
341-
<br>
342351
<!-- white space is shown on longtext, so we can't
343352
put {{ text }} on a new line for code readability -->
344-
<span class="action-button__longtext" v-text="text" />
353+
<span v-if="isLongText"
354+
class="action-button__longtext"
355+
v-text="text" />
356+
<!-- default text display -->
357+
<span v-else
358+
class="action-button__text">
359+
{{ text }}
360+
</span>
361+
<span v-if="description"
362+
class="action-button__description"
363+
v-text="description" />
345364
</span>
346365

347-
<!-- long text only -->
348-
<!-- white space is shown on longtext, so we can't
349-
put {{ text }} on a new line for code readability -->
350-
<span v-else-if="isLongText"
351-
class="action-button__longtext"
352-
v-text="text" />
353-
354-
<!-- default text display -->
355-
<span v-else class="action-button__text">{{ text }}</span>
356-
357366
<!-- right(in LTR) or left(in RTL) arrow icon when there is a sub-menu -->
358367
<ChevronRightIcon v-if="isMenu && !isRtl" :size="20" class="action-button__menu-icon" />
359368
<ChevronLeftIcon v-else-if="isMenu && isRtl" :size="20" class="action-button__menu-icon" />
@@ -456,6 +465,14 @@ export default {
456465
type: String,
457466
default: null,
458467
},
468+
469+
/**
470+
* Small underlying text content of the entry
471+
*/
472+
description: {
473+
type: String,
474+
default: '',
475+
},
459476
},
460477
setup() {
461478
return {

0 commit comments

Comments
 (0)