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

Correct position of comment icon indicating current author #824

Merged
merged 2 commits into from
Mar 18, 2020
Merged
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
21 changes: 5 additions & 16 deletions newspack-theme/classes/class-newspack-walker-comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,6 @@ protected function html5_comment( $comment, $depth, $args ) {
}
}

/*
* Using the `check` icon instead of `check_circle`, since we can't add a
* fill color to the inner check shape when in circle form.
*/
if ( newspack_is_comment_by_post_author( $comment ) ) {
printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', newspack_get_icon_svg( 'check', 24 ) );
}

/*
* Using the `check` icon instead of `check_circle`, since we can't add a
* fill color to the inner check shape when in circle form.
*/
if ( newspack_is_comment_by_post_author( $comment ) ) {
printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', newspack_get_icon_svg( 'check', 24 ) );
}

printf(
wp_kses(
/* translators: %s: comment author link */
Expand All @@ -73,6 +57,11 @@ protected function html5_comment( $comment, $depth, $args ) {
'<b class="fn">' . get_comment_author_link( $comment ) . '</b>'
);

/* Display icon if the commenter is the current post's author. */
if ( newspack_is_comment_by_post_author( $comment ) ) {
printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', wp_kses( newspack_get_icon_svg( 'check', 24 ), newspack_sanitize_svgs() ) );
}

if ( ! empty( $comment_author_url ) ) {
echo '</a>';
}
Expand Down
4 changes: 3 additions & 1 deletion newspack-theme/inc/color-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ function newspack_custom_colors_css() {
.entry .entry-content *[class^="wp-block-"].is-style-solid-color,
.entry .entry-content *[class^="wp-block-"].is-style-solid-color.has-primary-background-color,
.entry .entry-content .wp-block-file .wp-block-file__button,
.site-content .wp-block-newspack-blocks-donate.tiered .wp-block-newspack-blocks-donate__tiers input[type="radio"]:checked + .tier-select-label {
.site-content .wp-block-newspack-blocks-donate.tiered .wp-block-newspack-blocks-donate__tiers input[type="radio"]:checked + .tier-select-label,
.comment .comment-author .post-author-badge {
background-color: ' . esc_html( $primary_color ) . '; /* base: #0073a8; */
}

Expand Down Expand Up @@ -87,6 +88,7 @@ function newspack_custom_colors_css() {
.highlight-menu .menu-label,
/* Header default background; default height */
body.h-db.h-dh .site-header .nav3 .menu-highlight a,
.comment .comment-author .post-author-badge,
.site-content .wp-block-newspack-blocks-donate.tiered .wp-block-newspack-blocks-donate__tiers input[type="radio"]:checked + .tier-select-label {
color: ' . esc_html( $primary_color_contrast ) . ';
}
Expand Down
27 changes: 15 additions & 12 deletions newspack-theme/sass/site/primary/_comments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@

.fn {
position: relative;
display: block;
display: inline-block;

a {
color: inherit;
Expand All @@ -197,25 +197,28 @@
}

.post-author-badge {
background: $color__primary;
border-radius: 100%;
display: block;
height: 18px;
position: absolute;
background: lighten( $color__primary, 8% );
right: calc( 100% - #{$size__spacing-unit * 2.5} );
top: -3px;
width: 18px;
color: #fff;
display: inline-block;
height: 16px;
line-height: 16px;
margin-left: #{0.25 * $size__spacing-unit};
text-align: center;
width: 16px;

@include media( tablet ) {
right: calc( 100% + #{$size__spacing-unit * 0.75} );
height: 18px;
line-height: 18px;
width: 18px;
}

svg {
width: inherit;
display: inline-block;
fill: currentColor;
height: inherit;
display: block;
fill: white;
transform: scale( 0.875 );
width: inherit;
}
}
}
Expand Down