Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
29c34cf
feat: scaffold custom group block
Yannicvanveen Sep 3, 2026
9f15273
feat: scaffold custom card
Yannicvanveen Sep 3, 2026
7cdb460
feat: scaffold section block
Yannicvanveen Sep 3, 2026
8508aef
feat: add color support to group and section blocks
Yannicvanveen Sep 3, 2026
024a223
feat: add spacing settings for group and settings blocks
Yannicvanveen Sep 3, 2026
c5c18a9
feat: add default group styling / disable margin setting
Yannicvanveen Sep 7, 2026
b3d5bd7
feat: make section alignfull by default
Yannicvanveen Sep 7, 2026
d4ab46b
feat: add default section styling
Yannicvanveen Sep 7, 2026
886003e
feat: add default template to section block
Yannicvanveen Sep 7, 2026
2d1d1f6
feat: remove padding setting from section block / set wide default wi…
Yannicvanveen Sep 8, 2026
52554c7
feat: add card block default template / move shared theme block edito…
Yannicvanveen Sep 8, 2026
986d882
feat: add group block blade template / remove alignment
Yannicvanveen Sep 8, 2026
d7f0499
feat: add card block image control
Yannicvanveen Sep 8, 2026
d6e8cd5
feat: add card image preview in editor
Yannicvanveen Sep 8, 2026
2297927
feat: add media toolbar to card block
Yannicvanveen Sep 8, 2026
2eef442
feat: add aspect ratio to card images
Yannicvanveen Sep 8, 2026
7559075
feat: move card block styling to block folder
Yannicvanveen Sep 8, 2026
738a248
feat: move section and group styles to block folders
Yannicvanveen Sep 8, 2026
c716a33
feat: add larger margin above card button
Yannicvanveen Sep 8, 2026
1dba218
fix: dont merge attrs with block wrapper attrs in section block
Yannicvanveen Sep 8, 2026
44cd083
feat: use innerBlockProps
Yannicvanveen Sep 8, 2026
bc60f54
feat: add card arrow styling
Yannicvanveen Sep 8, 2026
d0b0223
feat: cleanup original group css / add card equal height styles
Yannicvanveen Sep 10, 2026
a5a89ac
feat: update card children classes
Yannicvanveen Sep 10, 2026
e7febd6
feat: add abstract block class
Yannicvanveen Sep 10, 2026
dc4c6f5
feat: remove core group card variation
Yannicvanveen Sep 10, 2026
215a468
feat: only allow cards in group grid block
Yannicvanveen Sep 10, 2026
127b2cb
feat: add group alert variation and style / update icons
Yannicvanveen Sep 10, 2026
f3f7f06
wip: add article block
Yannicvanveen Sep 10, 2026
44a0688
feat: add default template to article block
Yannicvanveen Sep 11, 2026
795b607
feat: use blade templates for all new blocks / add phpdoc to templates
Yannicvanveen Sep 11, 2026
05259b2
feat: refactor back-button to use Block class
Yannicvanveen Sep 11, 2026
3112a86
feat: scaffold basic banner block
Yannicvanveen Sep 11, 2026
a5fb928
feat: add image control to banner
Yannicvanveen Sep 11, 2026
880121c
feat: add basic banner styling
Yannicvanveen Sep 11, 2026
d15b583
feat: update block supports settings
Yannicvanveen Sep 30, 2026
484cc93
fix: make card image clickable
Yannicvanveen Sep 30, 2026
238de8d
feat: use config in admin but split variables so admin does not recei…
Yannicvanveen Sep 30, 2026
a74d537
feat: update card block patterns
Yannicvanveen Sep 30, 2026
d68df51
feat: apply focal point in banner and card templates
Yannicvanveen Sep 30, 2026
885148a
refactor: flatten block class folders into App\Blocks namespace
YvetteNikolov Oct 1, 2026
22e24dc
feat(section): use section margin spacing and collapse gap between ba…
YvetteNikolov Oct 1, 2026
7a64509
refactor(card): replace inspector image picker with media buttons
YvetteNikolov Oct 1, 2026
1e43c0f
chore: change theme/card
YvetteNikolov Oct 1, 2026
4b527ba
feat: change theme/card icon, add ancestor, refactor to blockClassName
YvetteNikolov Oct 1, 2026
97ab2e2
refactor(blocks): rename blockDefaultClassname to blockClassName in PHP
YvetteNikolov Oct 1, 2026
d05a5f9
refactor(banner): rename __inner to __container and simplify layout s…
YvetteNikolov Oct 1, 2026
e6e9455
refactor(banner): align layout and media controls with card block
YvetteNikolov Oct 1, 2026
0799755
feat(banner): force full-width alignment in editor and frontend
YvetteNikolov Oct 1, 2026
f54d19c
chore: some more changes for the banner
YvetteNikolov Oct 1, 2026
24d4dad
chore: change theme/group
YvetteNikolov Oct 1, 2026
21f86e3
refactor(card): move card tokens to variables.css and add hover lift …
YvetteNikolov Oct 1, 2026
7ce3553
feat: update patterns and block templates
YvetteNikolov Oct 1, 2026
91210b0
refactor(article): use WP block class and move layout styles into block
YvetteNikolov Oct 1, 2026
fa08597
refactor(blocks): drop --theme- prefix from block CSS variables
YvetteNikolov Oct 1, 2026
9661279
feat(banner): sync banner image to post featured image
YvetteNikolov Oct 1, 2026
bc9747e
chore: some small changes
YvetteNikolov Oct 1, 2026
c5ec29e
refactor: use <x-block-theme-article> block
YvetteNikolov Oct 5, 2026
284458c
refactor: __media to __image-container
YvetteNikolov Oct 5, 2026
ca95a4e
refactor(blocks): simplify base Block class and move view logic into …
YvetteNikolov Oct 5, 2026
ecc2537
fix(group): show alert variation title
YvetteNikolov Oct 5, 2026
74ae6e0
chore: some minor css changes
YvetteNikolov Oct 5, 2026
be03137
fix(group): position alert icon absolutely so inner blocks stack
YvetteNikolov Oct 5, 2026
7ff70ed
feat(group): use theme/group as grouping block
YvetteNikolov Oct 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
510 changes: 256 additions & 254 deletions composer.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
"yard-toolkit": "yard-toolkit"
},
"devDependencies": {
"@yardinternet/eslint-config": "^1.3.1",
"@yardinternet/prettier-config": "^2.1.0",
"@yardinternet/stylelint-config": "^1.1.8",
"@yardinternet/toolkit": "^3.0.4",
"@yardinternet/vite-config": "^2.0.4",
"@yardinternet/eslint-config": "^1.3.3",
"@yardinternet/prettier-config": "^2.1.1",
"@yardinternet/stylelint-config": "^1.1.10",
"@yardinternet/toolkit": "^3.0.9",
"@yardinternet/vite-config": "^2.0.7",
"tailwindcss": "^4.3.2",
"vite": "^8.1.3"
},
"dependencies": {
"@yardinternet/a11y-cookie-yes": "^1.3.3",
"@yardinternet/brave-frontend-kit": "^0.13.3",
"@yardinternet/gutenberg-block-restrictions": "^1.0.1",
"@yardinternet/gutenberg-components": "^1.3.3"
"@yardinternet/brave-frontend-kit": "^0.14.1",
"@yardinternet/gutenberg-block-restrictions": "^1.0.2",
"@yardinternet/gutenberg-components": "^1.4.2"
},
"packageManager": "pnpm@10.33.0"
}
3,609 changes: 842 additions & 2,767 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export default braveConfig( {
'resources/styles/base/config.css',
'resources/styles/editor.css',
'resources/styles/frontend.css',
'resources/styles/admin.css',
],
} );
26 changes: 26 additions & 0 deletions web/app/themes/sage/app/Blocks/BackButton.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace App\Blocks;

use Illuminate\Support\Arr;

final class BackButton extends Block
{
protected function with(array $attributes, \WP_Block $block): array
{
return [
'classes' => Arr::toCssClasses([
wp_get_block_default_classname($block->name),
'align' . ($attributes['align'] ?? '') => ! empty($attributes['align']),
$attributes['className'] ?? '',
]),
];
}

protected function shouldRender(string $content): bool
{
return (bool) wp_get_post_parent_id();
}
}
41 changes: 0 additions & 41 deletions web/app/themes/sage/app/Blocks/BackButton/BackButton.php

This file was deleted.

22 changes: 22 additions & 0 deletions web/app/themes/sage/app/Blocks/Banner.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Blocks;

final class Banner extends Block
{
protected function with(array $attributes, \WP_Block $block): array
{
$focalPoint = $attributes['focalPoint'] ?? [];

return [
'imageId' => (int) ($attributes['imageId'] ?? 0),
'focalPointStyle' => sprintf(
'object-position: %d%% %d%%;',
($focalPoint['x'] ?? 0.5) * 100,
($focalPoint['y'] ?? 0.5) * 100,
),
];
}
}
32 changes: 32 additions & 0 deletions web/app/themes/sage/app/Blocks/Block.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace App\Blocks;

class Block
{
public function __invoke(array $attributes, string $content, \WP_Block $block): string
{
if (! $this->shouldRender($content)) {
return '';
}

return view('blocks.' . str_replace('/', '.', $block->name), [
'attributes' => $attributes,
'blockClassName' => wp_get_block_default_classname($block->name),
'content' => $content,
...$this->with($attributes, $block),
])->render();
}

protected function with(array $attributes, \WP_Block $block): array
{
return [];
}

protected function shouldRender(string $content): bool
{
return '' !== trim($content);
}
}
22 changes: 22 additions & 0 deletions web/app/themes/sage/app/Blocks/Card.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Blocks;

final class Card extends Block
{
protected function with(array $attributes, \WP_Block $block): array
{
$focalPoint = $attributes['focalPoint'] ?? [];

return [
'imageId' => (int) ($attributes['imageId'] ?? 0),
'focalPointStyle' => sprintf(
'object-position: %d%% %d%%;',
($focalPoint['x'] ?? 0.5) * 100,
($focalPoint['y'] ?? 0.5) * 100,
),
];
}
}
2 changes: 1 addition & 1 deletion web/app/themes/sage/app/Hooks/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function registerBlockEditorAssets()

echo Vite::withEntryPoints([
'web/app/themes/'. get_stylesheet() . '/resources/scripts/editor/editor.js',
'web/app/themes/'. get_stylesheet() . '/resources/styles/base/config.css',
'web/app/themes/'. get_stylesheet() . '/resources/styles/admin.css',
])->toHtml();
}

Expand Down
37 changes: 35 additions & 2 deletions web/app/themes/sage/config/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,51 @@

declare(strict_types=1);

use App\Blocks\BackButton\BackButton;
use App\Blocks\BackButton;
use App\Blocks\Banner;
use App\Blocks\Block;
use App\Blocks\Card;

return [
/**
* Register a block type with the same parameters as the `register_block_type` function.
*
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
'article' => [
'block_type' => 'article',
'args' => [
'render_callback' => new Block(),
],
],
'back-button' => [
'block_type' => 'back-button',
'args' => [
'render_callback' => (new BackButton())->render(...),
'render_callback' => new BackButton(),
],
],
'banner' => [
'block_type' => 'banner',
'args' => [
'render_callback' => new Banner(),
],
],
'group' => [
'block_type' => 'group',
'args' => [
'render_callback' => new Block(),
],
],
'card' => [
'block_type' => 'card',
'args' => [
'render_callback' => new Card(),
],
],
'section' => [
'block_type' => 'section',
'args' => [
'render_callback' => new Block(),
],
],
];
8 changes: 8 additions & 0 deletions web/app/themes/sage/config/gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@
* Restrict available inner blocks per parent block
*/
'innerBlockRestrictions' => [
'core/group' => [
'when' => [
[
'className' => 'pattern-grid-cards',
'add' => ['theme/card'],
],
],
],
'core/media-text' => [
'blockSet' => 'minimalContent',
],
Expand Down
8 changes: 0 additions & 8 deletions web/app/themes/sage/config/poet.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,10 @@
*/

'block_pattern' => [
'cards-3-with-image' => [
'title' => 'Vrije invoer kaarten - 3 stuks - met afbeelding',
'categories' => ['yard-cards'],
],
'cards-3' => [
'title' => 'Vrije invoer kaarten - 3 stuks',
'categories' => ['yard-cards'],
],
'cards-2-with-image' => [
'title' => 'Vrije invoer kaarten - 2 stuks - met afbeelding',
'categories' => ['yard-cards'],
],
'cards-2' => [
'title' => 'Vrije invoer kaarten - 2 stuks',
'categories' => ['yard-cards'],
Expand Down
23 changes: 23 additions & 0 deletions web/app/themes/sage/resources/scripts/blocks/article/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "theme/article",
"title": "Layout: artikel",
"category": "theme",
"description": "Een layout met een witte achtergrond en een vaste breedte.",
"supports": {
"align": [ "wide" ],
"html": false,
"multiple": false,
"reusable": false
},
"attributes": {
"align": {
"type": "string",
"default": "wide"
}
},
"editorScript": "file:./index.js",
"editorStyle": "file:./editor-style.css",
"style": "file:./style.css"
}
52 changes: 52 additions & 0 deletions web/app/themes/sage/resources/scripts/blocks/article/edit.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';

/**
* Internal dependencies
*/
import './editor-style.css';

const TEMPLATE = [
[
'theme/back-button',
{
align: 'none',
lock: {
remove: true,
move: true,
},
},
],
[
'core/post-title',
{
level: 1,
lock: {
remove: true,
move: true,
},
},
],
[
'core/paragraph',
{
content: __(
'Schrijf een korte introductie in één lopende alinea. Begin direct met de belangrijkste informatie. Gebruik actieve, duidelijke B1-taal en vermijd overbodige woorden, herhaling en vaag taalgebruik.',
'sage'
),
},
],
];

const Edit = () => {
const innerBlocksProps = useInnerBlocksProps( useBlockProps(), {
template: TEMPLATE,
} );

return <div { ...innerBlocksProps } />;
};

export default Edit;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@reference '@sage/styles/base/config';
@reference '@sage/styles/base/custom-variants';
@reference '@sage/styles/base/utilities';
15 changes: 15 additions & 0 deletions web/app/themes/sage/resources/scripts/blocks/article/icon.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* External dependencies
*/
import { BlockIconColor } from '@yardinternet/gutenberg-components';

const icon = {
src: (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640">
<path d="M192 96L320 96L320 192C320 227.3 348.7 256 384 256L480 256L480 512C480 529.7 465.7 544 448 544L192 544C174.3 544 160 529.7 160 512L160 128C160 110.3 174.3 96 192 96zM352 109.3L466.7 224L384 224C366.3 224 352 209.7 352 192L352 109.3zM192 64C156.7 64 128 92.7 128 128L128 512C128 547.3 156.7 576 192 576L448 576C483.3 576 512 547.3 512 512L512 250.5C512 233.5 505.3 217.2 493.3 205.2L370.7 82.7C358.7 70.7 342.5 64 325.5 64L192 64zM240 320C231.2 320 224 327.2 224 336C224 344.8 231.2 352 240 352L400 352C408.8 352 416 344.8 416 336C416 327.2 408.8 320 400 320L240 320zM240 416C231.2 416 224 423.2 224 432C224 440.8 231.2 448 240 448L400 448C408.8 448 416 440.8 416 432C416 423.2 408.8 416 400 416L240 416z" />
</svg>
),
...BlockIconColor,
};

export default icon;
19 changes: 19 additions & 0 deletions web/app/themes/sage/resources/scripts/blocks/article/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* WordPress dependencies
*/
import { registerBlockType } from '@wordpress/blocks';

/**
* Internal dependencies
*/
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import './style.css';

registerBlockType( metadata, {
edit,
icon,
save,
} );
Loading