Skip to content

Commit

Permalink
fix: Sort font library modal tabs alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
dhananjaykuber committed Jan 8, 2025
1 parent ad4da87 commit 58409e8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ function FontLibraryModal( {
tabs.push( ...tabsFromCollections( collections || [] ) );
}

const sortedTabs = [ ...tabs ].sort( ( a, b ) =>
a.title.localeCompare( b.title )
);

return (
<Modal
title={ __( 'Fonts' ) }
Expand All @@ -69,14 +73,14 @@ function FontLibraryModal( {
<Tabs defaultTabId={ defaultTabId }>
<div className="font-library-modal__tablist-container">
<Tabs.TabList>
{ tabs.map( ( { id, title } ) => (
{ sortedTabs.map( ( { id, title } ) => (
<Tabs.Tab key={ id } tabId={ id }>
{ title }
</Tabs.Tab>
) ) }
</Tabs.TabList>
</div>
{ tabs.map( ( { id } ) => {
{ sortedTabs.map( ( { id } ) => {
let contents;
switch ( id ) {
case 'upload-fonts':
Expand Down

0 comments on commit 58409e8

Please sign in to comment.