Skip to content

Conversation

tylersticka
Copy link
Member

Overview

My #1719 feature addition was buggy: The check for author.avatar.src only works in very specific situations. This removes that check to avoid regressions.

In its place, it adds support for template blocks to this. This allows the content of the avatars to be manipulated directly. For example:

{% embed '@cloudfour/components/author.twig' with { authors: authors, date: date } only %}
  {% block avatars %}
    {% for author in authors %}
      {% include '@cloudfour/components/avatar/avatar.twig' with {
        src: 'anything you want',
        srcset: 'you got it',
        sizes: 'anything you need',
        width: 'you got it'
      } only %}
    {% endfor %}
  {% endblock %}
{% endembed %}

Testing

Just to be safe, it's probably best that someone goes into our WordPress theme, pulls these changes into the node_modules locally, confirms there are no regressions, and tries using the block.

@changeset-bot
Copy link

changeset-bot bot commented Apr 8, 2022

🦋 Changeset detected

Latest commit: 722ae5a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudfour/patterns Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Apr 8, 2022

Deploy Preview for cloudfour-patterns ready!

Name Link
🔨 Latest commit 722ae5a
🔍 Latest deploy log https://app.netlify.com/sites/cloudfour-patterns/deploys/6250bc03697991000836fdf1
😎 Deploy Preview https://deploy-preview-1723--cloudfour-patterns.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@tylersticka tylersticka marked this pull request as ready for review April 8, 2022 22:54
@tylersticka tylersticka requested a review from a team April 8, 2022 22:55
@spaceninja
Copy link
Member

This change looks fine. I'll test it on Monday, and if it works in WP, I'll take care of bumping the pattern library and pulling this change into my PR on the WP side.

@spaceninja spaceninja self-assigned this Apr 8, 2022
@Paul-Hebert
Copy link
Contributor

Code and deploy preview look good. Testing in WP

Copy link
Contributor

@Paul-Hebert Paul-Hebert left a comment

Choose a reason for hiding this comment

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

Code looks good!

I tested:

  • This works in the pattern library
  • This fixes the bug in WP
  • This allows us to pass in custom avatar content in WP

@tylersticka tylersticka merged commit 547c9cf into v-next Apr 11, 2022
@tylersticka tylersticka deleted the feature/author-blocks branch April 11, 2022 16:59
@github-actions github-actions bot mentioned this pull request Apr 11, 2022
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.

3 participants