-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: button variant refactoring (#2438)
## Breaking changes ### Link and button base classes __Check the next paragraphs for more information about `sbb-button` and `sbb-link` variants splitting__ All of these components has been split in two, one with only-button and one with only-link behavior. - `sbb-card-action`: split in `sbb-card-button` and `sbb-card-link`; - `sbb-menu-action`: split in `sbb-menu-button` and `sbb-menu-link`; - `sbb-navigation-action`: split in `sbb-navigation-button` and `sbb-navigation-link`. These components has been split in three, one with only-button and one with only-link behavior, plus a static variant which replaces the `isStatic` flag. - `sbb-button`: split in `sbb-button`, `sbb-button-link` and `sbb-button-static`; - `sbb-link`: split in `sbb-link`, `sbb-link-button` and `sbb-link-static`. Check your code and change accordingly, eg. - `sbb-button` with `href` set => change to `sbb-button-link`; - `sbb-menu-action` with `name` and `form` set => change to `sbb-menu-button`; - `sbb-link` with `href` set => no changes; - `sbb-navigation-action` with `value` set => change to `sbb-navigation-button`; - `sbb-button` with `isStatic` set to true => change to `sbb-button-static`; - `sbb-link` used within an anchor tag => change to `sbb-link-static`; - ... Since the `isStatic` flag has been removed, check for usage of nested buttons / links and possibly fix them using the two new static variants. ### Link variants split All these components have been split: - `sbb-link` has been split into two components, based on variant - `<sbb-link>` becomes `<sbb-block-link>` - `<sbb-link variant="block">` becomes `<sbb-block-link>` - `<sbb-link variant="inline">` becomes `<sbb-link>` - `sbb-link-button` has been split into two components, based on variant - `<sbb-link-button>` becomes `<sbb-block-link-button>` - `<sbb-link-button variant="block">` becomes `<sbb-block-link-button>` - `<sbb-link-button variant="inline">` becomes `<sbb-link-button>` - `sbb-link-static` has been split into two components, based on variant - `<sbb-link-static>` becomes `<sbb-block-link-static>` - `<sbb-link-static variant="block">` becomes `<sbb-block-link-static>` - `<sbb-link-static variant="inline">` becomes `<sbb-link-static>` Other changes: - `sbb-action-group` only accepts `sbb-block-link | sbb-block-link-button` - `sbb-link-list` only accepts `sbb-block-link | sbb-block-link-button` - `sbb-skiplink-list` only accepts `sbb-block-link | sbb-block-link-button` - `sbb-toast` only accepts `sbb-link | sbb-link-button` - `link-variables` mixin renamed to `block-link-variables`, - `link-variables--negative` mixin renamed to `block-link-variables--negative`, - `link-variables--inline` mixin renamed to `link-variables`, - `link-variables--inline-negative` mixin renamed to `link-variables--negative` - `link-inline-consolidation` mixin renamed to `link-consolidation`, - `link-inline` mixin renamed to `link`, - `link-inline-negative` mixin renamed to `link-negative` ### Button variants split - The `variant` property in `sbb-button` has been removed and for each value a new component has been added: - `sbb-secondary-button` for `secondary` variant of the `sbb-button`; - `sbb-tertiary-button` for `tertiary` variant of the `sbb-button`; - `sbb-transparent-button` for `transparent` variant of the `sbb-button`; - `sbb-secondary-button-link` for `secondary` variant of the `sbb-button-link`; - `sbb-tertiary-button-link` for `tertiary` variant of the `sbb-button-link`; - `sbb-transparent-button-link` for `transparent` variant of the `sbb-button-link`; - `sbb-secondary-button-static` for `secondary` variant of the `sbb-button-static`; - `sbb-tertiary-button-static` for `tertary` variant of the `sbb-button-static`; - `sbb-transparent-button-static` for `transparent` variant of the `sbb-button-static`. Replace any usage of the `sbb-button` with the `variant`property set with the corresponding new component: ``` // old code <sbb-button variant='secondary'></sbb-button> <sbb-button variant='tertiary'></sbb-button> <sbb-button variant='transparent'></sbb-button> <sbb-button-link variant='secondary'></sbb-button-link> ... // new code <sbb-secondary-button></sbb-secondary-button> <sbb-tertiary-button></sbb-tertiary-button> <sbb-transparent-button></sbb-secondary-button> <sbb-secondary-button-link></sbb-secondary-button-link> ... ``` - When the `sbb-button` is used in prefix/suffix slot of the `sbb-form-field`, it takes some custom style rules. This behavior has now been removed and a new component named `sbb-mini-button` has been created to handle this specific case; the component uses the same style used in the `sbb-form-field-clear`, the `sbb-datepicker-previous-day` and the `sbb-datepicker-next-day`. Replace the `sbb-button` usage within the `sbb-form-field` with the new `sbb-mini-button` ``` // old code <sbb-form-field> <input/> <sbb-button slot='suffix' icon-name='pen-small'></sbb-button> </sbb-form-field> // new code <sbb-form-field> <input/> <sbb-mini-button slot='suffix' icon-name='pen-small'></sbb-button> </sbb-form-field> ``` - Replace any `sbb-button` in the `sbb-toast` with `sbb-transparent-button`, since the variant is not automatically set anymore.
- Loading branch information
1 parent
a92255a
commit 98ea7f5
Showing
198 changed files
with
6,127 additions
and
1,545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.