mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
docs(component-api): required props are sorted first
This commit is contained in:
parent
186ea85cbc
commit
b33ff71582
1 changed files with 11 additions and 1 deletions
|
@ -61,7 +61,17 @@
|
||||||
</StructuredListHead>
|
</StructuredListHead>
|
||||||
<StructuredListBody>
|
<StructuredListBody>
|
||||||
{#each component.props.sort((a, b) => {
|
{#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)}
|
}) as prop (prop.name)}
|
||||||
<StructuredListRow>
|
<StructuredListRow>
|
||||||
<StructuredListCell noWrap>
|
<StructuredListCell noWrap>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue