Skip to content

Commit

Permalink
dedupe examples for single page stylebook
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Nov 5, 2024
1 parent 373c6b2 commit a646582
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion packages/edit-site/src/components/style-book/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,22 @@ function StyleBook( {
[ examples ]
);

const examplesForSinglePageUse = [];
const landingCategoryExamples = getExamplesByCategory(
{ slug: 'landing' },
examples
);
examplesForSinglePageUse.push( ...landingCategoryExamples.examples );
const otherExamples = examples.filter( ( example ) => {
return (
example.category !== 'landing' &&
! landingCategoryExamples.examples.find(
( landingExample ) => landingExample.name === example.name
)
);
} );
examplesForSinglePageUse.push( ...otherExamples );

const { base: baseConfig } = useContext( GlobalStylesContext );
const goTo = getStyleBookNavigationFromPath( path );

Expand Down Expand Up @@ -286,7 +302,7 @@ function StyleBook( {
</Tabs>
) : (
<StyleBookBody
examples={ examples }
examples={ examplesForSinglePageUse }
isSelected={ isSelected }
onClick={ onClick }
onSelect={ onSelect }
Expand Down

0 comments on commit a646582

Please sign in to comment.