Convert Olivero's teaser into a single directory component

Created on 7 June 2023, over 1 year ago
Updated 18 July 2024, 5 months ago

Let's convert Olivero's teaser component to use single directory components. This currently lives in node--teaser.html.twig, and has an associated library.

πŸ› Bug report
Status

Postponed

Version

11.0 πŸ”₯

Component
OliveroΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mherchel
  • Open on Drupal.org β†’
    Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    Not currently mergeable.
  • @bernardm28 opened merge request.
  • First commit to issue fork.
  • last update over 1 year ago
    Custom Commands Failed
  • πŸ‡ΊπŸ‡ΈUnited States bernardm28 Tennessee

    After a few glitches, it's 99% ready. I will work on the cleanup on a follow-up commit.

  • πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US

    Just left some comments in the MR. Looking good. Thanks!

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US
  • last update over 1 year ago
    Build Successful
  • last update over 1 year ago
    Build Successful
  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States bernardm28 Tennessee

    I added the requested changes.

  • Status changed to Postponed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Threads look to be resolved but postponed until SDC is marked stable,

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • First commit to issue fork.
  • Merge request !7250Olivero SDC component - #3365367 β†’ (Closed) created by finnsky
  • Pipeline finished with Success
    9 months ago
    Total: 563s
    #133147
  • Status changed to Needs review 9 months ago
  • πŸ‡·πŸ‡ΈSerbia finnsky

    Hi all!

    I think it's time to continue working here!

    I believe that SDC first of all gives us the opportunity to clean up the cascades and make everything more stable. Therefore, in this MR, in addition to the immediate changes in the teaser, I added a few more changes.

    - Removed styles from the field styles file

    - Rewrote the view style to use the grid. This is much better than constantly adjusting margins and much more correct from a BEM point of view. A small regression of a few pixels on mobile devices, but the code has become much more predictable.

    https://en.bem.info/methodology/quick-start/#block

    The block shouldn't influence its environment, meaning you shouldn't set the external geometry (margin) or positioning for the block.

    - Removed the picture template. It only existed to add one class

    - core/themes/olivero/css/components/node-teaser.pcss.css still contains styles, but we will remove them in future componentization work.

    Please review!

  • Status changed to RTBC 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Before

    After

    Took a screenshot with the MR not applied yet
    Applied the MR
    Took another screenshot and can see nothing has changed

    Know it's not the same but recently got into ui_patterns so able to review that and the slot options do make sense.

  • Status changed to Needs work 8 months ago
  • πŸ‡«πŸ‡·France nod_ Lille

    why the empty js file ?

    from what I understood if you want to have a render array it should be in a slot, not a prop so content should be a slot no?

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    smustgrave β†’ changed the visibility of the branch 3365367-convert-oliveros-teaser to hidden.

  • Status changed to RTBC 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Ah now I see what you meant, wrong MR. I should of hidden that one.

    • nod_ β†’ committed abf79d71 on 11.x
      Issue #3365367 by bernardm28, finnsky, smustgrave, mherchel: Convert...
    • nod_ β†’ committed 929d4b61 on 10.3.x
      Issue #3365367 by bernardm28, finnsky, smustgrave, mherchel: Convert...
  • Status changed to Fixed 8 months ago
  • πŸ‡«πŸ‡·France nod_ Lille

    Committed abf79d7 and pushed to 11.x. Thanks!

  • πŸ‡«πŸ‡·France pdureau Paris

    I am late to the subject because the change has been merged today, but I am not comfortable with this task.

    We have 2 kind of templates to consider for conversion to SDC:

    • status-messages.html.twig, breadcrumb.html.twig, table.html.twig, image.html.twig, username.html.twig, pager.html.twig, menu.html.twig... which are UI components and will shine as SDC componenst
    • node.html.twig, user.html.twig, field.html.twig, block.html.twig, views.html.twig... which are directly related to Drupal data structure and acts as wrappers or proxy layers

    Do we really want to convert to SDC the second kind?

    Looking at this MR, it seems we rather not:

    • The template has parts unexpected in a component template : related to context ({% if label and not page %}) and data structure (content|without('field_image', 'links'))
    • This component doesn't bring anything valuable in an UI point of view, and is hardly reusable outside of a node teaser context
    • The template use BEM notation but the teaser block class is missing.

    I would advice to revert this change.

    Maybe the future of node.html.twig, user.html.twig, field.html.twig, block.html.twig, views.html.twig... is to be ignored first, and to be removed once SDC will be the main API to build template-based renderables.

  • πŸ‡·πŸ‡ΈSerbia finnsky

    Thank you for review.

    We can update it with slots. And put node teaser logic to its own template.

    I see that this component can be also used in comments. They have mostly same look.

    Could you please create same follow up ticket a you did for umami? We arr still researching how to use SDC correct

  • πŸ‡«πŸ‡·France pdureau Paris

    Hi Ivan,

    I will create the follow up ticket about the little fixes i am proposing.

    But the main position of my review is: Do we really want this component? And this kind of components in general?

  • πŸ‡·πŸ‡ΈSerbia finnsky

    Do we really want this component? And this kind of components in general?

    I believe that this type of component, just like the umami card, is the fundamental building block for any website.

    Yes, in Olivero it is used once (for now I hope). But developers should see a good example of a good component in Drupal code

    Do we really want to convert to SDC the second kind? (related to Drupal data structure and acts as wrappers or proxy layers)

    Evil designers often draw components instead of drawing the Drupal structure (joke)

    I believe that components should not be associated with the Drupal structure. So from my point of view Yes. We need such components. Even if we don't have good way to implement them except twig (for now I hope)

  • Status changed to Active 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States agentrickard Georgia (US)

    Comment 20 -- https://www.drupal.org/project/drupal/issues/3365367#comment-15557100 πŸ“Œ Convert Olivero's teaser into a single directory component Postponed says that this was merged to 11.x but the issue is now assigned to 10.3.

    Is the intent to cherry-pick that commit to 10.3, or is the change accidental?

  • Status changed to Fixed 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    See #18

  • πŸ‡«πŸ‡·France pdureau Paris

    I moved my concern to a dedicated issue: 🌱 Compatibility of SDC use with display/experience builders Active

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Active 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom catch

    Sorry very late here but I think we should consider reverting this.

    After this change I do not understand what's going on in core/themes/olivero/templates/content/node--teaser.html.twig.

    {% embed "olivero:teaser" with {
      attributes: attributes.addClass(classes),
      author_attributes,
      author_name,
      content,
      date,
      display_submitted,
      label,
      metadata,
      title_attributes,
      title_prefix,
      title_suffix,
      read_more,
      url,
      } only %}
      {% block prefix %}
        {{ title_prefix }}
        {{ title_suffix }}
      {% endblock %}
      {% block meta %}
        {% if display_submitted %}
          <div class="node__meta">
            <span{{ author_attributes }}>
              {{ 'By'|t }} {% apply spaceless %}<span class="node__author">{{ author_name }}</span>{% endapply %}, {{ date }}
            </span>
            {{ metadata }}
          </div>
        {% endif %}
      {% endblock %}
      {% block image %}{{~ content.field_image ~}}{% endblock %}
      {% block title %}
        {% if label and not page %}
          <h2{{ title_attributes.addClass('node__title', 'teaser__title') }}>
            <a href="{{ url }}" rel="bookmark">{{ label }}</a>
          </h2>
        {% endif %}
      {% endblock %}
      {% block content %}
        {{ content|without('field_image', 'links') }}
      {% endblock %}
    {% endembed %}
    

    vs. the component itself:

    <article{{ attributes.addClass('teaser') }}>
      <header>
        {% block prefix %}{% endblock %}
        <div class="teaser__meta">
          {% block meta %}{% endblock %}
        </div>
        <div class="teaser__top">
          <div class="teaser__image">{% block image %}{% endblock %}</div>
          {% block title %}{% endblock %}
        </div>
      </header>
      <div class="teaser__content">
        {% block content %}{% endblock %}
      </div>
    </article>
    
    

    Why do we have markup for the image in the sdc template, then pull that back out into the node template?

    The Olivero template already breaks some capabilities of manage display, and this just looks like it's getting even further away from that.

    There are plenty of templates in core which don't have this problem (I arrived here looking for an example to review πŸ“Œ Convert Olivero's pager to use single directory components Needs work against), so why not do those first per #21?

  • πŸ‡·πŸ‡ΈSerbia finnsky

    Why do we have markup for the image in the sdc template, then pull that back out into the node template?

    it is optional slot. it can be presented or not.

  • Status changed to Postponed 5 months ago
  • πŸ‡·πŸ‡ΈSerbia finnsky

    @catch please take a look at #15 #16

    https://www.drupal.org/project/drupal/issues/3444525#comment-15689724 🌱 Compatibility of SDC use with display/experience builders Active

    Let's discuss first at least.

Production build 0.71.5 2024