Skip to content
Snippets Groups Projects

#3506881: Code component preview renders slots inside a tag

Merged #3506881: Code component preview renders slots inside a tag
1 unresolved thread
1 unresolved thread

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
85 .filter((slot) => slot.name) // Filter out slots with no name.
86 .map(
87 (slot) => `${camelCase(slot.name)}: h('Fragment', {
88 dangerouslySetInnerHTML: {
89 __html: '${slot?.example?.replace(/[\r\n]+/g, '')}'
90 }
91 })`,
92 );
85 .filter((slot) => slot.name && slot.example)
86 .map((slot) => {
87 const slotName = camelCase(slot.name);
88 // Each slot example value is turned into a Preact component. The h()
89 // function is Preact's version of React's createElement() function, which
90 // will render the slot's example value.
91 // @see compile()
92 return `${slotName}: h(${slotName} || null)`;
  • Harumi Jang added 3 commits

    added 3 commits

    • 57adcaef...cf1a9362 - 2 commits from branch project:0.x
    • 34ee8b6a - Merge branch '0.x' into 3506881-code-component-preview-slots-rendering

    Compare with previous version

  • Harumi Jang approved this merge request

    approved this merge request

  • merged

  • Please register or sign in to reply
    Loading