You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's possible that, in the future, we'll want a way for other content to insert itself into the area between the header and the pill links (created in #4050), see:
This issue was created out of the original approach in #4050 which was a slot/fill approach that would allow more content to be added into the header. We didn't need that at the time, but we're keeping this issue around in the "Stalled" section in case it's useful.
If it turns out we don't want/need this, feel free to close the issue. Much of the text below is copied from #4050's slot/fill implementation, with the IB created by @kuasha420.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
There should be a way to render React components into the header area highlighted in the screenshot.
Content should appear sorted by priority level (where 1 is the "highest" priority—eg. at the top, and then higher numbers appear below it), then in the order added to the header
We should use something like WordPress's Slot/Fill approach, eg. it should be declarative and not imperative
Removing content will happen when other components stop rendering content for the Header Slot/Fill—content will not be removed imperatively
Implementation Brief
In assets/js/components/Root/index.js:
Wrap the { children } with SlotFillProvider from @wordpress/component.
Create assets/js/components/HeaderFill.js component and do the following in it.
in the newly created HeaderFill component, take priority and children as props. set the default priority to 1.
return Fill component with the name header-content-area.
Inside the Fill, render a wrapper div element with priority as a prop and pass the children as its children.
Everything put together, it should be something like this:
Render a Slot component from @wordpress/components with the name header-content-area inside the header & below the <section className="mdc-layout-grid">...</section> tag.
Use the render pattern to sort the fills with the priority. ie.
Feature Description
It's possible that, in the future, we'll want a way for other content to insert itself into the area between the header and the pill links (created in #4050), see:
This issue was created out of the original approach in #4050 which was a slot/fill approach that would allow more content to be added into the header. We didn't need that at the time, but we're keeping this issue around in the "Stalled" section in case it's useful.
If it turns out we don't want/need this, feel free to close the issue. Much of the text below is copied from #4050's slot/fill implementation, with the IB created by @kuasha420.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
1
is the "highest" priority—eg. at the top, and then higher numbers appear below it), then in the order added to the headerImplementation Brief
In
assets/js/components/Root/index.js
:{ children }
withSlotFillProvider
from@wordpress/component
.Create
assets/js/components/HeaderFill.js
component and do the following in it.HeaderFill
component, takepriority
andchildren
as props. set the default priority to1
.Fill
component with the nameheader-content-area
.div
element withpriority
as a prop and pass thechildren
as its children.In
assets/js/components/Header.js
:Slot
component from@wordpress/components
with the nameheader-content-area
inside theheader
& below the<section className="mdc-layout-grid">...</section>
tag.In the future, we will be able to use the newly created
HeaderFill
component to render react elements to the header section. ie.Test Coverage
QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: