Problem/Motivation
We have both https://git.drupalcode.org/project/ui_suite_bootstrap/-/tree/5.0.x/templ... and https://git.drupalcode.org/project/ui_suite_bootstrap/-/tree/5.0.x/templ...
The split was done very early in the 5.0.x branch
It is not the only component from upstream we have split like that, but the other ones are related to the need of stacking multiple "sub" components into a container (accordion_item, list_group_item, carousel_item, toast_container....).
It is not the case here. So, do we keep such a component which seems to be useless and is asking the site builders to do extra work to build 2 different dispalys and nest them?
Proposed resolution
Move card_body slots & props to card definition and templates, and display the card-body wrapper only if one of title, subtitle, text, content (to be renamed to not mess with the current content slot) or link slot is filled.
API changes
Breaking by nature, but we can avoid it by keep card's content slot and card_body component and marking them as deprecated. We can remove them in 5.1.x branch for example.
Issue fork ui_suite_bootstrap-3427151
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
grimreaperHi,
I remember why it has been splitted.
In a card you can place stuff not in card-body div:
- https://getbootstrap.com/docs/5.3/components/card/#list-groups
- https://getbootstrap.com/docs/5.3/components/card/#kitchen-sink
Also it seems that card has some new features since, not implemented: https://getbootstrap.com/docs/5.3/components/card/#image-overlays
Comment #3
pdureau commentedProposals, in order to be able to handle non-body and additional stuff.
Proposal 1
Split
contentslot betweencontent_beforeandcontent_afterMove card_body slots & props to card component.
In Card template, replace
{{ content }}by:This change will be breaking.
Proposal 2
In order to avoid moving data currently mapped to card
contentslot inside card-body markup.Split
contentslot betweencontentandcontent_afterMove card_body slots & props to card component, while renaming
contentslot tobody.In Card template, replace
{{ content }}by:Comment #4
grimreaperGo for proposal 2
Comment #5
grimreaperSorry to go back on our discussion.
But in https://getbootstrap.com/docs/5.3/components/card/#kitchen-sink, we can see that a card can have multiple card-body. I think that's why the "content before"/"content after" had not been chosen previously.
Comment #6
grimreaperAs discussed. Let's keep card body as it is and document in the description why it exists.
Also implement missing features.
Comment #8
grimreaperComment #9
pdureau commented1. Create an other issue about card overlay.
2. Proposal for description:
description: "Internal: to be used in the 'Card' component, because a card can have multiple 'Card body' components."Comment #10
grimreaperComment #11
grimreaper