Skip to content

chore(status-light): refactor with abstracted base class #5652

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

Open
wants to merge 1 commit into
base: spectrum-two-phase-zero
Choose a base branch
from

Conversation

rubencarvalho
Copy link
Contributor

@rubencarvalho rubencarvalho commented Jul 31, 2025

Overview

This PR refactors the sp-status-light component to separate its base logic from rendering code, following the technical specifications for the Swan migration preparation. This is a purely internal change with no customer impact.

Changes Made

File Structure Changes

  • Created: New packages/status-light/src/StatusLight.base.ts as the base class for Status light component.

Code Separation

StatusLightBase (Abstract Base Class)

  • Location: packages/status-light/src/StatusLight.base.ts
  • Contains:
    • Property declarations
    • All base functionality except rendering

StatusLight (Concrete Class)

  • Location: packages/status-light/src/StatusLight.ts
  • Contains:
    • Class that extends StatusLightBase
    • Rendering logic (render() method)
    • Styles import and declaration

Impact

Customer Impact

  • None - This is a purely internal refactoring
  • Public API remains identical
  • No visual or behavioural changes
  • No breaking changes

Developer Impact

  • None - Existing imports and usage patterns continue to work
  • import { StatusLight } from '@spectrum-web-components/status-light' still works
  • All existing component usage remains valid

Related issue(s)

  • fixes SWC-983

Screenshots (if appropriate)


Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes. (N/A)
  • I have included a well-written changeset if my change needs to be published. (N/A)
  • I have included updated documentation if my change required it. (N/A)

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features (N/A)
  • Automated tests cover all use cases and follow best practices for writing (N/A)
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Manual Testing

    • Component renders correctly in Storybook
    • All variants (horizontal/vertical) work as expected
    • All sizes (s, m, l) display properly
    • ARIA attributes are set correctly
  • Automated Testing

    • All existing tests pass
    • No new tests needed (no functional changes)

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Migration Preparation

This refactoring prepares the badge component for future migration to the Swan architecture by:

  1. Separating concerns - Base logic vs. rendering logic
  2. Preserving git history - Base logic in StatusLight.base.ts will carry forward
  3. Maintaining compatibility - Public API unchanged
  4. Following established patterns - Consistent with other component refactoring

Related

  • Epic: Swan Migration Preparation - Component Refactoring
  • Technical Notes: Follows specified refactoring process for base logic extraction

Copy link

changeset-bot bot commented Jul 31, 2025

⚠️ No Changeset found

Latest commit: 590fb93

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

📚 Branch Preview

🔍 Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-5652

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

Copy link

Tachometer results

Currently, no packages are changed by this PR...

@rubencarvalho rubencarvalho marked this pull request as ready for review July 31, 2025 00:43
@rubencarvalho rubencarvalho requested a review from a team as a code owner July 31, 2025 00:43
Copy link
Contributor

@Rajdeepc Rajdeepc left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants