Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern Explorer Modal: Select the first category as the initial category #47661

Merged
merged 4 commits into from
Feb 2, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ function BlockPatternsTabs( {
} ) {
const [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false );
const categories = usePatternsCategories( rootClientId );
const initialCategory =
selectedCategory || ( categories.length && categories[ 0 ] );
apeatling marked this conversation as resolved.
Show resolved Hide resolved
const isMobile = useViewportMatch( 'medium', '<' );
return (
<>
Expand Down Expand Up @@ -261,7 +263,7 @@ function BlockPatternsTabs( {
) }
{ showPatternsExplorer && (
<PatternsExplorerModal
initialCategory={ selectedCategory }
initialCategory={ initialCategory }
patternCategories={ categories }
onModalClose={ () => setShowPatternsExplorer( false ) }
/>
Expand Down