mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
docs(component-api): required props are sorted first
This commit is contained in:
parent
dee74d3470
commit
c4b09101e6
1 changed files with 11 additions and 1 deletions
|
@ -66,7 +66,17 @@
|
|||
</StructuredListHead>
|
||||
<StructuredListBody>
|
||||
{#each component.props.sort((a, b) => {
|
||||
if (a.reactive > b.reactive) return -1;
|
||||
// Sort props so required props are listed first, then reactive props.
|
||||
|
||||
if (a.isRequired !== b.isRequired) {
|
||||
return b.isRequired ? 1 : -1;
|
||||
}
|
||||
|
||||
if (a.reactive !== b.reactive) {
|
||||
return b.reactive ? 1 : -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}) as prop (prop.name)}
|
||||
<StructuredListRow>
|
||||
<StructuredListCell noWrap>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue