Repository navigation
Feat/custom group block - #180
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Legacy patterns regress, focal-point settings are ignored on the frontend, and several card/group behaviors are incorrect.
Review effort: Balanced
Findings: 1
Open (6)
Removing legacy styles breaks existing card patterns and content · New Position card overlay relative to the root card · New Default variation incorrectly matches alert blocks · New Limit alert grid column selector to direct children · New Apply saved focal point to the frontend banner image · New Apply saved focal point to the frontend card image · New
What changed in this PR
Introduces server-rendered Gutenberg blocks for reusable theme layouts and replaces legacy core Group variations.
Changes:
- Adds Article, Banner, Card, Group, and Section blocks.
- Adds block templates, styling, palettes, and PHP renderers.
- Updates legacy group/card behavior and editor configuration.
| File | Description |
|---|---|
web/app/themes/sage/theme.json |
Adds block color palettes. |
web/app/themes/sage/resources/views/components/card.blade.php |
Makes image ratio configurable. |
web/app/themes/sage/resources/views/blocks/theme/section.blade.php |
Renders Section blocks. |
web/app/themes/sage/resources/views/blocks/theme/group.blade.php |
Renders Group blocks. |
web/app/themes/sage/resources/views/blocks/theme/card.blade.php |
Renders Card blocks. |
web/app/themes/sage/resources/views/blocks/theme/banner.blade.php |
Renders Banner blocks. |
web/app/themes/sage/resources/views/blocks/theme/back-button.blade.php |
Moves Back Button rendering to Blade. |
web/app/themes/sage/resources/views/blocks/theme/article.blade.php |
Renders Article blocks. |
web/app/themes/sage/resources/styles/editor.css |
Loads theme-block editor styles. |
web/app/themes/sage/resources/styles/components/cards.css |
Adds configurable card image ratio. |
web/app/themes/sage/resources/styles/blocks/theme/editor.css |
Normalizes editor child margins. |
web/app/themes/sage/resources/styles/blocks/group/shared.css |
Removes legacy core Group styling. |
web/app/themes/sage/resources/scripts/editor/block-variations.jsx |
Removes replaced core Group variations. |
web/app/themes/sage/resources/scripts/blocks/section/style.css |
Styles Section blocks. |
web/app/themes/sage/resources/scripts/blocks/section/save.jsx |
Serializes Section contents. |
web/app/themes/sage/resources/scripts/blocks/section/index.jsx |
Registers the Section block. |
web/app/themes/sage/resources/scripts/blocks/section/icon.jsx |
Defines the Section icon. |
web/app/themes/sage/resources/scripts/blocks/section/editor-style.css |
Styles Section editor layout. |
web/app/themes/sage/resources/scripts/blocks/section/edit.jsx |
Implements Section editing. |
web/app/themes/sage/resources/scripts/blocks/section/block.json |
Defines Section metadata. |
web/app/themes/sage/resources/scripts/blocks/group/style.css |
Styles Group variants. |
web/app/themes/sage/resources/scripts/blocks/group/save.jsx |
Serializes Group contents. |
web/app/themes/sage/resources/scripts/blocks/group/index.jsx |
Registers the Group block. |
web/app/themes/sage/resources/scripts/blocks/group/icon.jsx |
Defines the Group icon. |
web/app/themes/sage/resources/scripts/blocks/group/editor-style.css |
Adds Group editor references. |
web/app/themes/sage/resources/scripts/blocks/group/edit.jsx |
Implements Group editing. |
web/app/themes/sage/resources/scripts/blocks/group/block.json |
Defines Group metadata and variations. |
web/app/themes/sage/resources/scripts/blocks/card/style.css |
Styles Card blocks. |
web/app/themes/sage/resources/scripts/blocks/card/save.jsx |
Serializes Card contents. |
web/app/themes/sage/resources/scripts/blocks/card/index.jsx |
Registers the Card block. |
web/app/themes/sage/resources/scripts/blocks/card/icon.jsx |
Defines the Card icon. |
web/app/themes/sage/resources/scripts/blocks/card/editor-style.css |
Adds Card editor stylesheet. |
web/app/themes/sage/resources/scripts/blocks/card/edit.jsx |
Implements Card editing and media controls. |
web/app/themes/sage/resources/scripts/blocks/card/block.json |
Defines Card metadata and attributes. |
web/app/themes/sage/resources/scripts/blocks/banner/style.css |
Styles Banner blocks. |
web/app/themes/sage/resources/scripts/blocks/banner/save.jsx |
Serializes Banner contents. |
web/app/themes/sage/resources/scripts/blocks/banner/index.jsx |
Registers the Banner block. |
web/app/themes/sage/resources/scripts/blocks/banner/icon.jsx |
Defines the Banner icon. |
web/app/themes/sage/resources/scripts/blocks/banner/editor-style.css |
Adds Banner editor references. |
web/app/themes/sage/resources/scripts/blocks/banner/edit.jsx |
Implements Banner editing and media controls. |
web/app/themes/sage/resources/scripts/blocks/banner/block.json |
Defines Banner metadata and attributes. |
web/app/themes/sage/resources/scripts/blocks/back-button/icon.jsx |
Updates the Back Button icon. |
web/app/themes/sage/resources/scripts/blocks/article/style.css |
Adds Article style references. |
web/app/themes/sage/resources/scripts/blocks/article/save.jsx |
Serializes Article contents. |
web/app/themes/sage/resources/scripts/blocks/article/index.jsx |
Registers the Article block. |
web/app/themes/sage/resources/scripts/blocks/article/icon.jsx |
Defines the Article icon. |
web/app/themes/sage/resources/scripts/blocks/article/editor-style.css |
Adds Article editor references. |
web/app/themes/sage/resources/scripts/blocks/article/edit.jsx |
Implements Article editing. |
web/app/themes/sage/resources/scripts/blocks/article/block.json |
Defines Article metadata. |
web/app/themes/sage/config/gutenberg.php |
Allows Cards inside core Groups. |
web/app/themes/sage/config/blocks.php |
Registers server render callbacks. |
web/app/themes/sage/app/Blocks/Section/Section.php |
Defines Section rendering metadata. |
web/app/themes/sage/app/Blocks/Group/Group.php |
Defines Group rendering metadata. |
web/app/themes/sage/app/Blocks/Card/Card.php |
Defines Card rendering metadata. |
web/app/themes/sage/app/Blocks/Block.php |
Adds the shared block renderer. |
web/app/themes/sage/app/Blocks/Banner/Banner.php |
Defines Banner rendering metadata. |
web/app/themes/sage/app/Blocks/BackButton/BackButton.php |
Migrates Back Button to shared rendering. |
web/app/themes/sage/app/Blocks/Article/Article.php |
Defines Article rendering metadata. |
vite.config.js |
Removes editor stylesheet prefix wrapping. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
| } | ||
|
|
||
| .wp-block-group-is-layout-grid { |
| .wp-block-theme-card { | ||
| @apply flex flex-col gap-(--card-padding) overflow-clip rounded-(--card-radius) bg-(--card-bg-color) p-(--card-padding) shadow-(--card-shadow); | ||
| --button-wrapper-block-spacing: 0; | ||
| } | ||
|
|
||
| .wp-block-theme-card__body { | ||
| @apply normalize-child-margin grow flex flex-col space-y-(--theme-card-content-spacing)!; | ||
|
|
||
| .wp-block-buttons { | ||
| @apply mt-auto!; | ||
| } | ||
|
|
||
| :has( + .wp-block-buttons ) { | ||
| --theme-card-content-spacing: var( --theme-card-buttons-spacing ); | ||
| } | ||
|
|
||
| &:has(.wp-block-heading a) { | ||
| @apply relative; |
| "name": "group-default", | ||
| "title": "Groep", | ||
| "isActive": [ "backgroundColor" ], | ||
| "isDefault": true, |
| * { | ||
| @apply col-[2/3]; | ||
| } |
| @if (($attributes['imageId'] ?? 0) > 0) | ||
| @php($imageSrc = wp_get_attachment_image_url($attributes['imageId'], 'large')) | ||
| <div class="{{ $blockDefaultClassname }}__media"> | ||
| <x-brave-img-focal-point class="{{ $blockDefaultClassname }}__image" :id="$attributes['imageId']" :src="$imageSrc" /> |
| </div> | ||
| @if (($attributes['imageId'] ?? 0) > 0) | ||
| @php($imageSrc = wp_get_attachment_image_url($attributes['imageId'], 'large')) | ||
| <x-brave-img-focal-point class="{{ $blockDefaultClassname }}__image" :id="$attributes['imageId']" :src="$imageSrc" /> |
| :where(.wp-block-theme-group, .wp-block-theme-section) { | ||
| > :last-child, | ||
| > :has( + .block-list-appender ) { | ||
| @apply mb-0; | ||
| } | ||
| } |
There was a problem hiding this comment.
Mag wat bij betreft in het verzamelbestand van /blocks/wp/shared.css
blocks/theme/ is namelijk niet echt een 'block'
…dth for section children
284458c
Composer package changes
|
laravdiemen
left a comment
There was a problem hiding this comment.
Ik moet het vooral zelf gaan uitproberen of het zou allemaal werkt, maar het ziet er wel goed uit! Dus ben benieuwd om het te gaan gebruiken
| </div> | ||
| </div> | ||
| <InspectorControls> | ||
| <PanelBody title={ __( 'Afbeelding', 'sage' ) }> |
There was a problem hiding this comment.
Ik weet niet helemaal hoe dit nou werkt, maar ik vind het wel een beetje lelijk dat er nu twee panel bodys zijn voor allebei de afbeelding. Zou in mijn ogen mooier zijn als het samen in 1 zit. Het is overigens geen wereldprobleem.


No description provided.