Skip to content
Snippets Groups Projects

Issue #3347672: Create new SDC component for Umami (card view mode)

Open Mark Conroy requested to merge issue/drupal-3347672:3347672-create-new-sdc into 10.1.x

Merge request reports

Members who can merge are allowed to add commits.
Approval is optional
Ready to merge by members who can write to the target branch.
  • The source branch is 292 commits behind the target branch.
  • 1 commit will be added to 10.1.x.
  • Source branch will not be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Mark Conroy added 1 commit

    added 1 commit

    Compare with previous version

  • Mark Conroy resolved all threads

    resolved all threads

  • Mark Conroy added 1 commit

    added 1 commit

    • 3e0c363f - moves Drupal comments back to the node templates

    Compare with previous version

  • Mark Conroy added 1 commit

    added 1 commit

    Compare with previous version

  • Mark Conroy added 231 commits

    added 231 commits

    Compare with previous version

  • Mark Conroy added 1 commit

    added 1 commit

    • 514a9db8 - updates component.yml files to work with Drupal core committed version of SDC

    Compare with previous version

  • Mark Conroy added 14 commits

    added 14 commits

    Compare with previous version

  • Mark Conroy added 1 commit

    added 1 commit

    • de19c233 - moves all card components to a 'card' directory

    Compare with previous version

  • 92 </h2>
    93 {% endif %}
    94 {{ title_suffix }}
    95
    96 <div class="read-more">
    97 <a class="read-more__link" href="{{ url }}">
    98 {% trans %}View {{ node.type.entity.label() }}{% endtrans %} <span class="visually-hidden"> - {{ label }}</span>
    99 </a>
    100 </div>
    101
    102 <div{{ content_attributes.addClass('node__content') }}>
    103 {{ content }}
    104 </div>
    105
    106 </article>
    69 {{ include('umami:card-common', {
  • 1 {%
  • 1 $schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json
    2 name: Card Common Alt
  • 1 $schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json
  • 1 $schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json
    2 name: Card
    3 description: A card with an image, title, and a link.
    4 props:
    5 type: object
    6 properties:
    7 label:
    8 type: string
    9 title: Title
    10 description: The title of the node
    11 examples:
    12 - A recipe for success!
    13 libraryDependencies:
    14 - umami/more-link
  • 1 {%
    • I would think that everything here are props and slots under cover.

      1. classes

      I think we should pass attributes from the Drupal template with the appropriate classes. This way we can skip setting all the classes here. Failing to do this will result in coupling the UI component to the content model, which we should avoid.

      2. Context leaks

      There are several undercover props here. The best way to detect them is by following Lauri's suggestion and using the only keyword when embedding/including the component.

      2.1 The title

      I see two valid options here:

      1. We declare a bunch of props to collect all the input: title_prefix, label, title_attributes, page, title_suffix.
      2. We use a slot for the whole title markup.

      Option 1 will ensure that the <h2> is used to print the label. It will give us more structure. Option 2 will give us more flexibility, but will allow any arbitrary HTML markup.

      2.2 The content

      This should be a slot. Please consider the possibility that {{ content }} is empty. Should the wrapping markup be there? Twig's block function can be helpful here.

        {% if block('content') %}
        <div{{ content_attributes.addClass('node__content') }}>
          {{ block('content') }}
        </div>
        {% endif %}

      2.3 The links section

      We need to get rid of node somehow. Again, we should not couple our content model with the UI component. It may be necessary to introduce an readMore prop (an object with url and text).

    • mortona2k changed this line in version 10 of the diff

      changed this line in version 10 of the diff

    • Please register or sign in to reply
  • mortona2k added 1 commit

    added 1 commit

    Compare with previous version

  • mortona2k added 1 commit

    added 1 commit

    Compare with previous version

  • mortona2k added 1 commit

    added 1 commit

    Compare with previous version

  • mortona2k added 1 commit

    added 1 commit

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading