Problem/Motivation

SDC is no longer a module and is now in core, so the module.info.yml file needs to be updated.

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:

    1 hidden branch
  • 3448760 Comparechanges, plain diff MR !2

Comments

agentrickard created an issue. See original summary.

agentrickard’s picture

TypeError: Drupal\sdc_styleguide\Form\SDCExplorerForm::__construct(): Argument #1 ($componentPluginManager) must be of type Drupal\sdc\ComponentPluginManager, Drupal\Core\Theme\ComponentPluginManager

agentrickard’s picture

Status: Active » Needs review
StatusFileSize
new48.82 KB

I think I get what this is trying to do.

It wants a `my_component.demo.NAME.yml` file for each item to display in the Styleguide.

A render test of an SDC

Two immediate questions:

  1. How does it deal with "slots"?
  2. How does it deal with objects or complex arrays?

Consider the following component:

name: USWDS Accordion
status: experimental
group: USWDS
props:
  type: object
  properties:
    attributes:
      type: Drupal\Core\Template\Attribute
    title_suffix:
      type: array
      description: title_suffix is necessary if contextual links are included.
    modifier:
      title: Extra CSS classes
      type: string
      description: Extra CSS classes that get added to wrapper element.
    multiselect:
      title: Multiselect
      type: boolean
      description: Allows multiple accordion items to be open at the same time.
slots:
  accordion_items:
    title: Accordion Items

How do we represent that as a demo file?

alemadlei’s picture

Hello!

Question, what do you mean it is not compatible with Drupal 10.3 and higher?

Right now the code has an unstable Form that I'm deprecating in favor of the controller.

Regarding the slots, I need to push the code update that adds support for those. For the complex array, I'm guessing this is for the title_suffix or attributes.

Those items might be part of a larger discussion. Personally I'm of the opinion that having an SDC to know about Drupal classes is a no go. I'm more of the idea that a component should be pure and ideally be something that you can use in other technologies. Any Drupalism should be part of a slot and the component itself should never use them explicitly. That is, using |t or other specific Drupal filters I consider should be discouraged. If you really need them, then I guess they can be a slot as well. I'm open to discussing this though.

alemadlei’s picture

Assigned: Unassigned » alemadlei

I have released 1.0.0-beta2 which now includes an explorer at `/styleguide/explorer`.

There's a submodule that provides a demo component with 2 demos. If you enable this submodule, you should see the demos in the explorer.

The explorer has a resize featuer and that way you can test your component responsiveness.

agentrickard’s picture

Not compatible:

1) SDC module is deprecated and should not be a dependency in the info file
2) The "'plugin.manager.sdc'" service has moved to a new class.

TypeError: Drupal\sdc_styleguide\Form\SDCExplorerForm::__construct(): Argument #1 ($componentPluginManager) must be of type Drupal\sdc\ComponentPluginManager, Drupal\Core\Theme\ComponentPluginManager

These are both fixed in the MR.

alemadlei’s picture

Version: 1.0.0-beta1 » 1.1.0-beta1
Status: Needs review » Fixed

This has been corrected on release 1.1.0-beta1.

Thanks agentrickard!

alemadlei’s picture

Status: Fixed » Closed (fixed)