Skip to content

refactor: modernize SidebarItem to functional component with Tailwind…#8100

Merged
alexander-akait merged 3 commits intowebpack:mainfrom
ryzrr:refactor/modernize-sidebar-item
Mar 23, 2026
Merged

refactor: modernize SidebarItem to functional component with Tailwind…#8100
alexander-akait merged 3 commits intowebpack:mainfrom
ryzrr:refactor/modernize-sidebar-item

Conversation

@ryzrr
Copy link
Contributor

@ryzrr ryzrr commented Mar 22, 2026

Summary
Rewrote the SidebarItem component as a functional component with hooks and replaced its SCSS with Tailwind classes also updated the Print component which relied on the old class names and cleaned up leftover dark mode selectors.

What kind of change does this PR introduce?
SidebarItem was still a class component using the deprecated UNSAFE_componentWillReceiveProps method, and it was one of the remaining components with a standalone SCSS file. I converted it to a functional component, swapped all the BEM styles for Tailwind utilities with proper dark mode support, and added unit tests since it didn't have any.

Did you add tests for your changes?
Yes, added tests covering rendering, expand and collapse behavior, anchor links, and a snapshot.

Does this PR introduce a breaking change?
No

If relevant, what needs to be documented once your changes are merged or what have you already documented?
N/A

Use of AI
Claude

@vercel
Copy link

vercel bot commented Mar 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webpack-js-org Ready Ready Preview, Comment Mar 23, 2026 1:36pm

Request Review

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

please rebase and remove Print changes, they are not related

ryzrr added 3 commits March 23, 2026 13:33
… CSS

- Convert SidebarItem from class component to functional component with hooks
- Replace deprecated UNSAFE_componentWillReceiveProps with useEffect
- Migrate SidebarItem.scss to Tailwind CSS utilities (addresses webpack#8047)
- Update Print component to use Tailwind instead of removed BEM classes
- Remove orphaned sidebar-item selectors from dark.scss
- Add comprehensive unit tests for SidebarItem (7 test cases)
- Support both light and dark mode with proper color tokens
…ation

The sidebar refactor removed the  BEM class.
Add  to the NavLink in SidebarItem.jsx
and update the Cypress test to use the new attribute selector.
- Replace removed .sidebar-item__title BEM class in click-menu-scroll-top.cy.js
  with data-testid attribute selector (same fix as pr_4435.cy.js)
- Update SidebarItem snapshot to reflect new data-testid attribute on NavLink
@alexander-akait alexander-akait merged commit ea8c0c1 into webpack:main Mar 23, 2026
9 checks passed
@ryzrr
Copy link
Contributor Author

ryzrr commented Mar 23, 2026

Thanks !

@ryzrr
Copy link
Contributor Author

ryzrr commented Mar 23, 2026

image

This was the issue with the print section here so that's why I earlier added the changes in this PR only. Should I send a seperate fix for this ?

@alexander-akait
Copy link
Member

@ryzrr let's fix it in the separete PR

@ryzrr
Copy link
Contributor Author

ryzrr commented Mar 23, 2026

okay sure .

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants