-
Notifications
You must be signed in to change notification settings - Fork 159
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
feat(masthead): spacing style regression fix and maintainability refactor #11252
feat(masthead): spacing style regression fix and maintainability refactor #11252
Conversation
@carbon/styles package's utilities default export only forwards the em() and rem() functions, but we need to-rem().
The v2 masthead has feature support for everything the Cloud masthead needs.
Deploy preview created for package Built with commit: 98649808c5577552ad9e79592138d7fba1767562 |
Deploy preview created for package Built with commit: 98649808c5577552ad9e79592138d7fba1767562 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for the search fix.
This PR currently has a merge conflict. Please resolve this and then re-add the |
Resolves carbon-design-system#11210 **Changed** - Updates masthead documentation to match expected behavior in v2. - Fixes incorrect React wrapper Masthead demonstrations in Storybook. **Removed** - Removes docs specific to IBM Cloud that have been made unnecessary in v2. <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "test: e2e": Codesandbox examples and e2e integration tests --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
67cc49b
into
carbon-design-system:main
### Related Ticket(s) Previously fixed in #10986, but that was unwittingly wiped away by #11252 ### Description Fixes an issue where `<c4d-masthead-container>` wipes away user-set L0 data with translations fetched from an API. This PR takes a different approach from the original fix. The root problem is that the masthead container isn't aware of any `l0Data` passed in before setting that property with translation data. I figured we can make the container a little smarter and handle the logic internally rather than adding another property to the masthead composite and complicating the public API. In order to facilitate this, I needed the `ConnectMixin` to pass a reference to the class instance into the `mapStateToProps` function it expects classes to define. This empowers the container to first check if it has L0 data before resorting to the translations API data. As a result, users can reliably set the `l0Data` property on either `<c4d-masthead-container>` or `<c4d-masthead-composite>` and expect the same outcome. ### Changelog **New** - `ConnectMixin` passes a class instance reference as an argument in the `mapStateToProps` function. **Changed** - `<c4d-masthead-container>` will prefer using L0 data passed by user before resorting to automatically fetched translation data. <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "test: e2e": Codesandbox examples and e2e integration tests --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
…ctor (carbon-design-system#11252) Resolves carbon-design-system#11251 This PR mostly refactors masthead source code to be more maintainable and removes dead code. Other than the style fixes, it should result in no visible changes to the masthead. - Makes necessary functions available to Sass stylesheets to fix style regressions. - Removes Cloud-specific masthead styles. --- - Deprecates `MastheadProfileContent` type. - Deprecates `Translation.mastheadNav` in favor of `Translation.masthead.nav`. - Deprecates `Translation.profileMenu` in favor of `Translation.masthead.profileMenu`. - Removes references to v1 data structures that are no longer in use. --- - Deprecates the `navLinks` Masthead Composite property in favor of the more descriptive `l0Data` property. - Splits out the Masthead Composite's main `render` method into more digestible render methods per logical section. - Untangles the knot that was the `renderNavItems` method by providing dedicated `renderTopNav` and `renderLeftNav` methods for the desktop and mobile experiences. - Extracts distinct chunks of logic into their own methods for readability and in some cases reuse across the newly split render methods. - Removes Cloud-specific masthead. - Removes non-functional `customNavLinks` property. Use `l0Data` or `l1Data` instead. - Removes masthead v1's leftover CTA functionality.
Related Ticket(s)
Resolves #11251
Description
This PR mostly refactors masthead source code to be more maintainable and removes dead code. Other than the style fixes, it should result in no visible changes to the masthead.
Changelog
Styles
Changed
Removed
Services Store
Changed
MastheadProfileContent
type.Translation.mastheadNav
in favor ofTranslation.masthead.nav
.Translation.profileMenu
in favor ofTranslation.masthead.profileMenu
.Removed
IBM.com Web Components
Changed
navLinks
Masthead Composite property in favor of the more descriptivel0Data
property.render
method into more digestible render methods per logical section.renderNavItems
method by providing dedicatedrenderTopNav
andrenderLeftNav
methods for the desktop and mobile experiences.Removed
customNavLinks
property. Usel0Data
orl1Data
instead.