Skip to content

Commit 88dea36

Browse files
authored
[Remove Vuetify from Studio] Buttons/links and dropdown in Content library
1 parent 3918b3a commit 88dea36

4 files changed

Lines changed: 71 additions & 50 deletions

File tree

contentcuration/contentcuration/frontend/channelList/views/Channel/CatalogFilterBar.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
>
1212
{{ filter.text }}
1313
</VChip>
14-
<ActionLink
14+
<KButton
1515
v-if="currentFilters.length"
16-
class="mx-2"
16+
class="clear-link"
1717
:text="$tr('clearAll')"
18+
appearance="basic-link"
1819
data-test="clear"
1920
@click="clearFilters"
2021
/>
@@ -140,4 +141,8 @@
140141
}
141142
}
142143
144+
.clear-link {
145+
margin: 0 8px;
146+
}
147+
143148
</style>

contentcuration/contentcuration/frontend/channelList/views/Channel/CatalogFilters.vue

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<template>
22

33
<div>
4-
<VBtn
4+
<KButton
55
v-if="$vuetify.breakpoint.xsOnly"
6-
color="primary"
7-
flat
6+
class="drawer-btn"
7+
:text="$tr('searchText')"
8+
:primary="true"
9+
appearance="flat-button"
810
@click.stop="drawer = true"
9-
>
10-
{{ $tr('searchText') }}
11-
</VBtn>
11+
/>
1212
<CatalogFilterBar />
1313
<VNavigationDrawer
1414
v-model="drawer"
@@ -98,11 +98,13 @@
9898
v-model="subtitles"
9999
:label="$tr('subtitlesLabel')"
100100
/>
101-
<ActionLink
101+
<KRouterLink
102+
class="qa-link"
102103
:to="faqLink"
103-
target="_blank"
104-
class="mt-4"
105104
:text="$tr('frequentlyAskedQuestionsLink')"
105+
appearance="basic-link"
106+
iconAfter="openNewTab"
107+
target="_blank"
106108
/>
107109
</VContainer>
108110
<VFooter
@@ -118,10 +120,10 @@
118120
contain
119121
:src="require('shared/images/le-logo.svg')"
120122
/>
121-
<ActionLink
122-
:text="$tr('copyright', { year: new Date().getFullYear() })"
123+
<KExternalLink
123124
href="https://learningequality.org/"
124-
target="_blank"
125+
:text="$tr('copyright', { year: new Date().getFullYear() })"
126+
openInNewTab
125127
/>
126128
</div>
127129
</VFooter>
@@ -255,4 +257,12 @@
255257
overflow: auto;
256258
}
257259
260+
.qa-link {
261+
margin-top: 24px;
262+
}
263+
264+
.drawer-btn {
265+
margin-top: 10px;
266+
}
267+
258268
</style>

contentcuration/contentcuration/frontend/channelList/views/Channel/CatalogList.vue

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@
3232
<h1 class="mb-2 ml-1 title">
3333
{{ $tr('resultsText', { count: page.count }) }}
3434
</h1>
35-
<ActionLink
35+
<KButton
3636
v-if="page.count && !selecting"
3737
:text="$tr('selectChannels')"
3838
data-test="select"
39+
appearance="basic-link"
3940
@click="setSelection(true)"
4041
/>
4142
<Checkbox
@@ -89,42 +90,29 @@
8990
</div>
9091
<VSpacer />
9192
<div>
92-
<VBtn
93-
flat
93+
<KButton
94+
:text="$tr('cancelButton')"
9495
data-test="cancel"
95-
class="ma-0"
96+
appearance="flat-button"
9697
@click="setSelection(false)"
97-
>
98-
{{ $tr('cancelButton') }}
99-
</VBtn>
98+
/>
10099
</div>
101-
<BaseMenu top>
102-
<template #activator="{ on }">
103-
<VBtn
104-
color="primary"
105-
class="ma-0 mx-2"
106-
v-on="on"
107-
>
108-
{{ $tr('downloadButton') }}
109-
<Icon
110-
class="ml-1"
111-
icon="dropup"
112-
:color="$themeTokens.textInverted"
113-
/>
114-
</VBtn>
115-
</template>
116-
<VList>
117-
<VListTile @click="downloadPDF">
118-
<VListTileTitle>{{ $tr('downloadPDF') }}</VListTileTitle>
119-
</VListTile>
120-
<VListTile
121-
data-test="download-csv"
122-
@click="downloadCSV"
123-
>
124-
<VListTileTitle>{{ $tr('downloadCSV') }}</VListTileTitle>
125-
</VListTile>
126-
</VList>
127-
</BaseMenu>
100+
<KButton
101+
:text="$tr('downloadButton')"
102+
:primary="true"
103+
data-test="download-button"
104+
iconAfter="dropup"
105+
>
106+
<KDropdownMenu
107+
:primary="true"
108+
:options="[
109+
{ label: $tr('downloadPDF'), value: 'pdf' },
110+
{ label: $tr('downloadCSV'), value: 'csv' },
111+
]"
112+
appearance="raised-button"
113+
@select="option => selectDownloadOption(option)"
114+
/>
115+
</KButton>
128116
</BottomBar>
129117
</VContainer>
130118
</div>
@@ -286,6 +274,13 @@
286274
this.setSelection(false);
287275
return this.downloadChannelsPDF(params);
288276
},
277+
selectDownloadOption(option) {
278+
if (option.value === 'pdf') {
279+
this.downloadPDF();
280+
} else if (option.value === 'csv') {
281+
this.downloadCSV();
282+
}
283+
},
289284
},
290285
$trs: {
291286
resultsText: '{count, plural,\n =1 {# result found}\n other {# results found}}',

contentcuration/contentcuration/frontend/channelList/views/Channel/__tests__/catalogList.spec.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function makeWrapper(computed = {}) {
1515
loadCatalog.mockImplementation(() => Promise.resolve());
1616

1717
const downloadCSV = jest.spyOn(CatalogList.methods, 'downloadCSV');
18+
const downloadPDF = jest.spyOn(CatalogList.methods, 'downloadPDF');
1819

1920
const wrapper = mount(CatalogList, {
2021
router,
@@ -32,7 +33,7 @@ function makeWrapper(computed = {}) {
3233
CatalogFilters: true,
3334
},
3435
});
35-
return [wrapper, { loadCatalog, downloadCSV }];
36+
return [wrapper, { loadCatalog, downloadCSV, downloadPDF }];
3637
}
3738

3839
describe('catalogFilterBar', () => {
@@ -165,10 +166,20 @@ describe('catalogFilterBar', () => {
165166

166167
it('clicking download CSV should call downloadCSV', async () => {
167168
mocks.downloadCSV.mockImplementationOnce(() => Promise.resolve());
168-
await wrapper.findComponent('[data-test="download-csv"]').trigger('click');
169+
await wrapper.findComponent('[data-test="download-button"]').trigger('click');
170+
const menuOptions = wrapper.findAll('.ui-menu-option-content');
171+
await menuOptions.at(1).trigger('click');
169172
expect(mocks.downloadCSV).toHaveBeenCalled();
170173
});
171174

175+
it('clicking download PDF should call downloadPDF', async () => {
176+
mocks.downloadPDF.mockImplementationOnce(() => Promise.resolve());
177+
await wrapper.findComponent('[data-test="download-button"]').trigger('click');
178+
const menuOptions = wrapper.findAll('.ui-menu-option-content');
179+
await menuOptions.at(0).trigger('click');
180+
expect(mocks.downloadPDF).toHaveBeenCalled();
181+
});
182+
172183
it('downloadCSV should call downloadChannelsCSV with current parameters', async () => {
173184
const keywords = 'Download csv keywords test';
174185
router.replace({ query: { keywords } });

0 commit comments

Comments
 (0)