Skip to content

Commit

Permalink
Like block: update styles (#35187)
Browse files Browse the repository at this point in the history
* Convert media queries to container queries

* Convert media queries to container queries
  • Loading branch information
TimBroddin authored Jan 23, 2024
1 parent bd4b3ed commit 28ae1d4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Tint style update


18 changes: 17 additions & 1 deletion projects/plugins/jetpack/extensions/blocks/like/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
display: none;
}

/* Fetched below from https://widgets.wp.com/likes/style.css at 2024-01-15T08:02:21.397Z */
/* Fetched below from https://widgets.wp.com/likes/style.css at 2024-01-23T11:29:16.073Z */
.wpl-likebox {
container-type:inline-size;
}
.wpl-likebox,.wpl-follow a,.wpl-count a {
font-size:11px!important;
font-family:"Open Sans",sans-serif!important;
Expand Down Expand Up @@ -77,8 +80,21 @@
.wpl-button.like a span,.wpl-button.liked a span,.wpl-button.reblog a span {
margin-left:3px;
}
@container (max-width:320px) {
.wpl-button {
min-width:auto;
}
.wpl-button a {
padding-bottom:10px;
}
.wpl-button a span {
display:none;
}
}
.wpl-count {
clear:both;
text-overflow:ellipsis;
overflow:hidden;
}
.wpl-count-text {
line-height:1.6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ function processCSS( css ) {
// Remove body and HTML styles
let processedCSS = css.replace( /body[^{]*\{[^}]*\}/g, '' );
processedCSS = processedCSS.replace( /html[^{]*\{[^}]*\}/g, '' );

// Convert media queries to container queries
processedCSS = processedCSS.replace(
/@media(?:\s+only\s+screen)?\s*(and)?\s*\(([^)]+)\)/g,
'@container ($2)'
);
// Pretty print the CSS
processedCSS = prettyPrintCSS( processedCSS );

Expand All @@ -42,7 +46,13 @@ function processCSS( css ) {
padding: 0 16px 16px 52px;
margin-top: -12px;
}
}`;
}
// Hide the Like block if it tries to load in the editor (e.g. as a part of the Query Loop block).
.wp-block-jetpack-like .sharedaddy {
display: none;
}
`;

const customRule2 = `
/* Overrides to fix CSS conflicts within editor. */
Expand Down

0 comments on commit 28ae1d4

Please sign in to comment.