Skip to content

Commit

Permalink
Merge pull request #1487 from flanksource/1485-sort-canary-tabs-alpha…
Browse files Browse the repository at this point in the history
…betically

1485-sort-canary-tabs-alphabetically
  • Loading branch information
moshloop authored Nov 8, 2023
2 parents 9e81686 + 74e0499 commit 0ab5db7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/components/Canary/CanaryTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,15 @@ export function CanaryTabs({

return (
<Tabs activeTab={selectedTab} onSelectTab={(tab) => setSelectedTab(tab)}>
{Object.values(tabs).map((item) => {
return (
<Tab key={item.label} label={item.label} value={item.value}>
{children}
</Tab>
);
})}
{Object.values(tabs)
.sort((v1, v2) => v1.label.localeCompare(v2.label))
.map((item) => {
return (
<Tab key={item.label} label={item.label} value={item.value}>
{children}
</Tab>
);
})}
</Tabs>
);
}
2 changes: 2 additions & 0 deletions src/components/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ export function Tabs({
onClick={tab.props?.onClick!}
/>
))}
{/* Add a phantom div to fill border */}
<div className="flex-1 border-b border-gray-300" />
</div>
<div className={contentClassName}>{content}</div>
</>
Expand Down

0 comments on commit 0ab5db7

Please sign in to comment.