Issue #3347672: Create new SDC component for Umami (card view mode)
Merge request reports
Activity
- Resolved by Mark Conroy
added 1 commit
- 3e0c363f - moves Drupal comments back to the node templates
added 231 commits
-
52486727...1996c9d4 - 230 commits from branch
project:10.1.x
- fbfd5358 - Merge branch '10.1.x' into 3347672-create-new-sdc
-
52486727...1996c9d4 - 230 commits from branch
added 1 commit
- 514a9db8 - updates component.yml files to work with Drupal core committed version of SDC
added 14 commits
-
514a9db8...79df2500 - 13 commits from branch
project:10.1.x
- 6178b451 - Merge branch '10.1.x' into 3347672-create-new-sdc
-
514a9db8...79df2500 - 13 commits from branch
added 1 commit
- de19c233 - moves all card components to a 'card' directory
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', { changed this line in version 17 of the diff
1 {% changed this line in version 10 of the diff
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 changed this line in version 20 of the diff
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:
- We declare a bunch of props to collect all the input:
title_prefix
,label
,title_attributes
,page
,title_suffix
. - 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'sblock
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 anreadMore
prop (an object withurl
andtext
).- We declare a bunch of props to collect all the input:
changed this line in version 10 of the diff