Skip to content

W-18672799 Chakra UI v3 header migration#2691

Merged
alexvuong merged 17 commits intofeature/chakra-ui-upgrade-v3from
chakra-ui-v3-header-migration
Jul 2, 2025
Merged

W-18672799 Chakra UI v3 header migration#2691
alexvuong merged 17 commits intofeature/chakra-ui-upgrade-v3from
chakra-ui-v3-header-migration

Conversation

@alexvuong
Copy link
Contributor

@alexvuong alexvuong commented Jun 28, 2025

Description

Header Desktop
image

Header Mobile
image

Menu dropdown
image

Active menu style
image

drawer on mobile
image

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • Check out code
  • npm run at typescript minimal template
  • Observe header and confirm everything is matching v3 of pwa-kit

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@alexvuong alexvuong changed the base branch from develop to feature/chakra-ui-upgrade-v3 June 28, 2025 01:25
@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Jun 28, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

// can't import theme object in Chakra V3, Let's use a hardcode value for now.
// Will circle back when we start working on fixing component styling
zIndex: 1100
zIndex: 'sticky'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexvuong alexvuong marked this pull request as ready for review June 30, 2025 21:40
@alexvuong alexvuong requested a review from a team as a code owner June 30, 2025 21:40
to={updatedHref}
ref={ref}
/>
<ChakraLink asChild {...props} css={css} ref={ref}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Chakra V3 advised to not use as to render component, instead using asChild and render children components


const isActive = useNavLink
? (_, location) => {
return location.pathname.endsWith(_href)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we have multi-site, so we only need check the last section of the pathname.

@@ -8,18 +8,47 @@ import {defineRecipe} from '@chakra-ui/react'

export default defineRecipe({
slots: [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rearrange by alphabetical order for easy searching

@alexvuong alexvuong changed the title W-18672799 [WIP]Chakra UI v3 header migration W-18672799 Chakra UI v3 header migration Jun 30, 2025
const {buildUrl} = useMultiSite()
const updatedHref = buildUrl(_href)

const isActive = useNavLink
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Chakra link no longers at active class by default, we need to do it here and restyling the active class manually for account menu in the header

@vmarta
Copy link
Contributor

vmarta commented Jul 2, 2025

@alexvuong Are the product categories inside the nav menu part of the ticket's scope? If yes, I wonder why the categories are no longer lazy loaded..

On desktop, the categories are immediately shown when you open the nav menu.
But on mobile, the categories look to be lazy loaded. I could see the loading spinner, BUT there is no categories shown.. it's blank.

@vmarta
Copy link
Contributor

vmarta commented Jul 2, 2025

Visually, I think it's all good, except for this small thing in the mobile menu:

Arc 2025-07-02 at 11 02 17@2x

Copy link
Contributor

@vmarta vmarta left a comment

Choose a reason for hiding this comment

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

Minor thing for next time: the Log Out link in the mobile nav menu looks different than the other links above it.

Other than that, the PR is good 👍 Thanks for addressing the feedback.

Arc 2025-07-02 at 16 23 28@2x

@alexvuong alexvuong merged commit 9df31eb into feature/chakra-ui-upgrade-v3 Jul 2, 2025
33 checks passed
alexvuong added a commit that referenced this pull request Jul 16, 2025
* Migrate Header to Chakra v3
---------

Co-authored-by: Vincent Marta <vmarta@salesforce.com>
@alexvuong alexvuong deleted the chakra-ui-v3-header-migration branch July 16, 2025 22:35
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.

4 participants