Skip to content

Commit 8fa7e1e

Browse files
committed
fix(FilePicker): make move primary and copy secondary
Needed to bump peer dependency for nextcloud-vue to 8.24+ for `variant` prop. Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 7939436 commit 8fa7e1e

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

lib/components/types.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ export enum DialogSeverity {
1717
*/
1818
export interface IDialogButton {
1919
/** Label of the button */
20-
label: string,
20+
label: string
2121

2222
/** Callback on button click */
23-
callback: () => void,
23+
callback: () => void
24+
25+
/**
26+
* Disabled state of the button
27+
* @default false
28+
*/
29+
disabled?: boolean
2430

2531
/**
2632
* Optional Icon for the button
@@ -30,15 +36,16 @@ export interface IDialogButton {
3036

3137
/**
3238
* Button type
39+
* @deprecated - use `variant` instead
3340
* @see https://nextcloud-vue-components.netlify.app/#/Components/NcButton
3441
*/
3542
type?: 'primary' | 'secondary' | 'error' | 'warning' | 'success'
3643

3744
/**
38-
* Disabled state of the button
39-
* @default false
45+
* Button type
46+
* @see https://nextcloud-vue-components.netlify.app/#/Components/NcButton
4047
*/
41-
disabled?: boolean
48+
variant?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success'
4249
}
4350

4451
/**

lib/filepicker-builder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,16 @@ export class FilePickerBuilder<IsMultiSelect extends boolean> {
224224
buttons.push({
225225
callback: () => {},
226226
label: target ? t('Copy to {target}', { target }) : t('Copy'),
227-
type: 'primary',
228227
icon: IconCopy,
228+
variant: type === FilePickerType.Copy ? 'primary' : 'secondary',
229229
})
230230
}
231-
if (type === FilePickerType.Move || type === FilePickerType.CopyMove) {
231+
if (type === FilePickerType.CopyMove || type === FilePickerType.Move) {
232232
buttons.push({
233233
callback: () => {},
234234
label: target ? t('Move to {target}', { target }) : t('Move'),
235-
type: type === FilePickerType.Move ? 'primary' : 'secondary',
236235
icon: IconMove,
236+
variant: 'primary', // move is always primary - also on copy-move
237237
})
238238
}
239239
return buttons

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"dist"
5252
],
5353
"peerDependencies": {
54-
"@nextcloud/vue": "^8.23.1",
54+
"@nextcloud/vue": "^8.24.0",
5555
"vue": "^2.7.16"
5656
},
5757
"dependencies": {

0 commit comments

Comments
 (0)