-
Notifications
You must be signed in to change notification settings - Fork 13
feat: add tag labels to the Carousel block #429
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
base: main
Are you sure you want to change the base?
Changes from all commits
de75280
c00f62b
fb59a93
e098961
5705474
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,18 +36,42 @@ amp-script .tag-labels { | |
| } | ||
| /* stylelint-enable */ | ||
|
|
||
| // Tag labels render after the category (and sponsor) label and sit on the same line, | ||
| // mirroring the sponsor → category convention. The category `.cat-links` is immediately | ||
| // followed by the tag-labels `.cat-links.tag-labels` in every context (single posts, | ||
| // home, archive, search, and the Content Loop / Carousel blocks), so keep it inline-block | ||
| // and space the tag labels that follow it. The sponsor `.cat-links.sponsor-label` keeps | ||
| // its own layout (from newspack-sponsors), so it is excluded here. | ||
| .cat-links:not( .sponsor-label ):has( + .tag-labels ) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: The category's inline adjustment depends on the CSS |
||
| display: inline-block; | ||
| } | ||
| .cat-links + .tag-labels { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: The global |
||
| display: inline-flex; | ||
| margin-left: 0.5em; | ||
| } | ||
|
|
||
| // In the Content Loop (`.wpnbha`) and Carousel (`.wpnbpc`) blocks the category | ||
| // `.cat-links` is block-level (`display: flex` in `.wpnbha`, default block in `.wpnbpc`), | ||
| // which would stack the category and the tag labels that follow it. Re-assert | ||
| // `inline-flex` with higher specificity so the category and tag labels share one line. | ||
| // Sponsor rows (`.cat-links.sponsor-label`) are excluded so their own `flex`/`gap` | ||
| // layout wins deterministically. | ||
| .wpnbha, | ||
| .wpnbpc { | ||
| .cat-links:not( .sponsor-label ):has( + .tag-labels ), | ||
| .cat-links + .tag-labels { | ||
| display: inline-flex; | ||
| } | ||
| .cat-links + .tag-labels { | ||
| margin-left: 0.5em; | ||
| } | ||
| } | ||
|
|
||
| /* Single Posts */ | ||
| .single { | ||
| // When categories are visible | ||
| .tag-labels { | ||
| display: inline-flex; | ||
| } | ||
| // Labels render before categories (matching the sponsor-label convention), | ||
| // so space the category that follows a label — mirrors `.sponsor-label + .cat-links`. | ||
| .tag-labels + .cat-links { | ||
| display: inline-block; | ||
| margin-left: 0.5em; | ||
| } | ||
|
|
||
| // Workaround margin/padding override for featured images. | ||
| .featured-image-behind { | ||
|
|
@@ -76,18 +100,9 @@ amp-script .tag-labels { | |
| } | ||
| } | ||
|
|
||
| // Re-show the category that follows a tag label on search results. | ||
| .search article .tag-labels + .cat-links { | ||
| display: inline-flex; | ||
| } | ||
|
|
||
| // Home page. | ||
| .home { | ||
| article { | ||
| .tag-labels, | ||
| .tag-labels + .cat-links { | ||
| display: inline-flex; | ||
| } | ||
| .tag-labels a, | ||
| .tag-labels a:hover { | ||
| padding: 0.3em 0.5em; | ||
|
|
||
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.
Nit:
showTagLabelsdefaults totrue, so any existing Carousel block with no saved value will begin rendering flagged tag labels on the next load, with no editor action. This matches the already-merged Content Loop default, so it's consistent — just worth a release-notes line so the rollout isn't a surprise for publishers.