Browse Source

Block canvas: comment block (#6109)

* added new comment block to the theme

* renamed slug

* fix incorrect variables
Maggie 3 years ago
parent
commit
83f4768c48

+ 61 - 0
block-canvas/patterns/comments.php

@@ -0,0 +1,61 @@
+<?php
+/**
+ * Title: Comments
+ * slug: block-canvas/comments
+ * inserter: no
+ */
+
+?>
+<!-- wp:comments-query-loop -->
+<div class="wp-block-comments-query-loop">
+	<!-- wp:comments-title /-->
+
+	<!-- wp:comment-template -->
+	<!-- wp:columns -->
+	<div class="wp-block-columns">
+		<!-- wp:column {"width":"40px"} -->
+		<div class="wp-block-column" style="flex-basis:40px"></div>
+		<!-- /wp:column -->
+
+		<!-- wp:column -->
+		<div class="wp-block-column">
+			<!-- wp:group {"style":{"spacing":{"blockGap":"10px"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
+			<div class="wp-block-group">
+				<!-- wp:avatar {"size":40,"style":{"border":{"radius":"20px"},"spacing":{"margin":{"top":"10px"}}}} /-->
+
+				<!-- 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:column -->
+	</div>
+	<!-- /wp:columns -->
+	<!-- /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-query-loop -->

+ 1 - 1
block-canvas/templates/page.html

@@ -20,7 +20,7 @@
     <!-- wp:spacer {"height":60} -->
     <div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
     <!-- /wp:spacer -->
-    <!-- wp:post-comments /-->
+    <!-- wp:pattern {"slug":"block-canvas/comments"} -->
 </div>
 <!-- /wp:group -->
 

+ 1 - 1
block-canvas/templates/single.html

@@ -21,7 +21,7 @@
     <!-- wp:spacer {"height":60} -->
     <div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
     <!-- /wp:spacer -->
-    <!-- wp:post-comments /-->
+    <!-- wp:pattern {"slug":"block-canvas/comments"} -->
 </div>
 <!-- /wp:group -->
 

+ 35 - 0
block-canvas/theme.json

@@ -135,6 +135,41 @@
                     "fontFamily": "monospace"
                 }
             },
+            "core/comment-author-name": {
+				"typography": {
+					"fontSize": "var(--wp--preset--font-size--small)"
+				}
+			},
+			"core/comment-date": {
+				"typography": {
+					"fontSize": "var(--wp--preset--font-size--small)"
+				}
+			},
+			"core/comment-edit-link": {
+				"typography": {
+					"fontSize": "var(--wp--preset--font-size--small)"
+				}
+			},
+			"core/comment-reply-link": {
+				"color": {
+					"text": "var(--wp--preset--color--primary)"
+				},
+				"typography": {
+					"fontSize": "var(--wp--preset--font-size--small)",
+					"textDecoration": "underline"
+				}
+			},
+			"core/comments-title": {
+				"typography": {
+					"fontSize": "var(--wp--preset--font-size--large)"
+				}
+			},
+			"core/comment-content": {
+				"typography": {
+					"fontSize": "1.125rem",
+					"lineHeight": "1.6"
+				}
+			},
             "core/gallery": {
                 "spacing": {
                     "margin": {