Skip to content

Conversation

@petergoes
Copy link
Contributor

@petergoes petergoes commented Apr 17, 2025

Add HeadingBlock

Closing #265

Renders H2-H6 elements

Features

  • level field for numbers between 2 and 6

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 17, 2025

Deploying head-start with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6f016ef
Status: ✅  Deploy successful!
Preview URL: https://4def7ebe.head-start.pages.dev
Branch Preview URL: https://feat--heading-block.head-start.pages.dev

View logs

@petergoes petergoes requested a review from jurgenbelien April 17, 2025 13:53
Copy link
Contributor

@jurgenbelien jurgenbelien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Great that you've included the tests and included in Home, Pages, PagePartials and TextBlocks. Could you also add it to the TextImageBlock Structured Text?

The individual comments are mostly regarding code style, to align it a little more with how other components and blocks are written.


const { block } = Astro.props;

const Element = `h${block.level || 2}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming this to Tag to align with the implementations in nodes/Heading.astro in TextBlock and StructuredText. It also differentiates more explicitly string-based html tags from dynamic Astro components.

@jbmoelker jbmoelker changed the title FEAT:-heading block feature: Heading Block Apr 22, 2025
@jurgenbelien jurgenbelien force-pushed the FEAT--heading-block branch from 231bd8d to 819db18 Compare June 25, 2025 08:27
Copy link
Member

@MarleenEliza MarleenEliza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still some references to subtitle, but other than that looks good! Similar to our implementation in Zzuper

@jurgenbelien jurgenbelien force-pushed the FEAT--heading-block branch from 819db18 to bae61e1 Compare June 26, 2025 08:46
@jurgenbelien jurgenbelien force-pushed the FEAT--heading-block branch from bae61e1 to 8f21000 Compare June 26, 2025 08:48
Copy link
Member

@MarleenEliza MarleenEliza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed it's working and code looks good!

Only last thing I noticed is that currently the custom text pluigin is not compatible witht he Heading Block. If this is by choice, I will approve the PR

@jurgenbelien jurgenbelien force-pushed the FEAT--heading-block branch from 123e534 to 4a45777 Compare June 27, 2025 07:18
@jurgenbelien jurgenbelien force-pushed the FEAT--heading-block branch from 4a45777 to 6a8c204 Compare June 27, 2025 07:24
console.log(
'Create Structured text field "Text" (`text`) in block model "#\uFE0F\u20E3 Heading Block" (`heading_block`)'
);
const headingBlockText = await client.fields.create(headingBlock.id, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a clear helper text here? It should be clear to the editor what this field is for and what the 'level' field does.

@jbmoelker
Copy link
Member

@petergoes @jurgenbelien @MarleenEliza @sjoerdbeentjes I'm late to the party 😊, so maybe this has been discussed by you already:

Since we('ll) now have a "custom text plugin" I was wondering if that plugin could take away the possible confusion of the h2-h6 selection in the Structured Text field. Then everything could be a paragraph and we add the custom text styles for the different appearances. And the level field is the only thing concerned with the level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants