-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Patterns] Separate sync status into a filter control #52303
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
57666b7
Try to add pagination to the patterns screen
kevin940726 88b88ab
grid for patterns
SaxonF b7d8889
Use in-memory filter
kevin940726 dbe0487
Remove rest api patch
kevin940726 73afc1c
Add header
kevin940726 71dd486
Fix some a11y issues
kevin940726 e410893
style changes patterns grid
SaxonF 6028d7a
responsive toggle patterns
SaxonF ce8a398
Cleanup
kevin940726 b6c484e
Improve performance
kevin940726 10d7bdb
Refactor and remove the load more button
kevin940726 07c92f6
Fix lint error
kevin940726 a5a9ae7
Add comment
kevin940726 e6068c1
Reset states
kevin940726 ffde59f
Add text to prompt to use search
glendaviesnz 2ec62ae
Fix descriptions
glendaviesnz ef2eaab
Change heading level
glendaviesnz 5333a17
Switch to using Async list and remove all heading
glendaviesnz f687d3c
pattern more copy
SaxonF File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { | ||
__experimentalVStack as VStack, | ||
__experimentalHeading as Heading, | ||
__experimentalText as Text, | ||
} from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { store as editorStore } from '@wordpress/editor'; | ||
import { useSelect } from '@wordpress/data'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories'; | ||
import { | ||
USER_PATTERN_CATEGORY, | ||
USER_PATTERNS, | ||
TEMPLATE_PARTS, | ||
PATTERNS, | ||
} from './utils'; | ||
|
||
export default function PatternsHeader( { | ||
categoryId, | ||
type, | ||
titleId, | ||
descriptionId, | ||
} ) { | ||
const { patternCategories } = usePatternCategories(); | ||
const templatePartAreas = useSelect( | ||
( select ) => | ||
select( editorStore ).__experimentalGetDefaultTemplatePartAreas(), | ||
[] | ||
); | ||
|
||
let title, description; | ||
if ( categoryId === USER_PATTERN_CATEGORY && type === USER_PATTERNS ) { | ||
title = __( 'My Patterns' ); | ||
description = ''; | ||
} else if ( type === TEMPLATE_PARTS ) { | ||
const templatePartArea = templatePartAreas.find( | ||
( area ) => area.area === categoryId | ||
); | ||
title = templatePartArea?.label; | ||
description = templatePartArea?.description; | ||
} else if ( type === PATTERNS ) { | ||
const patternCategory = patternCategories.find( | ||
( category ) => category.name === categoryId | ||
); | ||
title = patternCategory?.label; | ||
description = patternCategory?.description; | ||
} | ||
|
||
if ( ! title ) return null; | ||
|
||
return ( | ||
<VStack className="edit-site-patterns__section-header"> | ||
<Heading as="h2" level={ 4 } id={ titleId }> | ||
{ title } | ||
</Heading> | ||
{ description ? ( | ||
<Text variant="muted" as="p" id={ descriptionId }> | ||
{ description } | ||
</Text> | ||
) : null } | ||
</VStack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing infinite scrolling or a load more button, we decided to just show this text for now and suggest the users search for older patterns. This might get changed if we decide to change to server-side filtering in the future though.