Skip to content

add type attribute to rhelements #52

@mwcz

Description

@mwcz

When a rhelement is upgraded, it should add an attribute to itself signifying what type of component it is, for example:

  • container
  • content
  • combo

Also, add a question to the generator to pick the type.

@castastrophe @starryeyez024 @kylebuch8 could you all review that this all makes sense? I came in halfway into the discussion and could easily have missed some things.

Brainstorm impl:

rh-card.js

class RhCard extends Rhelement {
  get type() {
    return Rhelement.Types.Container;
  }
}

Rhelement base class adding the attribute:

rhelement.js

class Rhelement extends HTMLElement {
  static get Types() {
    return {
      Container: "container",
      Content: "content",
      Combo: "combo",
    };
  }
  connectedCallback() {
    this.setAttribute("type", this.type);
  }
}

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions