-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add consistent variant
prop for design variant of buttons / chips
#6472
base: master
Are you sure you want to change the base?
Conversation
Deprecate `type` for usage with the color variant. Also deprecate `nativeType` in favor of `type` and `variant`. Signed-off-by: Ferdinand Thiessen <[email protected]>
This is done to align with `NcButton`. Signed-off-by: Ferdinand Thiessen <[email protected]>
To align with `NcButton`. Signed-off-by: Ferdinand Thiessen <[email protected]>
…`type` prop To align with `NcButton`. Signed-off-by: Ferdinand Thiessen <[email protected]>
…e` prop To align with `NcButton`. Signed-off-by: Ferdinand Thiessen <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
variant: { | ||
type: String, | ||
validator(value) { | ||
return ['primary', 'secondary', 'tertiary', 'tertiary-no-background', 'tertiary-on-primary', 'error', 'warning', 'success'].indexOf(value) !== -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer using .includes(value)
here.
Can we also keep available variants in one place (as const, or util like ValidateSlot
) to not duplicate it everywhere? In case it's not a limited list of only primary, secondary, tertiary
/** | ||
* The button variant, see NcButton. | ||
* | ||
* @type {'primary'|'secondary'|'error'|'warning'|'success'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'tertiary' is skipped here and above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact: It is even in current version (and next) causing me in my apps having "invalid attribute 'tertiary'" 😅
@nextcloud/vue v9
breaking changes #6384 (comment)☑️ Resolves
Currently we need to wrap the native
type
prop of a button intonativeType
ofNcButton
.This is confusing and we should never use names for props that are already attributes of the native HTML element.
The solution is to rename
type
tovariant
.To not make it breaking following is applied:
variant
prop is added replacingtype
nativeType
is deprecated in favor oftype
type
allows both, the native button type and the color variantnativeType
The same is also applied for
NcDialogButton
andNcActions
.NcChip
also referred to theNcButton
for thetype
so this is also migrated the same way to make the wordingvariant
consistent.In a last step all components are refactored to use the new props instead.
🖼️ Screenshots
Nothing visually changed - if it does that's a regression 😨
🏁 Checklist
next
requested with a Vue 3 upgrade