-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Latest Posts: add grid option and improve front-end rendering (#1992)
* LatestPosts: add toolbar options for grid and list layouts. * Apply grid styles and move date to block scss. * Render the date (if present) and grid class on the front-end. * Use smaller font on the front-end as well. * Escape output, use time element, use yoda condition * Fix handling of postsToShow in frontend rendering since JSON block attrs added camelCasing * Fix latest-posts block tests by updating fixtures with layout prop * Use untitled as fallback title when missing in listing latest-posts Fixes #1990 * Removing posts to display should be instant. * Use F j, Y date format. It would be good to use _wpDateSettings.formats.date at some point.
- Loading branch information
Showing
6 changed files
with
97 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,26 @@ | ||
.wp-block-latest-posts.alignright { | ||
margin-left: 2em; | ||
.wp-block-latest-posts { | ||
&.alignleft { | ||
margin-right: 2em; | ||
} | ||
&.alignright { | ||
margin-left: 2em; | ||
} | ||
&.is-grid { | ||
display: flex; | ||
flex-wrap: wrap; | ||
padding: 0; | ||
list-style: none; | ||
|
||
li { | ||
flex-grow: 1; | ||
margin: 0 16px 16px 0; | ||
} | ||
} | ||
} | ||
.wp-block-latest-posts.alignleft { | ||
margin-right: 2em; | ||
|
||
.wp-block-latest-posts__post-date { | ||
display: block; | ||
color: $dark-gray-100; | ||
font-size: $default-font-size; | ||
} | ||
|
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
<!-- wp:core/latest-posts {"postsToShow":5,"displayPostDate":false} /--> | ||
<!-- wp:core/latest-posts {"postsToShow":5,"displayPostDate":false,"layout":"list"} /--> |
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