Skip to content

refactor: remove variant css class on button-wc host#7682

Merged
deleonio merged 2 commits intorelease/2from
feature/2/7514-remove-button-variant-css-class
May 12, 2025
Merged

refactor: remove variant css class on button-wc host#7682
deleonio merged 2 commits intorelease/2from
feature/2/7514-remove-button-variant-css-class

Conversation

@laske185
Copy link
Copy Markdown
Contributor

@laske185 laske185 commented May 9, 2025

Closes #7514

The A11y and PO reviews will only take place after all other DoD steps have been completed by the Developer:

  • Meaningful pull request title for the release notes
  • Pull request is linked to an issue and all changes relate to the issue
  • Tests to protect this code implemented (if applicable)
  • Manual test performed successfully (if applicable)
  • Documentation or migration has been updated (if applicable)

@laske185 laske185 requested review from Copilot and deleonio May 9, 2025 10:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 9, 2025

Netlify Draft Deployment
URL:
Logs:

@laske185 laske185 marked this pull request as draft May 9, 2025 10:30
@laske185 laske185 force-pushed the feature/2/7514-remove-button-variant-css-class branch from c5258a7 to cada663 Compare May 9, 2025 10:41
- 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
@laske185 laske185 force-pushed the feature/2/7514-remove-button-variant-css-class branch from cada663 to 64a2b4c Compare May 9, 2025 10:56
@laske185 laske185 linked an issue May 9, 2025 that may be closed by this pull request
@deleonio deleonio added the v2 label May 11, 2025
@laske185 laske185 marked this pull request as ready for review May 12, 2025 06:01
@deleonio deleonio merged commit d07055e into release/2 May 12, 2025
11 checks passed
@deleonio deleonio deleted the feature/2/7514-remove-button-variant-css-class branch May 12, 2025 09:22
@publicuibot publicuibot bot locked and limited conversation to collaborators May 12, 2025
@deleonio deleonio removed the v2 label Jun 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Falsch platzierte CSS-Klassen im Button-WC

3 participants