Skip to content

Commit

Permalink
docs(component-api): required props are sorted first
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Nov 23, 2024
1 parent 186ea85 commit b33ff71
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/src/components/ComponentApi.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,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>
Expand Down

0 comments on commit b33ff71

Please sign in to comment.