Overview
Problem Statement
The currently implemented PageHeader does not reflect the latest visual design and does have some stability / robustness / alignment issues, API issues, and does not support theming as much as we need it to going forward with theming support.
Goal
Implement the updated visual design of the PageHeader, make the component more robust, improve element alignment, improve its API, and extend its support for theming.
Context
This design update of the PageHeader components is necessary as a preparation to enable us to roll out additional themes and increase its stability and flexibility as a component.
Task Outcome
Have the updated PageHeader in Juno and all apps using the most current version of Juno ui-components, while not breaking apps due to breaking changes in the API of the component.
Details
Description
This task covers multiple aspects of the component:
Visual Design
The component need updating its outer margins/paddings in both verical and horizontal direction. See Figma for details and exact values:
Figma Pageheader Component
Layout Robustness
The layout of the component needs improving. Make sure the logo and/or any children passed to the component never manage to alter the dimensions of the PageHeader, and all elements incl. any logo passed in always center-align in the vertical axis. See Technical Details below for more details.
API Updates
Add applicationName prop, deprecate heading
Currently, the component has a heading prop that accepts a string to be rendered as the application name in the header. The naming of this prop is unfortunate as it is semantically wrong and not self-explanatory.
To improve the API, implement an applicationName prop for the exact same purpose. Keep the heading for backwards compatibility but mark as deprecated in the code and documentation. This will need to exist as long as we have apps that use it. Once we have changed all apps to use the new prop, we can remove it.
Implement href prop
In order to be consistent with multiple other components, add an href prop that accepts a string/url to complement the onClick prop we already have, so users can use either a JS-handler or a plain href anchor to link to the homepage of their app.
Depending on what markup we end up in order to make our layout more robust, both logo and application name should be wrapped in an <a> element OR be wrapped in individual element if href is passed. The onClick handler should be applied to both following the same logic.
As an end result we expect an onClick handler to be executed when clicking the logo AND/OR the application name; if an href was passed, we expect the link to be called when clicking the logo AND/OR the application name. An <a> element should only ever be created if href was passed.
Theming / CSS Variables
In order to allow for better theming support, we need to introduce more design token / CSS variables for the header background, border, and the application name. See Technical Details below for an in-depth table of variables and their mappings.
Storybook Code Examples
The code examples in storybook for PageHeader appear to be broken, especially the ones where children are passed to the component. Fix these in order to move towards a better, more robust and well-documented component.
Estimation
- Priority: High
- Effort: Medium
- Status: Backlog, Unrefined
Acceptance Criteria
Technical Notes
Design
Note some of the elements shown in the design files are child components that do not need to be implemented now, such as the user avatar, user menu, search field, and additional header options (notifications icon, mode switch) . These are or may be WIP and are NOT in scope of this implementation ticket.
For colors, we are using a pseudo-token system at the moment which is not 100% aligned with the variables in our code, refer to the table below under Design Tokens / CSS Variables for the exact variables to use.
For dimensions, Figma shows px, in the implementation use the corresponding value in rem.
Layout Robustness
Currently, the PageHeader consists of a two-column grid layout that takes care of the horizontal distribution of its parts. The columns each contain a flex box element that takes care of vertical alignment. For some reasons, the logo does not seem to be part of this setup. In the past and in some cases (example app?), elements in the header did not seem to align vertically as expected. Investigate and improve alignment. A sensible lead would be to include the logo in the grid setup as well, but there may be better apporaches(?).
API
| Prop |
Type |
Default |
Notes |
applicationName |
string or ReactElement |
"" |
Replaces heading which will be deprecated |
heading |
string |
"" |
Already exists, deprecate. Forwad to applicationName if passed |
href |
string (url) |
"" |
To be added as an option to use a link to the app's home page. Make sure both logo and application name element point to that link if passed. |
onClick |
func |
null |
Already exists. Make sure both logo and application name element execute this handler if passed. |
Design Tokens / CSS Variables
In order to support theming to the desired extent, we need to introduce the following CSS variables:
| Property |
@theme Variable |
Per-Mode Variable |
Juno Light |
Juno Dark |
| pageheader bg color |
--background-color-theme-pageheader |
--color-pageheader-background |
--color-white |
--color-juno-grey-blue-10 |
| bottom border color |
--border-color-theme-pageheader |
--color-pageheader-border |
--color-juno-grey-light-7 |
--color-juno-grey-blue-3 |
| application name color default |
--text-color-theme-pageheader-appname-default |
--color-pageheader-appname-text-default |
--color-text-highest* |
--color-text-highest* |
| application name color hover |
--text-color-theme-pageheader-appname-hover |
--color-pageheader-appname-text-hover |
--color-text-highest* |
--color-text-highest* |
| application name color active |
--text-color-theme-pageheader-appname-active |
--color-pageheader-appname-text-active |
--color-text-highest* |
--color-text-highest* |
- The native Juno theme does not visually differentiate the interactive states of the application name in terms of color, however the next theme to be implemented will, so we need to implement these variables already.
Storybook Code Examples
The code examples for PageHeader show incorrect or incomplete code examples: Passed children are not visible or only as a fragment, passed handlers show minimized or fragmented. These need investigating and fixing.
Considerations
Dependencies
These updates to the PageHeader component will affect all applications that use it, either via AppShell or standalone.
Risks
None(?)
Questions
None so far.
QA
Additional Links
Here’s a older ticket for only the alignment issues in the current PageHeader:
[Improvement](ui): Enhance PageHeader Layout for Vertical Alignment · Issue #1050 · cloudoperators/juno
Once this ticket is implemented, #1050 can be closed. Optionally, we can close the #1050 once this one is refined and ready for implementation.
Overview
Problem Statement
The currently implemented PageHeader does not reflect the latest visual design and does have some stability / robustness / alignment issues, API issues, and does not support theming as much as we need it to going forward with theming support.
Goal
Implement the updated visual design of the PageHeader, make the component more robust, improve element alignment, improve its API, and extend its support for theming.
Context
This design update of the PageHeader components is necessary as a preparation to enable us to roll out additional themes and increase its stability and flexibility as a component.
Task Outcome
Have the updated PageHeader in Juno and all apps using the most current version of Juno ui-components, while not breaking apps due to breaking changes in the API of the component.
Details
Description
This task covers multiple aspects of the component:
Visual Design
The component need updating its outer margins/paddings in both verical and horizontal direction. See Figma for details and exact values:
Figma Pageheader Component
Layout Robustness
The layout of the component needs improving. Make sure the logo and/or any children passed to the component never manage to alter the dimensions of the PageHeader, and all elements incl. any logo passed in always center-align in the vertical axis. See Technical Details below for more details.
API Updates
Add
applicationNameprop, deprecateheadingCurrently, the component has a
headingprop that accepts a string to be rendered as the application name in the header. The naming of this prop is unfortunate as it is semantically wrong and not self-explanatory.To improve the API, implement an
applicationNameprop for the exact same purpose. Keep theheadingfor backwards compatibility but mark as deprecated in the code and documentation. This will need to exist as long as we have apps that use it. Once we have changed all apps to use the new prop, we can remove it.Implement
hrefpropIn order to be consistent with multiple other components, add an
hrefprop that accepts a string/url to complement theonClickprop we already have, so users can use either a JS-handler or a plain href anchor to link to the homepage of their app.Depending on what markup we end up in order to make our layout more robust, both logo and application name should be wrapped in an
<a>element OR be wrapped in individual element ifhrefis passed. TheonClickhandler should be applied to both following the same logic.As an end result we expect an
onClickhandler to be executed when clicking the logo AND/OR the application name; if anhrefwas passed, we expect the link to be called when clicking the logo AND/OR the application name. An<a>element should only ever be created ifhrefwas passed.Theming / CSS Variables
In order to allow for better theming support, we need to introduce more design token / CSS variables for the header background, border, and the application name. See Technical Details below for an in-depth table of variables and their mappings.
Storybook Code Examples
The code examples in storybook for
PageHeaderappear to be broken, especially the ones where children are passed to the component. Fix these in order to move towards a better, more robust and well-documented component.Estimation
Acceptance Criteria
applicationNameprop is introducedheadingis deprecated, its value forwarded toapplicationNamehrefis introducedhrefwas passed, clicking both the logo and/or the application name should point to that link.hrefwas passed, no<a>should be createdonClickhandler was passed, it should be executed when the logo and/or the application name was clicked.Technical Notes
Design
Note some of the elements shown in the design files are child components that do not need to be implemented now, such as the user avatar, user menu, search field, and additional header options (notifications icon, mode switch) . These are or may be WIP and are NOT in scope of this implementation ticket.
For colors, we are using a pseudo-token system at the moment which is not 100% aligned with the variables in our code, refer to the table below under Design Tokens / CSS Variables for the exact variables to use.
For dimensions, Figma shows
px, in the implementation use the corresponding value inrem.Layout Robustness
Currently, the PageHeader consists of a two-column grid layout that takes care of the horizontal distribution of its parts. The columns each contain a flex box element that takes care of vertical alignment. For some reasons, the logo does not seem to be part of this setup. In the past and in some cases (example app?), elements in the header did not seem to align vertically as expected. Investigate and improve alignment. A sensible lead would be to include the logo in the grid setup as well, but there may be better apporaches(?).
API
applicationNamestringorReactElement""headingwhich will be deprecatedheadingstring""applicationNameif passedhrefstring(url)""onClickfuncnullDesign Tokens / CSS Variables
In order to support theming to the desired extent, we need to introduce the following CSS variables:
@themeVariable--background-color-theme-pageheader--color-pageheader-background--color-white--color-juno-grey-blue-10--border-color-theme-pageheader--color-pageheader-border--color-juno-grey-light-7--color-juno-grey-blue-3--text-color-theme-pageheader-appname-default--color-pageheader-appname-text-default--color-text-highest*--color-text-highest*--text-color-theme-pageheader-appname-hover--color-pageheader-appname-text-hover--color-text-highest*--color-text-highest*--text-color-theme-pageheader-appname-active--color-pageheader-appname-text-active--color-text-highest*--color-text-highest*Storybook Code Examples
The code examples for
PageHeadershow incorrect or incomplete code examples: Passed children are not visible or only as a fragment, passed handlers show minimized or fragmented. These need investigating and fixing.Considerations
Dependencies
These updates to the
PageHeadercomponent will affect all applications that use it, either viaAppShellor standalone.Risks
None(?)
Questions
None so far.
QA
Additional Links
Here’s a older ticket for only the alignment issues in the current PageHeader:
[Improvement](ui): Enhance PageHeader Layout for Vertical Alignment · Issue #1050 · cloudoperators/juno
Once this ticket is implemented, #1050 can be closed. Optionally, we can close the #1050 once this one is refined and ready for implementation.