feat(LINCHPIN-5639): Add a settings card, place notices and rename the stylesheet - #14
Merged
Merged
Conversation
…e stylesheet Everything here came out of adopting this package in psst, the first consumer. SettingsCard is the section shape every plugin was still building by hand out of a Card, a CardHeader holding a heading and a sentence, and a CardBody. The screen story in this repo was a third copy of it. The compiled stylesheet moves to build-style/chrome.css. wp-scripts routes any module whose file is named style.css into a separate style-<entry>.css, so a library stylesheet with that name never reaches the bundle the plugin enqueues and the screen loads unstyled. The ./style.css specifier still resolves, so no consumer has to change an import or configure webpack. Also fixed: - lp-admin__notices is placed by the chrome rather than left to each consumer, and the snackbars are centred in core's full width strip instead of the strip being centred and dragged off screen - the layout's middle column is a div, so it stops nesting a second main landmark inside the one wp-admin already opens - the danger zone takes the strong error stroke at 2px on all four sides - the danger zone's standing warning is no longer announced on mount, since it describes a risk rather than reporting an event
…me stays gone The published surface check still looked for build-style/style.css, which the rename in this branch removed, so the job failed on an artifact that is not supposed to exist any more. The second assertion is the one worth keeping: that filename is exactly what wp-scripts splits out of a consuming plugin's bundle, so a future change that reintroduces it should fail here rather than in whichever plugin loads the screen unstyled next.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Everything here came out of adopting this package in psst, the first real consumer. Task: Standard admin component library: linchpin/ui.
The packaging fix, which every consumer needs
The compiled stylesheet moves to
build-style/chrome.css.@wordpress/scriptsroutes any module whose file is namedstyle.cssinto a separatestyle-<entry>.css— the mechanism that separates a block's front-end styles from its editor ones — so a library stylesheet with that name never reaches the bundle the plugin enqueues, and the screen loads with no chrome on it.Because the rule matches the file rather than the specifier,
import '@linchpinagency/ui/style.css'still works. No consumer changes an import or configures webpack. Verified end to end: packed this branch, installed the tarball into psst, deleted psst's workaround, built — oneadmin.csswith the chrome in it.New
<SettingsCard>— the section shape every plugin was still building by hand out of aCard, aCardHeaderholding a heading and a sentence, and aCardBody. The screen story in this repo was a third copy of it. Takestitle,description,headingLevel,actions; renders no header without one, and no body without children.Fixed
lp-admin__noticesis placed by the chrome rather than left to each consumer. Core's.components-snackbar-listis a full-width, click-through strip, so the strip is pinned and the snackbars centred inside it — centring the strip itself slides its whole width off to the left, which is where psst's snackbars ended up.<div>, so it stops nesting a secondmainlandmark inside the one wp-admin already opens as<div id="wpbody" role="main">.Noticespeaks its children, and anerrorstatus speaks them assertively, so it interrupted a screen reader on every page load to read a sentence already on screen.Checks
lint:js,lint:css, build andverify:esmpass. 89 tests, 6 new — covering the card, the landmark and the silent warning. The announcement test fails without its fix; I checked.Storybook has a new Chrome/Settings card story, and the screen story now uses the component instead of hand-rolling one. Worth a look there before merging: I verified the danger-zone border in psst rather than in Storybook.