-
Notifications
You must be signed in to change notification settings - Fork 968
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
Add navControlsPrimaryHeaderRight slot to header #9223
Add navControlsPrimaryHeaderRight slot to header #9223
Conversation
Signed-off-by: Lin Wang <wonglam@amazon.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9223 +/- ##
=======================================
Coverage 61.67% 61.67%
=======================================
Files 3817 3817
Lines 91719 91725 +6
Branches 14517 14517
=======================================
+ Hits 56565 56569 +4
- Misses 31524 31525 +1
- Partials 3630 3631 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
@@ -64,6 +64,8 @@ export interface ChromeNavControls { | |||
registerCenter(navControl: ChromeNavControl): void; | |||
/** Register a nav control to be presented on the left-bottom side of the left navigation. */ | |||
registerLeftBottom(navControl: ChromeNavControl): void; | |||
/** Register a nav control to be presented on the right side of the new primary chrome header. */ |
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.
what does the "new primary chrome header" refer to?
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.
So we're trying to introduce an API to register a global control button which is available for all application headers and page headers. Can we simply call it registerHeaderRight
?
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.
I'm open to renaming it to registerHeaderRight. I just want to add some explanations for my naming convention. I added 'New' to distinguish it from the legacy header since this slot won't be displayed in that header. I added 'Primary' to distinguish it from the secondary header, as it's positioned on the right side of the primary header. Do you think this naming convention is reasonable? Using 'headerRight' is simpler, but I'm not sure if it might confuse others into thinking that the registered elements won't be displayed.
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.
Thanks for the explanation! I got the point of "Primary" now :)
For "New", since legacy header is meant to be deprecated, so I don't feel necessary to distinguish it from the legacy one, imagine in the future, the legacy header was removed, then the "New" will sound a bit strange. what about calling it registerPrimaryHeaderRight
?
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
* Add navControlNewPrimaryRight slot to header Signed-off-by: Lin Wang <wonglam@amazon.com> * Changeset file for PR #9223 created/updated * Fix vertical align for header items Signed-off-by: Lin Wang <wonglam@amazon.com> * Fix test coverage drop Signed-off-by: Lin Wang <wonglam@amazon.com> * Fix failed UTs Signed-off-by: Lin Wang <wonglam@amazon.com> * Fix bootstrap failed Signed-off-by: Lin Wang <wonglam@amazon.com> * Update failed snapshots Signed-off-by: Lin Wang <wonglam@amazon.com> * Remove left border Signed-off-by: Lin Wang <wonglam@amazon.com> * Refactor with headerRight Signed-off-by: Lin Wang <wonglam@amazon.com> * Renaming to primaryHeaderRight Signed-off-by: Lin Wang <wonglam@amazon.com> * Changeset file for PR #9223 created/updated --------- Signed-off-by: Lin Wang <wonglam@amazon.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 8ae1c71) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Add navControlNewPrimaryRight slot to header * Changeset file for PR #9223 created/updated * Fix vertical align for header items * Fix test coverage drop * Fix failed UTs * Fix bootstrap failed * Update failed snapshots * Remove left border * Refactor with headerRight * Renaming to primaryHeaderRight * Changeset file for PR #9223 created/updated --------- (cherry picked from commit 8ae1c71) Signed-off-by: Lin Wang <wonglam@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Description
This PR is for adding a new nav control slot for the primary header when the new home experience is enabled. There are many existing right nav control slots in the page header, but currently, there is no existing slot to add components to the right side of the primary header, next to the breadcrumbs bar.Here are some screenshots to explain the existing slots in different page headers:
Legacy page header (new home disabled):

Application page header (new home enabled):

Basic page header (new home enabled):

With this PR, a new nav control slot has been introduced to allow components to be placed in the primary header, next to the breadcrumbs bar, when the new home experience is enabled. Here's how it will look:
Basic page header (new home enabled):

Application page header (new home enabled):

Changelog
Check List
yarn test:jest
yarn test:jest_integration