-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patterns: Add categories to user patterns, and allow filtering by the…
…se in site and post editor (#53835) * Adds category selection option to the create pattern modal * Merges the user pattern categories with theme categories in the site and post editor * Merges the synced patterns tab into the theme/unsynced patterns tab in the post editor inserter Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Co-authored-by: James Koster <james@jameskoster.co.uk>
- Loading branch information
1 parent
72b0a82
commit 9fcfaac
Showing
52 changed files
with
1,263 additions
and
550 deletions.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
92 changes: 92 additions & 0 deletions
92
packages/block-editor/src/components/block-patterns-paging/index.js
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,92 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { | ||
__experimentalVStack as VStack, | ||
__experimentalHStack as HStack, | ||
__experimentalText as Text, | ||
Button, | ||
} from '@wordpress/components'; | ||
import { __, _x, _n, sprintf } from '@wordpress/i18n'; | ||
|
||
export default function Pagination( { | ||
currentPage, | ||
numPages, | ||
changePage, | ||
totalItems, | ||
} ) { | ||
return ( | ||
<VStack> | ||
<Text variant="muted"> | ||
{ | ||
// translators: %s: Total number of patterns. | ||
sprintf( | ||
// translators: %s: Total number of patterns. | ||
_n( '%s item', '%s items', totalItems ), | ||
totalItems | ||
) | ||
} | ||
</Text> | ||
<HStack | ||
expanded={ false } | ||
spacing={ 3 } | ||
justify="flex-start" | ||
className="block-editor-patterns__grid-pagination" | ||
> | ||
<HStack | ||
expanded={ false } | ||
spacing={ 1 } | ||
className="block-editor-patterns__grid-pagination-previous" | ||
> | ||
<Button | ||
variant="tertiary" | ||
onClick={ () => changePage( 1 ) } | ||
disabled={ currentPage === 1 } | ||
aria-label={ __( 'First page' ) } | ||
> | ||
<span>«</span> | ||
</Button> | ||
<Button | ||
variant="tertiary" | ||
onClick={ () => changePage( currentPage - 1 ) } | ||
disabled={ currentPage === 1 } | ||
aria-label={ __( 'Previous page' ) } | ||
> | ||
<span>‹</span> | ||
</Button> | ||
</HStack> | ||
<Text variant="muted"> | ||
{ sprintf( | ||
// translators: %1$s: Current page number, %2$s: Total number of pages. | ||
_x( '%1$s of %2$s', 'paging' ), | ||
currentPage, | ||
numPages | ||
) } | ||
</Text> | ||
<HStack | ||
expanded={ false } | ||
spacing={ 1 } | ||
className="block-editor-patterns__grid-pagination-next" | ||
> | ||
<Button | ||
variant="tertiary" | ||
onClick={ () => changePage( currentPage + 1 ) } | ||
disabled={ currentPage === numPages } | ||
aria-label={ __( 'Next page' ) } | ||
> | ||
<span>›</span> | ||
</Button> | ||
<Button | ||
variant="tertiary" | ||
onClick={ () => changePage( numPages ) } | ||
disabled={ currentPage === numPages } | ||
aria-label={ __( 'Last page' ) } | ||
size="default" | ||
> | ||
<span>»</span> | ||
</Button> | ||
</HStack> | ||
</HStack> | ||
</VStack> | ||
); | ||
} |
42 changes: 42 additions & 0 deletions
42
packages/block-editor/src/components/block-patterns-paging/style.scss
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,42 @@ | ||
.block-editor-patterns__grid-pagination { | ||
border-top: 1px solid $gray-800; | ||
padding: $grid-unit-05; | ||
|
||
.components-button.is-tertiary { | ||
width: auto; | ||
height: $button-size-compact; | ||
justify-content: center; | ||
|
||
&:disabled { | ||
color: $gray-600; | ||
background: none; | ||
} | ||
|
||
&:hover:not(:disabled) { | ||
color: $white; | ||
background-color: $gray-700; | ||
} | ||
} | ||
} | ||
|
||
.show-icon-labels { | ||
.block-editor-patterns__grid-pagination { | ||
flex-direction: column; | ||
.block-editor-patterns__grid-pagination-previous, | ||
.block-editor-patterns__grid-pagination-next { | ||
flex-direction: column; | ||
} | ||
.components-button { | ||
width: auto; | ||
// Hide the button icons when labels are set to display... | ||
span { | ||
display: none; | ||
} | ||
// ... and display labels. | ||
// Uses ::before as ::after is already used for active tab styling. | ||
&::before { | ||
content: attr(aria-label); | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.