Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6dc5b0b
refactor: flatten block class folders into App\Blocks namespace
YvetteNikolov Oct 1, 2026
dacc70c
feat(section): use section margin spacing and collapse gap between ba…
YvetteNikolov Oct 1, 2026
8c770e0
refactor(card): replace inspector image picker with media buttons
YvetteNikolov Oct 1, 2026
f32a78a
chore: change theme/card
YvetteNikolov Oct 1, 2026
b357900
feat: change theme/card icon, add ancestor, refactor to blockClassName
YvetteNikolov Oct 1, 2026
24967f4
refactor(blocks): rename blockDefaultClassname to blockClassName in PHP
YvetteNikolov Oct 1, 2026
cb08409
refactor(banner): rename __inner to __container and simplify layout s…
YvetteNikolov Oct 1, 2026
78b8d46
refactor(banner): align layout and media controls with card block
YvetteNikolov Oct 1, 2026
2655e67
feat(banner): force full-width alignment in editor and frontend
YvetteNikolov Oct 1, 2026
a8dae22
chore: some more changes for the banner
YvetteNikolov Oct 1, 2026
3432f4a
chore: change theme/group
YvetteNikolov Oct 1, 2026
9d5bd3e
refactor(card): move card tokens to variables.css and add hover lift …
YvetteNikolov Oct 1, 2026
bb63ff6
feat: update patterns and block templates
YvetteNikolov Oct 1, 2026
63b2973
refactor(article): use WP block class and move layout styles into block
YvetteNikolov Oct 1, 2026
6112336
refactor(blocks): drop --theme- prefix from block CSS variables
YvetteNikolov Oct 1, 2026
e79d8fd
feat(banner): sync banner image to post featured image
YvetteNikolov Oct 1, 2026
ff06654
chore: some small changes
YvetteNikolov Oct 1, 2026
ccab336
refactor: use <x-block-theme-article> block
YvetteNikolov Oct 5, 2026
0287893
refactor: __media to __image-container
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.

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

declare(strict_types=1);

namespace App\Blocks\Article;

use App\Blocks\Block;
namespace App\Blocks;

class Article extends Block
{
protected array $classes = ['layout-article'];

public static string $name = 'theme/article';
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

declare(strict_types=1);

namespace App\Blocks\BackButton;

use App\Blocks\Block;
namespace App\Blocks;

class BackButton extends Block
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace App\Blocks\Banner;

use App\Blocks\Block;
namespace App\Blocks;

class Banner extends Block
{
protected array $classes = ['alignfull'];

public static string $name = 'theme/banner';
}
4 changes: 2 additions & 2 deletions web/app/themes/sage/app/Blocks/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function render(array $attributes, string $content, \WP_Block $block): Vi

return view($view, [
'attributes' => $attributes,
'blockDefaultClassname' => static::getBlockDefaultClassname(),
'blockClassName' => static::getBlockClassName(),
'blockWrapperAttributes' => $this->getBlockWrapperAttributes($attributes, $block),
'content' => $content,
]);
Expand Down Expand Up @@ -56,7 +56,7 @@ protected static function getViewPath(): string
return 'blocks.' . str_replace('/', '.', static::$name);
}

protected static function getBlockDefaultClassname(): string
protected static function getBlockClassName(): string
{
return wp_get_block_default_classname(static::$name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

declare(strict_types=1);

namespace App\Blocks\Card;

use App\Blocks\Block;
namespace App\Blocks;

class Card extends Block
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

declare(strict_types=1);

namespace App\Blocks\Group;

use App\Blocks\Block;
namespace App\Blocks;

class Group extends Block
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

declare(strict_types=1);

namespace App\Blocks\Section;

use App\Blocks\Block;
namespace App\Blocks;

class Section extends Block
{
Expand Down
12 changes: 6 additions & 6 deletions web/app/themes/sage/config/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

use App\Blocks\Article\Article;
use App\Blocks\BackButton\BackButton;
use App\Blocks\Banner\Banner;
use App\Blocks\Card\Card;
use App\Blocks\Group\Group;
use App\Blocks\Section\Section;
use App\Blocks\Article;
use App\Blocks\BackButton;
use App\Blocks\Banner;
use App\Blocks\Card;
use App\Blocks\Group;
use App\Blocks\Section;

return [
/**
Expand Down
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: 2 additions & 6 deletions web/app/themes/sage/resources/scripts/blocks/article/edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,15 @@ const TEMPLATE = [
'core/paragraph',
{
content: __(
'Korte tekst van ongeveer 3 regels. Cupidatat amet nostrud non elit amet cupidatat elit sit proident anim duis.',
'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 blockProps = useBlockProps( {
className: 'layout-article',
} );

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BlockIconColor } from '@yardinternet/gutenberg-components';
const icon = {
src: (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640">
<path d="M330.1 98.2L532.9 192L330.1 285.7C323.7 288.7 316.3 288.7 310 285.7L107.1 192L309.9 98.2C316.3 95.2 323.6 95.2 330 98.2zM343.5 69.2C328.6 62.3 311.4 62.3 296.5 69.2L77.9 170.2C69.4 174.1 64 182.6 64 192C64 201.4 69.4 209.9 77.9 213.8L296.5 314.8C311.4 321.7 328.6 321.7 343.5 314.8L562.1 213.8C570.6 209.9 576 201.4 576 192C576 182.6 570.6 174.1 562.1 170.2L343.5 69.2zM112.1 282.4L77.9 298.2C69.4 302.1 64 310.6 64 320C64 329.4 69.4 337.9 77.9 341.8L296.5 442.8C311.4 449.7 328.6 449.7 343.5 442.8L562.1 341.8C570.6 337.9 576 329.4 576 320C576 310.6 570.6 302.1 562.1 298.2L528 282.4L489.9 300L533 319.9L330.1 413.7C323.7 416.7 316.3 416.7 310 413.7L107.1 320L150.2 300L112.1 282.4zM77.9 426.2C69.4 430.1 64 438.6 64 448C64 457.4 69.4 465.9 77.9 469.8L296.5 570.8C311.4 577.7 328.6 577.7 343.5 570.8L562.1 469.8C570.6 465.9 576 457.4 576 448C576 438.6 570.6 430.1 562.1 426.2L528 410.4L489.9 428L533 447.9L330.1 541.7C323.7 544.7 316.3 544.7 310 541.7L107.1 448L150.2 428L112.1 410.4L77.9 426.2z" />
<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,
Expand Down
16 changes: 16 additions & 0 deletions web/app/themes/sage/resources/scripts/blocks/article/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@reference '@sage/styles/base/config';
@reference '@sage/styles/base/custom-variants';
@reference '@sage/styles/base/utilities';

:root {
--article-width: min(
calc( 100% - var( --container-padding ) * 2 ),
1000px
);
--article-padding: 2rem 0rem;

@variant lg {
--article-padding: 5rem 0rem;
}
}

.wp-block-theme-article {
@apply is-main-content create-main-content-alignment mx-auto my-section max-w-(--article-width)! rounded-theme bg-white p-(--article-padding) shadow;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@
"category": "theme",
"description": "Een banner met een afbeelding, titel en tekst.",
"supports": {
"align": [ "full" ],
"html": false,
"multiple": false,
"reusable": false
},
"attributes": {
"align": {
"type": "string",
"default": "full"
},
"focalPoint": {
"type": "object",
"default": { "x": 0.5, "y": 0.5 }
Expand Down
74 changes: 47 additions & 27 deletions web/app/themes/sage/resources/scripts/blocks/banner/edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import { __ } from '@wordpress/i18n';
import {
BlockControls,
InspectorControls,
MediaUpload,
MediaUploadCheck,
useBlockProps,
useInnerBlocksProps,
} from '@wordpress/block-editor';
import { getBlockDefaultClassName } from '@wordpress/blocks';
import { PanelBody, PanelRow } from '@wordpress/components';
import { Button, PanelBody } from '@wordpress/components';
import { dispatch } from '@wordpress/data';
import { store as editorStore } from '@wordpress/editor';
import { Image, MediaToolbar } from '@yardinternet/gutenberg-components';

/**
Expand All @@ -32,7 +36,7 @@ const TEMPLATE = [
'core/paragraph',
{
content: __(
'Korte tekst van ongeveer 3 regels. Cupidatat amet nostrud non elit amet cupidatat elit sit proident anim duis.',
'Korte tekst van maximaal 7 regels. Lorem ipsum cupidatat amet nostrud non elit amet cupidatat elit sit proident anim duis.',
'sage'
),
},
Expand All @@ -42,26 +46,30 @@ const TEMPLATE = [
const Edit = ( props ) => {
const { attributes, setAttributes } = props;
const { imageId, focalPoint } = attributes;
const blockProps = useBlockProps();
const blockDefaultClassName = getBlockDefaultClassName(
const blockProps = useBlockProps( {
className: 'alignfull',
} );
const blockClassName = getBlockDefaultClassName(
blockProps?.[ 'data-type' ] || ''
);

function handleImageSelect( image ) {
const handleImageSelect = ( image ) => {
setAttributes( { imageId: image.id } );
}
dispatch( editorStore ).editPost( { featured_media: image.id } );
};

function handleImageRemove() {
const handleImageRemove = () => {
setAttributes( { imageId: 0 } );
}
dispatch( editorStore ).editPost( { featured_media: 0 } );
};

function handleFocalPointChange( value ) {
const handleFocalPointChange = ( value ) => {
setAttributes( { focalPoint: value } );
}
};

const innerBlocksProps = useInnerBlocksProps(
{
className: `${ blockDefaultClassName }__content`,
className: `${ blockClassName }__content`,
},
{ template: TEMPLATE }
);
Expand All @@ -77,14 +85,17 @@ const Edit = ( props ) => {
/>
</BlockControls>
<div { ...blockProps }>
<div className={ `${ blockDefaultClassName }__inner` }>
<div className={ `${ blockClassName }__container` }>
<div { ...innerBlocksProps } />
{ !! imageId && (
<div className={ `${ blockDefaultClassName }__media` }>
<div
className={ `${ blockClassName }__image-container` }
>
<Image
className={ `${ blockDefaultClassName }__image` }
className={ `${ blockClassName }__image` }
id={ imageId }
focalPoint={ focalPoint }
onChangeFocalPoint={ handleFocalPointChange }
size="large"
canEditImage={ false }
/>
Expand All @@ -94,21 +105,30 @@ const Edit = ( props ) => {
</div>
<InspectorControls>
<PanelBody title={ __( 'Afbeelding', 'sage' ) }>
<PanelRow>
<Image
id={ imageId }
className="my-image"
size="full"
<MediaUploadCheck>
<MediaUpload
onSelect={ handleImageSelect }
focalPoint={ focalPoint }
onChangeFocalPoint={ handleFocalPointChange }
labels={ {
title: 'Selecteer je afbeelding',
instructions:
'Upload een afbeelding of kies er één uit de mediabibliotheek.',
} }
allowedTypes={ [ 'image' ] }
value={ imageId }
render={ ( { open } ) => (
<Button
onClick={ open }
variant={
imageId ? 'secondary' : 'primary'
}
>
{ imageId
? __( 'Media vervangen', 'sage' )
: __( 'Media toevoegen', 'sage' ) }
</Button>
) }
/>
</PanelRow>
</MediaUploadCheck>
{ !! imageId && (
<Button onClick={ handleImageRemove } isDestructive>
{ __( 'Verwijderen', 'sage' ) }
</Button>
) }
</PanelBody>
</InspectorControls>
</>
Expand Down
Loading