|
1 | 1 | <template> |
2 | 2 |
|
3 | | - <VContainer |
4 | | - fluid |
5 | | - class="pa-0 pb-5" |
6 | | - > |
7 | | - <LoadingText |
8 | | - v-if="loading" |
9 | | - class="pt-4" |
| 3 | + <div class="selection-list"> |
| 4 | + <StudioLargeLoader |
| 5 | + v-if="show(loaderKey, loading, 400)" |
| 6 | + class="selection-loader" |
10 | 7 | /> |
11 | 8 | <template v-else> |
12 | | - <VTextField |
| 9 | + <KTextbox |
13 | 10 | v-model="search" |
14 | | - style="max-width: 350px" |
15 | | - class="mt-4" |
16 | | - box |
| 11 | + class="search-input" |
17 | 12 | :label="$tr('searchText')" |
18 | 13 | /> |
19 | 14 | <p |
20 | 15 | v-if="!listChannels.length" |
21 | | - class="grey--text mb-0 mt-4" |
| 16 | + class="grey--text no-channels-found" |
22 | 17 | > |
23 | 18 | {{ $tr('noChannelsFound') }} |
24 | 19 | </p> |
|
28 | 23 | :key="channel.id" |
29 | 24 | flat |
30 | 25 | hover |
31 | | - class="list-card-hover px-3" |
| 26 | + class="list-card-hover selection-card" |
32 | 27 | > |
33 | | - <VLayout |
34 | | - align-center |
35 | | - row |
36 | | - > |
37 | | - <Checkbox |
38 | | - v-model="selectedChannels" |
39 | | - color="primary" |
| 28 | + <div class="selection-row"> |
| 29 | + <KCheckbox |
| 30 | + :checked="selectedChannels.includes(channel.id)" |
40 | 31 | :data-testid="`checkbox-${channel.id}`" |
41 | | - :value="channel.id" |
42 | | - class="channel ma-0" |
| 32 | + class="channel-checkbox" |
| 33 | + @change="handleSelectChannel(channel.id)" |
43 | 34 | /> |
44 | 35 | <ChannelItem |
45 | 36 | :channelId="channel.id" |
46 | 37 | :data-testid="`channel-item-${channel.id}`" |
47 | 38 | @click="handleSelectChannel" |
48 | 39 | /> |
49 | | - </VLayout> |
| 40 | + </div> |
50 | 41 | </VCard> |
51 | 42 | </template> |
52 | 43 | </template> |
53 | | - </VContainer> |
| 44 | + </div> |
54 | 45 |
|
55 | 46 | </template> |
56 | 47 |
|
57 | 48 |
|
58 | 49 | <script> |
59 | 50 |
|
60 | 51 | import sortBy from 'lodash/sortBy'; |
| 52 | + import useKShow from 'kolibri-design-system/lib/composables/useKShow'; |
61 | 53 | import { mapGetters, mapActions } from 'vuex'; |
62 | 54 | import ChannelItem from './ChannelItem'; |
63 | 55 | import { ChannelListTypes } from 'shared/constants'; |
64 | | - import Checkbox from 'shared/views/form/Checkbox'; |
65 | | - import LoadingText from 'shared/views/LoadingText'; |
| 56 | + import StudioLargeLoader from 'shared/views/StudioLargeLoader'; |
66 | 57 |
|
67 | 58 | function listTypeValidator(value) { |
68 | 59 | // The value must match one of the ListTypes |
|
72 | 63 | export default { |
73 | 64 | name: 'ChannelSelectionList', |
74 | 65 | components: { |
75 | | - Checkbox, |
76 | 66 | ChannelItem, |
77 | | - LoadingText, |
| 67 | + StudioLargeLoader, |
| 68 | + }, |
| 69 | + setup() { |
| 70 | + const { show } = useKShow(); |
| 71 | + return { show }; |
78 | 72 | }, |
79 | 73 | props: { |
80 | 74 | value: { |
|
117 | 111 | 'name', |
118 | 112 | ); |
119 | 113 | }, |
| 114 | + loaderKey() { |
| 115 | + return `channel-selection-list-${this.listType}`; |
| 116 | + }, |
120 | 117 | }, |
121 | 118 | mounted() { |
122 | 119 | this.loading = true; |
|
146 | 143 |
|
147 | 144 | <style lang="scss" scoped> |
148 | 145 |
|
149 | | - .add-channel-button { |
150 | | - margin: 0; |
| 146 | + .selection-list { |
| 147 | + padding-bottom: 20px; |
| 148 | + } |
| 149 | +
|
| 150 | + .selection-loader { |
| 151 | + padding-top: 16px; |
| 152 | + } |
| 153 | +
|
| 154 | + .search-input { |
| 155 | + max-width: 350px; |
| 156 | + margin-top: 16px; |
151 | 157 | } |
152 | 158 |
|
153 | | - .channel /deep/ .k-checkbox { |
154 | | - vertical-align: middle; |
| 159 | + .no-channels-found { |
| 160 | + margin-top: 16px; |
| 161 | + margin-bottom: 0; |
| 162 | + } |
| 163 | +
|
| 164 | + .selection-card { |
| 165 | + padding-inline: 12px; |
| 166 | + } |
| 167 | +
|
| 168 | + .selection-row { |
| 169 | + display: flex; |
| 170 | + align-items: center; |
| 171 | + } |
| 172 | +
|
| 173 | + .channel-checkbox { |
| 174 | + margin: 0; |
| 175 | + padding-inline-end: 4px; |
155 | 176 | } |
156 | 177 |
|
157 | 178 | .list-card-hover { |
|
0 commit comments