From 5f52207441c61f0c2227fd163d8292476239585a Mon Sep 17 00:00:00 2001 From: Corey McKrill <916023+coreymckrill@users.noreply.github.com> Date: Tue, 28 Sep 2021 16:59:47 -0700 Subject: [PATCH] All Posts template (#31) Adds the index.html template, along with accompanying template parts and styles. This gets close to matching the All Posts mockup page in the design, but a few things have been omitted: * The "brush stroke" edge at the bottom of the "All Posts" header. This will be added in when #32 is addressed. * The "Load More Posts" link has been replaced with query pagination. * The "Subscribe to WordPress News" box has been left out of the footer, because block templates do not support rendering shortcodes, which is currently the only way to render Jetpack's subscription form. * Some of the podcast player icons in the WP Briefing footer box are generic links because the Social Icons block does not currently support all the necessary brands/services. Fixes #22 --- composer.lock | 75 +++--- .../svg/brush-stroke-short-2-blue-4.svg | 48 ++++ .../assets/svg/brush-stroke-short-blue-4.svg | 221 ++++++++++++++++++ .../block-template-parts/content-archive.html | 18 ++ .../block-template-parts/footer-archive.html | 75 ++++++ .../query-navigation.html | 7 + .../block-templates/index.html | 36 ++- .../block-templates/single.html | 4 +- .../sass/blocks/_post-excerpt.scss | 13 ++ .../sass/blocks/_post-title.scss | 9 +- .../sass/blocks/_query-pagination.scss | 52 +++-- .../sass/blocks/_social-links.scss | 11 + .../_post-content.scss => post/_content.scss} | 6 +- .../wporg-news-2021/sass/post/_footer.scss | 55 +++++ .../wporg-news-2021/sass/post/_header.scss | 47 +++- .../themes/wporg-news-2021/sass/style.scss | 8 +- 16 files changed, 591 insertions(+), 94 deletions(-) create mode 100644 source/wp-content/themes/wporg-news-2021/assets/svg/brush-stroke-short-2-blue-4.svg create mode 100644 source/wp-content/themes/wporg-news-2021/assets/svg/brush-stroke-short-blue-4.svg create mode 100644 source/wp-content/themes/wporg-news-2021/block-template-parts/content-archive.html create mode 100644 source/wp-content/themes/wporg-news-2021/block-template-parts/footer-archive.html create mode 100644 source/wp-content/themes/wporg-news-2021/block-template-parts/query-navigation.html create mode 100644 source/wp-content/themes/wporg-news-2021/sass/blocks/_post-excerpt.scss create mode 100644 source/wp-content/themes/wporg-news-2021/sass/blocks/_social-links.scss rename source/wp-content/themes/wporg-news-2021/sass/{blocks/_post-content.scss => post/_content.scss} (81%) create mode 100644 source/wp-content/themes/wporg-news-2021/sass/post/_footer.scss diff --git a/composer.lock b/composer.lock index 71555814..d7d7d8a7 100644 --- a/composer.lock +++ b/composer.lock @@ -9,16 +9,16 @@ "packages-dev": [ { "name": "composer/installers", - "version": "v1.11.0", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/composer/installers.git", - "reference": "ae03311f45dfe194412081526be2e003960df74b" + "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/ae03311f45dfe194412081526be2e003960df74b", - "reference": "ae03311f45dfe194412081526be2e003960df74b", + "url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19", + "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19", "shasum": "" }, "require": { @@ -117,6 +117,7 @@ "modx", "moodle", "osclass", + "pantheon", "phpbb", "piwik", "ppi", @@ -139,7 +140,7 @@ ], "support": { "issues": "https://github.com/composer/installers/issues", - "source": "https://github.com/composer/installers/tree/v1.11.0" + "source": "https://github.com/composer/installers/tree/v1.12.0" }, "funding": [ { @@ -155,7 +156,7 @@ "type": "tidelift" } ], - "time": "2021-04-28T06:42:17+00:00" + "time": "2021-09-13T08:19:44+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -747,16 +748,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f", + "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f", "shasum": "" }, "require": { @@ -764,7 +765,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -790,39 +792,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.0" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2021-09-17T15:28:14+00:00" }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -857,9 +859,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + "source": "https://github.com/phpspec/prophecy/tree/1.14.0" }, - "time": "2021-03-17T13:42:18+00:00" + "time": "2021-09-10T09:02:12+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1855,7 +1857,6 @@ "type": "github" } ], - "abandoned": true, "time": "2020-11-30T07:30:19+00:00" }, { @@ -2201,16 +2202,16 @@ }, { "name": "wp-phpunit/wp-phpunit", - "version": "5.8.0", + "version": "5.8.1", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", - "reference": "da3f6fc3bc5cae2c76af6f9a260620fc4f8d9f90" + "reference": "0b89ad32feae22f3a39e63e44117d6e56bdeed69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/da3f6fc3bc5cae2c76af6f9a260620fc4f8d9f90", - "reference": "da3f6fc3bc5cae2c76af6f9a260620fc4f8d9f90", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/0b89ad32feae22f3a39e63e44117d6e56bdeed69", + "reference": "0b89ad32feae22f3a39e63e44117d6e56bdeed69", "shasum": "" }, "type": "library", @@ -2245,19 +2246,19 @@ "issues": "https://github.com/wp-phpunit/issues", "source": "https://github.com/wp-phpunit/wp-phpunit" }, - "time": "2021-07-27T09:32:49+00:00" + "time": "2021-09-09T19:11:29+00:00" }, { "name": "wpackagist-plugin/gutenberg", - "version": "11.4.1", + "version": "11.5.1", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/gutenberg/", - "reference": "tags/11.4.1" + "reference": "tags/11.5.1" }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/gutenberg.11.4.1.zip" + "url": "https://downloads.wordpress.org/plugin/gutenberg.11.5.1.zip" }, "require": { "composer/installers": "~1.0 || ~2.0" @@ -2285,7 +2286,7 @@ }, { "name": "wpackagist-plugin/seriously-simple-podcasting", - "version": "2.8.2", + "version": "2.9.1", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/seriously-simple-podcasting/", @@ -2293,7 +2294,7 @@ }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/seriously-simple-podcasting.zip?timestamp=1630498726" + "url": "https://downloads.wordpress.org/plugin/seriously-simple-podcasting.zip?timestamp=1631645410" }, "require": { "composer/installers": "~1.0 || ~2.0" @@ -2343,12 +2344,12 @@ "source": { "type": "git", "url": "https://github.com/WordPress/wporg-mu-plugins.git", - "reference": "d71a4420d27b58a994eeee8b6774ce8ce03215b1" + "reference": "5421e91ce9da7e7c429b8c988cb27a41b3bcfdf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/wporg-mu-plugins/zipball/d71a4420d27b58a994eeee8b6774ce8ce03215b1", - "reference": "d71a4420d27b58a994eeee8b6774ce8ce03215b1", + "url": "https://api.github.com/repos/WordPress/wporg-mu-plugins/zipball/5421e91ce9da7e7c429b8c988cb27a41b3bcfdf1", + "reference": "5421e91ce9da7e7c429b8c988cb27a41b3bcfdf1", "shasum": "" }, "require": { @@ -2375,7 +2376,7 @@ "source": "https://github.com/WordPress/wporg-mu-plugins/tree/trunk", "issues": "https://github.com/WordPress/wporg-mu-plugins/issues" }, - "time": "2021-09-02T18:21:17+00:00" + "time": "2021-09-23T21:33:24+00:00" }, { "name": "wporg/wporg-repo-tools", diff --git a/source/wp-content/themes/wporg-news-2021/assets/svg/brush-stroke-short-2-blue-4.svg b/source/wp-content/themes/wporg-news-2021/assets/svg/brush-stroke-short-2-blue-4.svg new file mode 100644 index 00000000..d25c44fd --- /dev/null +++ b/source/wp-content/themes/wporg-news-2021/assets/svg/brush-stroke-short-2-blue-4.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/wp-content/themes/wporg-news-2021/assets/svg/brush-stroke-short-blue-4.svg b/source/wp-content/themes/wporg-news-2021/assets/svg/brush-stroke-short-blue-4.svg new file mode 100644 index 00000000..3f468798 --- /dev/null +++ b/source/wp-content/themes/wporg-news-2021/assets/svg/brush-stroke-short-blue-4.svg @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/wp-content/themes/wporg-news-2021/block-template-parts/content-archive.html b/source/wp-content/themes/wporg-news-2021/block-template-parts/content-archive.html new file mode 100644 index 00000000..1a56b0f4 --- /dev/null +++ b/source/wp-content/themes/wporg-news-2021/block-template-parts/content-archive.html @@ -0,0 +1,18 @@ + +
+ + + +
+ + +
+ +
+ + + +
+ +
+ diff --git a/source/wp-content/themes/wporg-news-2021/block-template-parts/footer-archive.html b/source/wp-content/themes/wporg-news-2021/block-template-parts/footer-archive.html new file mode 100644 index 00000000..cc0fbc1f --- /dev/null +++ b/source/wp-content/themes/wporg-news-2021/block-template-parts/footer-archive.html @@ -0,0 +1,75 @@ + + + + + + + diff --git a/source/wp-content/themes/wporg-news-2021/block-template-parts/query-navigation.html b/source/wp-content/themes/wporg-news-2021/block-template-parts/query-navigation.html new file mode 100644 index 00000000..ac0fbb5e --- /dev/null +++ b/source/wp-content/themes/wporg-news-2021/block-template-parts/query-navigation.html @@ -0,0 +1,7 @@ + +
+ + + +
+ diff --git a/source/wp-content/themes/wporg-news-2021/block-templates/index.html b/source/wp-content/themes/wporg-news-2021/block-templates/index.html index b265e94f..76cc1260 100644 --- a/source/wp-content/themes/wporg-news-2021/block-templates/index.html +++ b/source/wp-content/themes/wporg-news-2021/block-templates/index.html @@ -1,31 +1,23 @@ - -
- - -
- - - - - - -
+ +
+ +

All Posts

+ +
- - -
- -
- + +
+ + + -
- -
- +
+ + diff --git a/source/wp-content/themes/wporg-news-2021/block-templates/single.html b/source/wp-content/themes/wporg-news-2021/block-templates/single.html index d882f0be..7d58b500 100644 --- a/source/wp-content/themes/wporg-news-2021/block-templates/single.html +++ b/source/wp-content/themes/wporg-news-2021/block-templates/single.html @@ -1,7 +1,7 @@ - + - + diff --git a/source/wp-content/themes/wporg-news-2021/sass/blocks/_post-excerpt.scss b/source/wp-content/themes/wporg-news-2021/sass/blocks/_post-excerpt.scss new file mode 100644 index 00000000..431addb7 --- /dev/null +++ b/source/wp-content/themes/wporg-news-2021/sass/blocks/_post-excerpt.scss @@ -0,0 +1,13 @@ +.wp-block-post-excerpt__excerpt { + // Add an ellipses so that excerpts are not just cut off mid-sentence. + // Necessary since we're making the "more text" a link on a separate line. + &:after { + content: "\2026"; + } +} + +.wp-block-post-excerpt__more-text { + a { + text-decoration: underline; + } +} diff --git a/source/wp-content/themes/wporg-news-2021/sass/blocks/_post-title.scss b/source/wp-content/themes/wporg-news-2021/sass/blocks/_post-title.scss index 8c16a22a..529e4692 100644 --- a/source/wp-content/themes/wporg-news-2021/sass/blocks/_post-title.scss +++ b/source/wp-content/themes/wporg-news-2021/sass/blocks/_post-title.scss @@ -1,5 +1,10 @@ .wp-block-post-title { - .single [class*="wp-container-"] & { - margin-top: 0; + a { + color: inherit; + + &:hover, + &:focus { + color: var(--wp--preset--color--blue-1); + } } } diff --git a/source/wp-content/themes/wporg-news-2021/sass/blocks/_query-pagination.scss b/source/wp-content/themes/wporg-news-2021/sass/blocks/_query-pagination.scss index f41d75ff..d654d32e 100644 --- a/source/wp-content/themes/wporg-news-2021/sass/blocks/_query-pagination.scss +++ b/source/wp-content/themes/wporg-news-2021/sass/blocks/_query-pagination.scss @@ -1,31 +1,43 @@ +.query-navigation-container { + padding: 2em 0; +} + .wp-block-query-pagination { - padding-top: 1.5em; - justify-content: space-between; - display: grid; - grid-template-areas: "prev numbers next"; - grid-template-columns: 1fr 2fr 1fr; + display: inline-block; + line-height: 7em; + background-image: url("assets/svg/brush-stroke-short-blue-4.svg"); + background-position: center; + background-repeat: no-repeat; + background-size: contain; + color: var(--wp--preset--color--blue-1); - @include break-small-only(){ - grid-template-areas: "prev next"; - grid-template-columns: 1fr 1fr; + > .wp-block-query-pagination-previous, + > .wp-block-query-pagination-numbers, + > .wp-block-query-pagination-next { + margin-bottom: 0; + margin-right: 0; } - .wp-block-query-pagination-previous { - justify-self: start; - grid-area: prev; - } + .wp-block-query-pagination-numbers { + &:before { + content: "\00B7\0020"; + padding-left: 2px; + } + + &:after { + content: "\0020\00B7"; + padding-right: 2px; + } + + > * { + display: inline-block; + padding: 0 2px; + } - .wp-block-query-pagination-next { - justify-self: end; - grid-area: next; - } - - .wp-block-query-pagination-numbers{ - grid-area: numbers; - justify-self: center; .current { text-decoration: underline; } + @include break-small-only(){ display: none; } diff --git a/source/wp-content/themes/wporg-news-2021/sass/blocks/_social-links.scss b/source/wp-content/themes/wporg-news-2021/sass/blocks/_social-links.scss new file mode 100644 index 00000000..d0cf88c1 --- /dev/null +++ b/source/wp-content/themes/wporg-news-2021/sass/blocks/_social-links.scss @@ -0,0 +1,11 @@ +.footer-archive .wp-block-social-links.is-style-logos-only { + margin-right: var(--wp--custom--margin--horizontal); + + .wp-block-social-link { + padding: 0; + } + + .wp-block-social-link-anchor { + padding: 0; + } +} diff --git a/source/wp-content/themes/wporg-news-2021/sass/blocks/_post-content.scss b/source/wp-content/themes/wporg-news-2021/sass/post/_content.scss similarity index 81% rename from source/wp-content/themes/wporg-news-2021/sass/blocks/_post-content.scss rename to source/wp-content/themes/wporg-news-2021/sass/post/_content.scss index c12d4c71..b6ba202d 100644 --- a/source/wp-content/themes/wporg-news-2021/sass/blocks/_post-content.scss +++ b/source/wp-content/themes/wporg-news-2021/sass/post/_content.scss @@ -4,7 +4,11 @@ // // In this case, Flexbox doesn't work because it breaks the layout for things like a left- or right-aligned image // with paragraph text wrapping around it. - .single .wp-block-post-content > * { + .home .wp-block-post > article > *, + .blog .wp-block-post > article > *, + .archive .wp-block-post > article > *, + .single .wp-block-post-content > *, + .query-navigation-container[class*="wp-container-"] > * { // The first line in min is for when the viewport is narrower than the max wide layout. // The second line in min is for when the viewport is wider than the max wide layout. margin-left: calc( diff --git a/source/wp-content/themes/wporg-news-2021/sass/post/_footer.scss b/source/wp-content/themes/wporg-news-2021/sass/post/_footer.scss new file mode 100644 index 00000000..d8cfd9ad --- /dev/null +++ b/source/wp-content/themes/wporg-news-2021/sass/post/_footer.scss @@ -0,0 +1,55 @@ +.footer-archive { + display: none; + + &-row { + justify-content: center; + align-items: stretch !important; + border-top: 1px solid var(--wp--preset--color--light-grey); + } + + .wp-briefing { + p { + margin-top: 0; + margin-bottom: 0; + } + + .podcast-link { + line-height: 2.4; + margin-top: 1.1em; + padding: 0 1em 1.1em; + background-image: url("assets/svg/brush-stroke-short-2-blue-4.svg"); + background-position: bottom right; + background-repeat: no-repeat; + background-size: contain; + } + } +} + +@include break-medium { + .footer-archive { + display: block; + + &-row > * { + --horz-padding: calc( var(--wp--custom--margin--horizontal) * 2 ); + + // The first line in min is for when the viewport is narrower than the max wide layout. + // The second line in min is for when the viewport is wider than the max wide layout. + max-width: calc( + min( + 50% - var(--wp--custom--margin--horizontal) - 1px, + ( var(--wp--custom--layout--wide-size) / 2 ) - var(--horz-padding) - 1px + ) + ); + padding: var(--wp--custom--margin--vertical) 0; + + &:nth-child(odd) { + border-right: 1px solid var(--wp--preset--color--light-grey); + padding-right: var(--horz-padding); + } + + &:nth-child(even) { + padding-left: var(--horz-padding); + } + } + } +} diff --git a/source/wp-content/themes/wporg-news-2021/sass/post/_header.scss b/source/wp-content/themes/wporg-news-2021/sass/post/_header.scss index 42bc43e9..8a94a163 100644 --- a/source/wp-content/themes/wporg-news-2021/sass/post/_header.scss +++ b/source/wp-content/themes/wporg-news-2021/sass/post/_header.scss @@ -1,21 +1,50 @@ +.header-archive { + h1 { + font-size: 7.5rem; + } + + &-all-posts { + color: var(--wp--preset--color--white); + background-color: var(--wp--preset--color--blue-1); + } +} + .entry-header { - .wp-block-post-date { - line-height: 3.4; + &[class*="wp-container-"] * + * { + margin-top: 0; } - .wp-block-post-author, - .wp-block-post-terms { - display: inline-block; + .home &, + .blog &, + .archive & { + .wp-block-post-terms, + .wp-block-post-date { + display: inline-block; + } + + .wp-block-post-terms { + text-transform: uppercase; + } + + .wp-block-post-terms:after { + content: "\0020\00B7"; + } + } + + .single & { + .wp-block-post-date { + line-height: 3.4; + } - [class*="wp-container-"] & { - margin-top: 0; + .wp-block-post-author, + .wp-block-post-terms { + display: inline-block; } } } @include break-large { - .entry-header { - display: flex; + .single .entry-header { align-items: flex-start !important; // TODO eventually this might be a layout setting. justify-content: space-between; diff --git a/source/wp-content/themes/wporg-news-2021/sass/style.scss b/source/wp-content/themes/wporg-news-2021/sass/style.scss index ef14e074..f0d389a0 100644 --- a/source/wp-content/themes/wporg-news-2021/sass/style.scss +++ b/source/wp-content/themes/wporg-news-2021/sass/style.scss @@ -42,17 +42,23 @@ GNU General Public License for more details. @import "blocks/paragraph"; @import "blocks/post-author"; @import "blocks/post-comments"; -@import "blocks/post-content"; +@import "blocks/post-excerpt"; @import "blocks/post-title"; @import "blocks/pullquote"; @import "blocks/query-pagination"; @import "blocks/quote"; @import "blocks/search"; @import "blocks/separator"; +@import "blocks/social-links"; @import "blocks/file"; @import "blocks/table"; @import "blocks/video"; @import "blocks/columns"; + +// Posts +// - Styles for post areas +@import "post/content"; +@import "post/footer"; @import "post/header"; @import "post/meta"; @import "post/navigation";