Skip to content

Commit feb9ca9

Browse files
committed
Extract l10n
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
1 parent 0581e16 commit feb9ca9

File tree

3 files changed

+40
-28
lines changed

3 files changed

+40
-28
lines changed

l10n/messages.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ msgstr ""
5858
msgid "No emoji found"
5959
msgstr ""
6060

61-
#: src/components/Multiselect/Multiselect.vue:174
61+
#: src/components/Multiselect/Multiselect.vue:213
6262
#: src/components/MultiselectTags/MultiselectTags.vue:78
6363
#: src/components/SettingsSelectGroup/SettingsSelectGroup.vue:38
6464
msgid "No results"

src/components/ListItemIcon/ListItemIcon.vue

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ It might be used for list rendering or within the multiselect for example
2727

2828
```vue
2929
<ListItemIcon title="User 1" />
30+
<ListItemIcon title="User 1" subtitle="Hidden subtitle because size is too small" :avatar-size="24" />
3031
```
3132
```vue
32-
<ListItemIcon title="User 1" :size="44" icon="icon-user" />
33+
<ListItemIcon title="User 1" :avatar-size="44" icon="icon-user" />
3334
```
3435

3536
### With icon
@@ -71,7 +72,7 @@ It might be used for list rendering or within the multiselect for example
7172
:text="title"
7273
:search="search" />
7374
<Highlight
74-
v-if="subtitle !== ''"
75+
v-if="isValidSubtitle && isSizeBigEnough"
7576
class="option__linetwo"
7677
:text="subtitle"
7778
:search="search" />
@@ -92,7 +93,9 @@ import Avatar from '../Avatar'
9293
import Highlight from '../Highlight'
9394
import { userStatus } from '../../mixins'
9495
95-
const margin = 6
96+
// global margin, ^2 ratio
97+
const margin = 8
98+
const defaultSize = 32
9699
97100
export default {
98101
name: 'ListItemIcon',
@@ -114,6 +117,7 @@ export default {
114117
115118
/**
116119
* Secondary optional line
120+
* Only visible on size of 32 and above
117121
*/
118122
subtitle: {
119123
type: String,
@@ -137,11 +141,12 @@ export default {
137141
},
138142
139143
/**
140-
* Set a size in px for the height
144+
* Set a size in px that will define the avatar height/width
145+
* and therefore, the height of the component
141146
*/
142-
size: {
147+
avatarSize: {
143148
type: Number,
144-
default: 32,
149+
default: defaultSize,
145150
},
146151
147152
/**
@@ -172,13 +177,20 @@ export default {
172177
hasIcon() {
173178
return this.icon !== ''
174179
},
175-
176180
hasSlot() {
177181
return !!this.$slots.default
178182
},
183+
184+
isValidSubtitle() {
185+
return this.subtitle?.trim?.() !== ''
186+
},
187+
isSizeBigEnough() {
188+
return this.avatarSize >= defaultSize
189+
},
190+
179191
cssVars() {
180192
return {
181-
'--height': this.size + 2 * this.margin + 'px',
193+
'--height': this.avatarSize + 2 * this.margin + 'px',
182194
'--margin': this.margin + 'px',
183195
}
184196
},

src/components/Multiselect/Multiselect.vue

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,34 +108,34 @@ By specifying `:user-select="true"`, you can benefit from a fully formatted layo
108108
```vue
109109
<template>
110110
<Multiselect v-model="value" :options="formatedOptions"
111-
label="displayName" track-by="user"
112-
:user-select="true"
113-
style="width: 250px" />
111+
label="displayName" track-by="user"
112+
:user-select="true"
113+
style="width: 250px" />
114114
</template>
115115

116116
<script>
117117
import Multiselect from '../index'
118118
export default {
119119
data() {
120-
return {
121-
value: null,
122-
options: ['admin', 'user1', 'user2', 'guest', 'group1']
123-
}
120+
return {
121+
value: null,
122+
options: ['admin', 'user1', 'user2', 'guest', 'group1']
123+
}
124124
},
125125

126126
computed: {
127-
// Building fake data for the docs
128-
formatedOptions() {
129-
return this.options.map(item => {
130-
return {
131-
user: item,
132-
displayName: item,
133-
subtitle: `This is the ${item.startsWith('group') ? 'group' : 'user'} ${item}`,
134-
icon: item.startsWith('group') ? 'icon-group' : 'icon-user',
135-
isNoUser: item.startsWith('group')
136-
}
137-
})
138-
}
127+
// Building fake data for the docs
128+
formatedOptions() {
129+
return this.options.map(item => {
130+
return {
131+
user: item,
132+
displayName: item,
133+
subtitle: `This is the ${item.startsWith('group') ? 'group' : 'user'} ${item}`,
134+
icon: item.startsWith('group') ? 'icon-group' : 'icon-user',
135+
isNoUser: item.startsWith('group')
136+
}
137+
})
138+
}
139139
}
140140
}
141141
</script>

0 commit comments

Comments
 (0)