Skip to content

Commit

Permalink
Use component name as prefix for nested component options
Browse files Browse the repository at this point in the history
Like we do for `summary.text` and `summary.html` manually, this change prefixes all nested component options with the name of their their component for clarity—automatically
  • Loading branch information
colinrotherham committed Jul 7, 2023
1 parent 16958cc commit ed9d090
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/get-macro-options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ function getMacroOptions (componentName) {
.map(addSlugs)
.map(renderNameWithBreaks)
.map(renderDescriptionsAsMarkdown)

// Use component name as prefix for nested component options
// For example, 'text' becomes 'label.text'
.map((param) => ({
...param,

// Nested object: Use `parent.child` syntax
name: `${option.name}.<wbr>${param.name}`
}))
}))
)

Expand Down

0 comments on commit ed9d090

Please sign in to comment.