amnestywebsite / humanity-theme

The Amnesty International WordPress Humanity Theme
https://wordpresstheme.amnesty.org/
Other
38 stars 10 forks source link

Migrate custom blocks to current best-practice format #442

Open jaymcp opened 1 month ago

jaymcp commented 1 month ago

Process

To begin with, we should simply move all of our existing block code into the new directory structure set up in https://github.com/amnestywebsite/humanity-theme/issues/441, using the naming convention defined in that ticket.

Once the code has been moved, we can then define each block's metadata in block.json files, and update the block registration (PHP and JS) to leverage those files.

We can then update the block code (display components and PHP renders) to the new API.

Blocks to migrate

Gentyspun commented 1 week ago

Update on progress so far:

Blocks to migrate

  • [x] Action Was working fully but now has some styling issues, and could do with wrapper attributes on render
  • [x] Background Media Should be fully working as expected
  • [ ] Banner (deprecated) Has not been started
  • [x] Blockquote Should work as expected, hidden from inserter as replaced with pattern, transform should still work as expected
  • [ ] Button (deprecated) Has not been started
  • [x] Call to Action (deprecated) Should work as expected, hidden from inserter as replaced with pattern, transform should still work as expected
  • [x] Collapsable (deprecated) Should work as expected, hidden from inserter as replaced with pattern, transform should still work as expected
  • [ ] Columns (deprecated) Has not been started
  • [x] Countdown Timer Works as expected, slightly wonky inspector controls http://bigbite.im/i/Og1c3u Also needs blockProps adding in the editor to make it selectable
  • [x] Custom Card (deprecated) Works as expected and hidden from editor, similar styling issues as action block
  • [x] Download Should work as expected, but needs branding plugin styles sorting
  • [x] Embed Flourish Should work as expected
  • [x] Embed Infogram Should work as expected
  • [x] Embed Sutori should work as expected
  • [x] Embed Tickcounter should work as expected
  • [ ] Fluid Iframe Has not been started
  • [ ] Header (deprecated) Has not been started
  • [x] Hero Should work as expected
  • [ ] Iframe Has not been started
  • [ ] Iframe Button Has not been started
  • [ ] Image (deprecated) Has not been started
  • [ ] Key Facts Has not been started
  • [x] Link Group Should work as expected
  • [ ] Links with Icons (deprecated) Has not been started
  • [ ] Menu Have enqueued the styles and added blockProps
  • [ ] Raw Code Has not been started
  • [ ] Regions Has not been started
  • [ ] Related Content Has not been started
  • [ ] Section Has not been started
  • [ ] Slider Has not been started
  • [x] Stat Counter Should work as expected
  • [ ] Term List apiFetch error breaking block in the editor http://bigbite.im/i/kL3Kf5
  • [x] Tweet Action Alternative and narrow styles does not apply in the editor
Gentyspun commented 1 week ago

Scripts-and-styles.php has new enqueues for registering all new block styles

jaymcp commented 4 days ago

have done some reorganisation (some blocks moved to deprecated directory); migrated our ssr blocks; deleted a bunch of now-unused code; created a new block (custom select) to be used in patterns, as we're getting console errors from the "unexpected content" in some patterns; am working on migrating the patterns to use that new block