Skip to content

Commit

Permalink
Merge pull request #107 from bigbite/feat/96-reorder-block-list
Browse files Browse the repository at this point in the history
[BBT-96] Re-order block list
  • Loading branch information
g-elwell authored Oct 1, 2024
2 parents 36d3344 + 3e5cdd9 commit d8d7077
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/editor/components/NavBlockList.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ const NavBlockList = () => {
// get styles for all blocks
const themeBlockStyles = getThemeOption( `styles.blocks`, themeConfig );

// sort the blocks by title
const orderedSchema = schemaBlocks.sort( ( a, b ) =>
a.title.localeCompare( b.title )
);

return (
<section>
<ul className="themer-nav-list">
{ schemaBlocks.map( ( block ) => {
{ orderedSchema.map( ( block ) => {
// get all styles for this block
const blockStyles = themeBlockStyles[ block.name ] || {};

Expand Down
7 changes: 6 additions & 1 deletion src/editor/components/NavElementList.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,19 @@ const NavElementList = ( { selector, route } ) => {
// get all valid elements from the schema
const schemaElements = getElementsFromSchema( schema );

// sort the elements by name
const orderedSchema = schemaElements.sort( ( a, b ) =>
a.name.localeCompare( b.name )
);

// get styles for all elements at this selector
const themeElementStyles =
getThemeOption( `styles.${ selector }`, themeConfig ) || {};

return (
<section>
<ul className="themer-nav-list">
{ schemaElements.map( ( element ) => {
{ orderedSchema.map( ( element ) => {
// get all styles for this element
const elementStyles =
themeElementStyles[ element.name ] || {};
Expand Down

0 comments on commit d8d7077

Please sign in to comment.