Skip to content

Commit

Permalink
feat: add archive, author archive templates (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelfulford authored May 24, 2023
1 parent 7ce6f74 commit 927a982
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 48 deletions.
9 changes: 9 additions & 0 deletions src/scss/_gutenberg-shim.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ figcaption a {
color: inherit;
}

/*
* Term description - remove margin from first paragraph.
* The underlying issue is that the author bio block lacks paragraphs,
* so its spacing and the term description spacing differ.
*/
.wp-block-term-description p:first-child {
margin-top: 0;
}

/*
* Form Styles
* https://github.com/WordPress/gutenberg/issues/34198
Expand Down
1 change: 1 addition & 0 deletions src/scss/blocks/_blocks.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import url( './_navigation.scss' );
@import url( './_paragraph.scss' );
@import url( './_pagination.scss' );
@import url( './_post-author-name.scss' );
@import url( './_post-comments.scss' );
@import url( './_pullquote.scss' );
13 changes: 13 additions & 0 deletions src/scss/blocks/_pagination.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.wp-block-query-pagination-numbers,
.wp-block-comments-pagination-numbers {
a,
span {
border-radius: 6px;
padding: 0.5rem 0.8rem;
}

.current {
background: var(--wp--preset--color--primary);
color: var(--wp--preset--color--base);
}
}
12 changes: 0 additions & 12 deletions src/scss/blocks/_post-comments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,3 @@
}
}

.wp-block-comments-pagination-numbers {
a,
span {
border-radius: 6px;
padding: 0.5rem 0.8rem;
}

.current {
background: var(--wp--preset--color--primary);
color: var(--wp--preset--color--base);
}
}
83 changes: 51 additions & 32 deletions templates/archive.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,53 @@
<!-- wp:template-part {"slug":"header","tagName":"header","theme":"newspack-block-theme"} /-->

<!-- wp:query {"tagName":"main","layout":{"type":"constrained"}} -->
<main class="wp-block-query">
<!-- wp:query-title {"type":"archive","style":{"spacing":{"margin":{"bottom":"100px"}}}} /-->

<!-- wp:post-template -->
<!-- wp:group -->
<div class="wp-block-group">
<!-- wp:post-title {"isLink":true} /-->
<!-- wp:post-featured-image {"isLink":true} /-->
<!-- wp:post-excerpt /-->
<!-- wp:template-part {"slug":"post-meta","theme":"newspack-block-theme"} /-->

<!-- wp:spacer {"height":40} -->
<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
</div>
<!-- /wp:group -->
<!-- /wp:post-template -->

<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:query-pagination -->
<!-- wp:query-pagination-previous /-->
<!-- wp:query-pagination-numbers /-->
<!-- wp:query-pagination-next /-->
<!-- /wp:query-pagination -->
</div>
<!-- /wp:group -->
</main>
<!-- wp:template-part {"slug":"header","theme":"newspack-block-theme","tagName":"header"} /-->

<!-- wp:query {"queryId":0,"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true,"taxQuery":null,"parents":[]},"tagName":"main","layout":{"type":"constrained"}} -->
<main class="wp-block-query"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|30","margin":{"bottom":"var:preset|spacing|60"}}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group" style="margin-bottom:var(--wp--preset--spacing--60)"><!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|30"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:query-title {"type":"archive","showPrefix":false} /-->

<!-- wp:term-description {"style":{"spacing":{"margin":{"top":"0","right":"0","bottom":"0","left":"0"}}}} /--></div>
<!-- /wp:group --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->

<!-- wp:post-template -->
<!-- wp:columns {"className":"is-style-first-col-to-second"} -->
<div class="wp-block-columns is-style-first-col-to-second"><!-- wp:column {"width":"150px"} -->
<div class="wp-block-column" style="flex-basis:150px"><!-- wp:post-featured-image {"aspectRatio":"3/2"} /--></div>
<!-- /wp:column -->

<!-- wp:column {"width":""} -->
<div class="wp-block-column"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20"}}} -->
<div class="wp-block-group"><!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:post-terms {"term":"category","style":{"typography":{"fontStyle":"normal","fontWeight":"700","textTransform":"uppercase"}},"fontSize":"small"} /-->

<!-- wp:post-title {"isLink":true,"fontSize":"large"} /--></div>
<!-- /wp:group -->

<!-- wp:post-excerpt /-->

<!-- wp:post-author {"showAvatar":false,"byline":"By","isLink":true} /-->

<!-- wp:post-date {"isLink":true} /--></div>
<!-- /wp:group --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:separator {"backgroundColor":"quartary"} -->
<hr class="wp-block-separator has-text-color has-quartary-color has-alpha-channel-opacity has-quartary-background-color has-background"/>
<!-- /wp:separator -->
<!-- /wp:post-template -->

<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:query-pagination {"layout":{"type":"flex","justifyContent":"center"}} -->
<!-- wp:query-pagination-previous /-->

<!-- wp:query-pagination-numbers /-->

<!-- wp:query-pagination-next /-->
<!-- /wp:query-pagination --></div>
<!-- /wp:group --></main>
<!-- /wp:query -->

<!-- wp:template-part {"slug":"footer","tagName":"footer","theme":"newspack-block-theme"} /-->
<!-- wp:template-part {"slug":"footer","theme":"newspack-block-theme","tagName":"footer"} /-->
53 changes: 53 additions & 0 deletions templates/author.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!-- wp:template-part {"slug":"header","theme":"newspack-block-theme","tagName":"header"} /-->

<!-- wp:query {"queryId":0,"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true,"taxQuery":null,"parents":[]},"tagName":"main","layout":{"type":"constrained"}} -->
<main class="wp-block-query"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|30","margin":{"bottom":"var:preset|spacing|60"}}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group" style="margin-bottom:var(--wp--preset--spacing--60)"><!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|30"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:query-title {"type":"archive","showPrefix":false} /-->

<!-- wp:post-author-biography {"fontSize":"large"} /--></div>
<!-- /wp:group --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->

<!-- wp:post-template -->
<!-- wp:columns {"className":"is-style-first-col-to-second"} -->
<div class="wp-block-columns is-style-first-col-to-second"><!-- wp:column {"width":"150px"} -->
<div class="wp-block-column" style="flex-basis:150px"><!-- wp:post-featured-image {"aspectRatio":"3/2"} /--></div>
<!-- /wp:column -->

<!-- wp:column {"width":""} -->
<div class="wp-block-column"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20"}}} -->
<div class="wp-block-group"><!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:post-terms {"term":"category","style":{"typography":{"fontStyle":"normal","fontWeight":"700","textTransform":"uppercase"}},"fontSize":"small"} /-->

<!-- wp:post-title {"isLink":true,"fontSize":"large"} /--></div>
<!-- /wp:group -->

<!-- wp:post-excerpt /-->

<!-- wp:post-author {"showAvatar":false,"byline":"By","isLink":true} /-->

<!-- wp:post-date {"isLink":true} /--></div>
<!-- /wp:group --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:separator {"backgroundColor":"quartary"} -->
<hr class="wp-block-separator has-text-color has-quartary-color has-alpha-channel-opacity has-quartary-background-color has-background"/>
<!-- /wp:separator -->
<!-- /wp:post-template -->

<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:query-pagination {"layout":{"type":"flex","justifyContent":"center"}} -->
<!-- wp:query-pagination-previous /-->

<!-- wp:query-pagination-numbers /-->

<!-- wp:query-pagination-next /-->
<!-- /wp:query-pagination --></div>
<!-- /wp:group --></main>
<!-- /wp:query -->

<!-- wp:template-part {"slug":"footer","theme":"newspack-block-theme","tagName":"footer"} /-->
41 changes: 37 additions & 4 deletions theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@
"fontFamily": "monospace"
}
},
"core/columns": {
"spacing": {
"blockGap": "var(--wp--preset--spacing--50)"
}
},
"core/comment-author-name": {
"elements": {
"link": {
Expand Down Expand Up @@ -322,7 +327,8 @@
}
},
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
"fontSize": "var(--wp--preset--font-size--small)",
"lineHeight": "1.5"
}
},
"core/post-author-biography": {
Expand Down Expand Up @@ -373,8 +379,6 @@
"fontSize": "var(--wp--preset--font-size--small)"
}
},
"core/comments-pagination-numbers": {
},
"core/post-date": {
"color": {
"text": "var(--wp--custom--color--gray-700)"
Expand All @@ -395,7 +399,8 @@
}
},
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
"fontSize": "var(--wp--preset--font-size--small)",
"lineHeight": "1.5"
}
},
"core/post-terms": {
Expand Down Expand Up @@ -456,6 +461,26 @@
"lineHeight": "1.333"
}
},
"core/query-pagination": {
"elements": {
"link": {
"color": {
"text": "var( --wp--preset--color--contrast )"
},
":hover": {
"typography": {
"textDecoration": "underline"
}
},
"typography": {
"textDecoration": "none"
}
}
},
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
}
},
"core/quote": {
"border": {
"color": "var(--wp--preset--color--primary)",
Expand Down Expand Up @@ -517,6 +542,14 @@
"fontSize": "var(--wp--preset--font-size--medium)",
"fontWeight": "700"
}
},
"core/term-description": {
"color": {
"text": "var( --wp--custom--color--gray-700 )"
},
"typography": {
"fontSize": "1.375rem"
}
}
},
"color": {
Expand Down

0 comments on commit 927a982

Please sign in to comment.