[2.0.0-beta2] Add component story template

Created on 18 July 2024, 5 months ago

Problem/Motivation

In UI Patterns 1.x it i possible to specify templates for previews (there is only one story by component in UI Patterns 1.x, and it is always called "preview")

Examples:

Sometimes, it is used to disabled the preview: https://git.drupalcode.org/project/ui_suite_uswds/-/blob/3.0.x/templates...

Proposed resolution

They don't belong to the components/{component_id} folder but anywhere in the templates/ folder. They are regular Drupal theme templates from hook_theme(): component-story--{component_id}.html.twig

Examples:

  • component-story--modal.html.twig
  • component-story--card-body.html.twig

By story: component-story--{component_id}--{story_id}.html.twig

Examples:

  • component-story--modal–preview.html.twig
  • component-story--card-body–long-text.html.twig

No templates suggestions per variant.

Alternative

Can we provide this feature without this hook_theme ?

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France pdureau Paris

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024