refactor: remove variant css class on button-wc host#7682
Merged
refactor: remove variant css class on button-wc host#7682
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors button components to remove the injection of variant CSS classes on button-wc hosts and simplify styling by relying on centralized mixins. Key changes include:
- Removing the variant and custom-class key injection from component classes in shadow DOM TS files.
- Updating SCSS files to use improved selectors and centralized mixin usage.
- Adjusting component API types and prop validation to support the new styling approach.
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/themes/ecl/src/ecl-eu/components/split-button.scss | Added explicit styling for main and secondary button spans using child selector selectors. |
| packages/themes/ecl/src/ecl-eu/components/link-button.scss | Removed redundant style definitions and now calls the kol-button mixin. |
| packages/themes/ecl/src/ecl-ec/mixins/button.scss | Updated styling selectors and refactored button variants to align with the new structure. |
| packages/themes/default/src/components/split-button.scss | Changed selectors from :is(a, button) to a direct child selector to suit the new markup structure. |
| packages/components/src/components/split-button/shadow.tsx | Removed the injection of variant and custom class names on the host element. |
| packages/components/src/components/popover-button/shadow.tsx | Dropped the clsx-based variant logic to rely on mixin styling. |
| packages/components/src/components/link/component.tsx | Updated component API types and added prop validation for variant and custom class. |
| Other theme/component files | Similar refactors to remove outdated style injection in favor of mixin usage. |
Comments suppressed due to low confidence (3)
packages/components/src/components/split-button/shadow.tsx:64
- The removal of variant-based class injection is consistent with the refactor; please double-check that this change preserves the intended styling for non-custom variants.
[this._variant as string]: this._variant !== 'custom',
packages/themes/default/src/components/split-button.scss:37
- The updated selector improves specificity but ensure that the component markup always wraps the inner element with a '.button' class to prevent any styling inconsistencies.
.main-button > .button > .kol-span-wc {
packages/components/src/components/link/component.tsx:66
- The update from LinkAPI to LinkWcAPI is appropriate for accommodating the new variant and custom class props; ensure that all consumers have been updated to use the new API types.
export class KolLinkWc implements LinkWcAPI, FocusableElement {
Contributor
|
Netlify Draft Deployment |
c5258a7 to
cada663
Compare
- Refactored button styles across themes to utilize mixins for consistency - Updated link-button, split-button, and toolbar styles to use the kol-button mixin for uniformity. - Simplified button styles in ECL and ITZBund themes by removing redundant CSS rules and leveraging mixins. - Adjusted border-radius and padding properties to ensure consistent button appearance. - Enhanced focus and hover states for buttons to improve accessibility and user experience. Refs: #7514
cada663 to
64a2b4c
Compare
$ Refs: #7514
deleonio
approved these changes
May 12, 2025
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7514
The A11y and PO reviews will only take place after all other DoD steps have been completed by the Developer: