Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blockbase: Implement Comment Block and removed CSS #6080

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 4 additions & 128 deletions blockbase/assets/ponyfill.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion blockbase/block-templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -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":"blockbase/comments"} /-->
</div>
<!-- /wp:group -->

Expand Down
3 changes: 2 additions & 1 deletion blockbase/block-templates/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
<!-- wp:spacer {"height":60} -->
<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:post-comments /-->
<!-- wp:pattern {"slug":"blockbase/comments"} /-->

</div>
<!-- /wp:group -->

Expand Down
61 changes: 61 additions & 0 deletions blockbase/patterns/comments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
/**
* Title: Comments
* slug: blockbase/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 -->
150 changes: 5 additions & 145 deletions blockbase/sass/blocks/_post-comments.scss
Original file line number Diff line number Diff line change
@@ -1,163 +1,23 @@
.wp-block-post-comments {
label, .comment-meta {
font-size: var(--wp--custom--form--label--typography--font-size);
}

.reply {
margin-top: var(--wp--custom--gap--vertical);
margin-bottom: 0;

a {
display: inline-block;
text-decoration: underline;
&:hover {
text-decoration: none;
}
}
}
.wp-block-comments-query-loop {

form {
display: grid;
column-gap: 1em;
grid-template-rows: auto;
grid-template-areas:
"misc misc"
"notes notes"
"author author"
"email url"
"comment comment"
"cookies-consent cookies-consent"
"form-submit form-submit";

input:not([type=submit]):not([type=checkbox]),
textarea {
font-size: var(--wp--custom--font-sizes--normal);
background: var(--wp--custom--color--background);
border: var(--wp--custom--form--border--width) var(--wp--custom--form--border--style) var(--wp--custom--form--border--color);
width: 100%;
}

textarea {
vertical-align: top;
}

label:not([for=wp-comment-cookies-consent]) {
label {
font-size: var(--wp--custom--form--label--typography--font-size);
font-weight: var(--wp--custom--form--label--typography--font-weight);
letter-spacing: var(--wp--custom--form--label--typography--letter-spacing);
margin-bottom: var(--wp--custom--form--label--spacing--margin--bottom);
text-transform: var(--wp--custom--form--label--typography--text-transform);
}

p {
margin-top: 0;
margin-bottom: var(--wp--custom--gap--vertical);
}
& > * {
grid-area: misc;
}

.comment-notes {
grid-area: notes;
}

.comment-form-author {
grid-area: author;
}

.comment-form-email {
grid-area: email;
}

.comment-form-url {
grid-area: url;
}

.comment-form-comment {
grid-area: comment;
}

.comment-form-cookies-consent {
grid-area: cookies-consent;
}

.form-submit {
grid-area: form-submit;
}

.comment-form-cookies-consent {
input[type="checkbox"] {
@include hide-accesibly;
input[type="checkbox"]#wp-comment-cookies-consent {
margin-left: 0;
margin-top: 1px;

& + label {
display: inline-block;
line-height: calc( var(--wp--custom--form--checkbox--unchecked--sizing--height) + 2 * var(--wp--custom--form--border--width));
margin-left: 0;
padding-left: calc( var(--wp--custom--form--checkbox--unchecked--sizing--width) + ( var(--wp--custom--gap--baseline) / 1.5 ) );
position: relative;
}
& + label::before,
& + label::after {
box-sizing: border-box;
}
& + ::before {
content: var(--wp--custom--form--checkbox--unchecked--content);
position: absolute;
top: var(--wp--custom--form--checkbox--unchecked--position--top);
left: var(--wp--custom--form--checkbox--unchecked--position--left);
width: var(--wp--custom--form--checkbox--unchecked--sizing--width);
height: var(--wp--custom--form--checkbox--unchecked--sizing--height);
border: var(--wp--custom--form--border--width) var(--wp--custom--form--border--style) var(--wp--custom--form--border--color);
}
&:checked + ::after {
content: var(--wp--custom--form--checkbox--checked--content);;
position: absolute;
top: var(--wp--custom--form--checkbox--checked--position--top);
left: var(--wp--custom--form--checkbox--checked--position--left);
width: var(--wp--custom--form--checkbox--checked--sizing--width);
height: var(--wp--custom--form--checkbox--checked--sizing--height);
font-size: var(--wp--custom--form--checkbox--checked--font-size);
}

&:focus + ::before {
outline: 1px dotted currentColor;
outline-offset: 2px;
}
}
}
}

.comment-reply-title {
small {
float: right;
font-size: 14px;
}
}

.commentlist {
margin-bottom: calc(2 * var(--wp--style--block-gap));
.comment {
p {
font-size: var(--wp--custom--post-comment--typography--font-size);
line-height: var(--wp--custom--post-comment--typography--line-height);
margin-bottom: var(--wp--custom--gap--vertical);
margin-top: var(--wp--custom--gap--vertical);
}
}
}

.comment-body {
margin-bottom: calc(1.5 * var( --wp--style--block-gap ));
}

.commentmetadata {
margin-left: 0;
margin-bottom: calc(0.75 * var( --wp--style--block-gap ));
}

.comment-awaiting-moderation {
display: inline-block;
font-size: var(--wp--preset--font-size--small);
margin-bottom: var(--wp--custom--gap--baseline);
}
}
Loading