Problem/Motivation

We should provide some generic components to help build, disadled by default:

Command icon 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

mogtofu33 created an issue. See original summary.

mogtofu33’s picture

Issue summary: View changes
pdureau’s picture

Status: Active » Reviewed & tested by the community

It was included in another (alpha3) issue MR, wasn't it?

mogtofu33’s picture

Status: Reviewed & tested by the community » Needs work

See the updated content of this issue, 2 of them were included in other mr.

pdureau’s picture

oh yes, the issue description was updated. My bad.

grimreaper’s picture

Hello,

I don't think it is up to the display builder tool to provide the components. The components will be provided by the design system used on a website.

Otherwise we will end up like with the 4 Core layouts (1, 2, 3, 4 columns) that we (I only?) use in BO dashboards and that we have to remove with stuff like Layout Builder Restrictions in front.

Special case for "HTML Element": I have something similar on projects, and having something like that would definitively become handy to not have to duplicate it on every projects. But let's put it in UI Patterns 2, why only reserved for Display Builder users?

grimreaper’s picture

Discussed with @mogtofu33 during weekly meeting.

HTML wrapper and HTML void element components to go into UIP2

Grid/Flex/Space, to precise, either:
- submodule labelled as demo (problem of Composer namespace)
- test module
- separated drupal.org project (but risk that other people propose their own stuff)
- document as best practice, like the grid_row component was identified as a best practice in its time.

pdureau’s picture

mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
pdureau’s picture

To avoid confusion with components provided by Design Sytems, maybe we can:

  • mark them as noUi to not show them in the ComponentLibrary
  • display them in the BlockLibrary under the "Element" group
mogtofu33’s picture

Mark them as noUi is planned when we are Drupal >11.3

Block? I don't think it's a good place, code of this island is already too complex.

We can add something to the label or have an other group than Layout.

pdureau’s picture

Those ones were already merged before beta1:

Name Definition Twig
spacer
props:
  type: object
  properties:
    size:
      type: string
      enum: [... some values in PX]
    direction:
      type: string
      enum: [...]
{% set attributes = attributes.addClass('db-generics').addClass('db-spacer').addClass('db-spacer-' ~ direction|default('vertical')) %}
<div{{ attributes }} style="--size: {{ size|default('16px') }}; position: relative;"></div>
html_wrapper
slots:
  content:
    title: Content
props:
  type: object
  properties:
    tag:
      title: Tag
      type: string
      pattern: '^[a-zA-Z0-9-]+$'
<{{ tag|default('div') }}{{ attributes }}>{{ content }}</{{ tag|default('div') }}>
html_tag
props:
  type: object
  properties:
    tag:
      type: string
      pattern: '^[a-zA-Z0-9-]+$'
{% if tag is defined %}
<{{ tag }}{{ attributes }}/>
{% endif %}

Let's discuss about them:

  • spacer: problematic because the enum values in pixels don't necessary fits with the design system currently used. It would be better to rely on Styles plugins in a more generic component. Also db-spacer-* is Display Builder specific markup which must be avoided.
  • html_wrapper: confusing naming it is a "normal" HTML element
  • html_tag: confusing naming because it is only for empty HTML elements

So, we will first #3556382: (Temporarily) Remove the generic components in beta1 and we will reintroduce them with this ticket, after beta1 and after a discussion.

Proposal 1: Components following technical constraints

We follow the constraints of HTML meaning and SDC definition/template structure:

  • A component for empty HTML elements, with an enum with br, hr...
  • A component for sectioning HTML elements, with a slot and an enum prop with article, aside, nav, section... it is useful to split them from other block elements if we create a "Layouts" library panel one day.
  • A component for other block HTML elements, with a slot and an enum prop with blockquote...
  • A component for phrasing HTML elements with a string prop and an enum with abbr, strong, em, q...

Proposal 2: Components following functional needs

What are they ? How the users (site builders, content editors..) understand the element building blocks of a display? Let's study what the pother display building tools are proposing

  • mogtofu33 committed 9385a5c4 on 1.0.x
    fix: #3538724 Experimental excluded from default profile
    
    By: mogtofu33
    
mogtofu33’s picture

Status: Needs work » Closed (won't fix)

As there is no consensus, will move it as a module.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

pdureau’s picture

Assigned: Unassigned » pdureau
Status: Closed (won't fix) » Needs work

Let's try something :)

pdureau’s picture

mogtofu33’s picture

Assigned: pdureau » mogtofu33
Status: Needs work » Needs review

mogtofu33 changed the visibility of the branch 3538724-provide-some-generic to hidden.

mogtofu33 changed the visibility of the branch 3538724-provide-some-generic to active.

mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Needs review » Needs work

Partial merge for beta1, need some work and discussion.

  • mogtofu33 committed 8751ca03 on 1.0.x
    chore: #3538724 Provide some generic components
    
    by: pdureau
    by:...
pdureau’s picture

mogtofu33’s picture

Status: Needs work » Postponed
Issue tags: -display_builder-1.0.0-beta4
mogtofu33’s picture

Status: Postponed » Fixed

In a scenario of recipe, easier to move to a module: https://www.drupal.org/project/generic_components
And I realized using Bootstrap that most of the time we do not need those generics.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.