Adding MainContainer, ActiveMainContext, and related files#195
Adding MainContainer, ActiveMainContext, and related files#195tbiethman merged 12 commits intoterra-application-v2from
Conversation
…ation into story-156-active-main-page # Conflicts: # CHANGELOG.md # src/application-container/ApplicationContainer.jsx # src/application-container/private/skip-to-links/SkipToLink.jsx # tests/wdio/test-harness/index.jsx # translations/en-US.json # translations/en.json
| }); | ||
|
|
||
| return () => { | ||
| dispatch({ type: 'unregister', registrationId }); |
There was a problem hiding this comment.
nitpick for readability/consistency
| dispatch({ type: 'unregister', registrationId }); | |
| dispatch({ | |
| type: 'unregister', | |
| registrationId, | |
| }); |
| @@ -0,0 +1,5 @@ | |||
| :local { | |||
| .main-container { | |||
| outline: none; | |||
There was a problem hiding this comment.
should main have 100% height?
There was a problem hiding this comment.
I thought about this but erred on the side of caution. If we add a height, I feel like we'd need to make the same call for overflow handling. But that is not always desired/required (for the Page use case, or example), which opens the door to all sorts of props to disable/enable things...
Long story long I'd like to avoid adding more styles here, for the time being at least. Makes me wonder if we should add a MainContainer to the eventual LegacyLayout and provide the default styling we used to provide there while keeping this component more generic.
| // If an ancestor provider exists, we need to forward the active main info | ||
| // if the provider exists in the active navigation branch. It is | ||
| // otherwise unregistered, if necessary, as we do not want potentially stale | ||
| // information living above this provider level. |
There was a problem hiding this comment.
Having nested active main providers should never be a thing right? If that happens maybe we should just blow up?
There was a problem hiding this comment.
It is a thing, as the ActiveMainProviders are rendered both by the ApplicationContainer as well as by each NavigationItem (which will be inside the ApplicationContainer, and potentially nested even further if we have secondary/tertiary navigation concepts).
The nested providers are what allow us to limit cross-talk between different navigation branches of the application.
Summary
Adding the MainContainer here, which provides an easy way for consumers to render accessible main content. Also added is infrastructure to communicate the applications current active main element, with integration into our navigation architecture. This is primarily used by Workspace but could have other applications in the future.
Closes #156.
Deployment Link
https://terra-applic-.herokuapp.com/
Testing
Unit and functional tests added for new functionality.
Additional Details
Thank you for contributing to Terra.
@cerner/terra