Skip to content

Commit

Permalink
feat: initial single post layout (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelfulford authored May 18, 2023
1 parent 08f2d7b commit 603abb7
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 38 deletions.
17 changes: 17 additions & 0 deletions parts/author-bio.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|50"}},"layout":{"type":"default"}} -->
<div class="wp-block-group"><!-- wp:separator {"style":{"color":{"background":"#dddddd"}},"className":"is-style-wide"} -->
<hr class="wp-block-separator has-text-color has-alpha-channel-opacity has-background is-style-wide" style="background-color:#dddddd;color:#dddddd"/>
<!-- /wp:separator -->

<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:post-author-name {"style":{"typography":{"fontSize":"1.38rem","fontStyle":"normal","fontWeight":"700"}}} /-->

<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:post-author-biography /--></div>
<!-- /wp:group --></div>
<!-- /wp:group -->

<!-- wp:separator {"style":{"color":{"background":"#dddddd"}},"className":"is-style-wide"} -->
<hr class="wp-block-separator has-text-color has-alpha-channel-opacity has-background is-style-wide" style="background-color:#dddddd;color:#dddddd"/>
<!-- /wp:separator --></div>
<!-- /wp:group -->
35 changes: 35 additions & 0 deletions parts/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!-- wp:comments {"className":"wp-block-comments-query-loop"} -->
<div class="wp-block-comments wp-block-comments-query-loop"><!-- wp:comments-title {"level":3} /-->

<!-- wp:comment-template -->
<!-- wp:group {"style":{"spacing":{"margin":{"top":"0","bottom":"var:preset|spacing|50"}}}} -->
<div class="wp-block-group" style="margin-top:0;margin-bottom:var(--wp--preset--spacing--50)"><!-- wp:group {"style":{"spacing":{"blockGap":"0.5em"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
<div class="wp-block-group"><!-- wp:avatar {"size":40,"style":{"spacing":{"margin":{"top":"0.5em"}}}} /-->

<!-- wp:group -->
<div class="wp-block-group"><!-- wp:comment-author-name /-->

<!-- wp:group {"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"},"blockGap":"0.5em"}},"layout":{"type":"flex"}} -->
<div class="wp-block-group" style="margin-top:0px;margin-bottom:0px"><!-- wp:comment-date {"format":"F j, Y \\a\\t g:i a"} /-->

<!-- wp:comment-edit-link /--></div>
<!-- /wp:group --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->

<!-- wp:comment-content /-->

<!-- wp:comment-reply-link /--></div>
<!-- /wp:group -->
<!-- /wp:comment-template -->

<!-- wp:comments-pagination -->
<!-- wp:comments-pagination-previous /-->

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

<!-- wp:comments-pagination-next /-->
<!-- /wp:comments-pagination -->

<!-- wp:post-comments-form /--></div>
<!-- /wp:comments -->
5 changes: 5 additions & 0 deletions parts/post-footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:group {"layout":{"type":"flex"}} -->
<div class="wp-block-group"><!-- wp:post-terms {"term":"post_tag","fontSize":"small"} /--></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
13 changes: 13 additions & 0 deletions parts/post-header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20"}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:post-terms {"term":"category","style":{"typography":{"fontStyle":"normal","fontWeight":"700","textTransform":"uppercase"}},"fontSize":"medium"} /-->

<!-- wp:post-title {"level":1} /--></div>
<!-- /wp:group -->

<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20","margin":{"top":"var:preset|spacing|50"}}},"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group" style="margin-top:var(--wp--preset--spacing--50)"><!-- wp:post-author {"showAvatar":false,"byline":"By","isLink":true,"fontSize":"small"} /-->

<!-- wp:post-date {"format":"F j, Y, g:i a","isLink":false,"fontSize":"small"} /-->

<!-- wp:post-comments-link /--></div>
<!-- /wp:group -->
12 changes: 0 additions & 12 deletions parts/post-meta.html

This file was deleted.

3 changes: 3 additions & 0 deletions src/scss/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ html {
box-sizing: inherit;
}

.avatar {
border-radius: 100%;
}
1 change: 1 addition & 0 deletions src/scss/blocks/_blocks.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@import url( './_navigation.scss' );
@import url( './_post-author-name.scss' );
12 changes: 12 additions & 0 deletions src/scss/blocks/_post-author-name.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.wp-block-post-author {
align-items: center;

&__content > * {
display: inline;
}

&__byline {
font-size: inherit;
margin-right: 0.25em;
}
}
38 changes: 20 additions & 18 deletions templates/single.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
<!-- wp:template-part {"slug":"header","tagName":"header","theme":"newspack-block-theme"} /-->
<!-- wp:template-part {"slug":"header","theme":"newspack-block-theme","tagName":"header"} /-->

<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:post-title /-->
</div>
<div class="wp-block-group"><!-- wp:template-part {"slug":"post-header","theme":"newspack-block-theme","area":"uncategorized"} /--></div>
<!-- /wp:group -->

<!-- wp:group {"tagName":"main","lock":{"move":false,"remove":true}} -->
<main class="wp-block-group">
<!-- wp:post-featured-image {"align":"full"} /-->
<!-- wp:post-content {"layout":{"type":"constrained"},"lock":{"move":false,"remove":true}} /-->
<!-- wp:template-part {"slug":"post-meta","theme":"newspack-block-theme"} /-->
</main>
<!-- wp:group {"tagName":"main","lock":{"move":false,"remove":true},"layout":{"type":"constrained"}} -->
<main class="wp-block-group"><!-- wp:post-featured-image {"style":{"spacing":{"margin":{"bottom":"var:preset|spacing|60"}}}} /-->

<!-- wp:post-content {"lock":{"move":false,"remove":true},"layout":{"type":"constrained"}} /-->

<!-- wp:template-part {"slug":"post-footer","theme":"newspack-block-theme"} /-->

<!-- wp:spacer {"height":"var:preset|spacing|50"} -->
<div style="height:var(--wp--preset--spacing--50)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:template-part {"slug":"author-bio","theme":"newspack-block-theme"} /-->

<!-- wp:spacer {"height":"var:preset|spacing|50"} -->
<div style="height:var(--wp--preset--spacing--50)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer --></main>
<!-- /wp:group -->

<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:spacer {"height":"4rem"} -->
<div style="height:4rem" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:pattern {"slug":"newspack-block-theme/comments"} /-->
</div>
<div class="wp-block-group"><!-- wp:template-part {"slug":"comments","theme":"newspack-block-theme"} /--></div>
<!-- /wp:group -->

<!-- wp:template-part {"slug":"footer","tagName":"footer","theme":"newspack-block-theme"} /-->
<!-- wp:template-part {"slug":"footer","theme":"newspack-block-theme","tagName":"footer"} /-->
72 changes: 64 additions & 8 deletions theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@
"name": "Extra Extra Large",
"size": "clamp(1.75rem, 1.038rem + 3.165vw, 3rem)",
"slug": "xx-large"
},
{
"fluid": false,
"name": "h1",
"size": "clamp(1rem, calc(0.861rem + 5.063vw), 4rem)",
"slug": "xxx-large"
}
]
},
Expand Down Expand Up @@ -171,12 +177,15 @@
"border": {
"width": "1.5px"
},
"color": {
"text": "var( --wp--preset--color--primary )"
},
"spacing": {
"padding": {
"bottom": "calc( 0.6em - 2px )",
"left": "calc( 1.8em - 2px )",
"right": "calc( 1.8em - 2px )",
"top": "calc( 0.6em - 2px )"
"bottom": "calc( 0.375rem - 1.5px )",
"left": "calc( 1.125rem - 1.5px )",
"right": "calc( 1.125rem - 1.5px )",
"top": "calc( 0.375rem - 1.5px )"
}
}
}
Expand Down Expand Up @@ -256,26 +265,63 @@
"lineHeight": 1.5
}
},
"core/post-author-name": {
"core/post-author": {
"color": {
"text": "var(--wp--custom--color--gray-700)"
},
"elements": {
"link": {
"color": {
"text": "var(--wp--custom--color--gray-700)"
},
":hover": {
"typography": {
"textDecoration": "underline"
}
}
}
},
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
}
},
"core/post-author-biography": {
"color": {
"text": "var(--wp--custom--color--gray-700)"
},
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
}
},
"core/post-comments-link": {
"color": {
"text": "var(--wp--custom--color--gray-700)"
},
"elements": {
"link": {
"color": {
"text": "var(--wp--custom--color--gray-700)"
},
"typography": {
"textDecoration": "none"
":hover": {
"typography": {
"textDecoration": "underline"
}
}
}
},
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
}
},
"core/post-date": {
"color": {
"text": "var(--wp--preset--color--contrast)"
"text": "var(--wp--custom--color--gray-700)"
},
"elements": {
"link": {
"color": {
"text": "var(--wp--custom--color--gray-700)"
},
":hover": {
"typography": {
"textDecoration": "underline"
Expand All @@ -293,6 +339,9 @@
"core/post-terms": {
"elements": {
"link": {
"color": {
"text": "var(--wp--preset--color--contrast)"
},
"typography": {
"textDecoration": "none"
},
Expand All @@ -302,6 +351,13 @@
}
}
}
},
"variations": {
"category": {
"typography": {
"fontWeight": "bold"
}
}
}
},
"core/post-title": {
Expand Down

0 comments on commit 603abb7

Please sign in to comment.