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 Aug 7, 2023
1 parent 9203a1e commit 244244d
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 @@ -217,6 +217,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 244244d

Please sign in to comment.