Skip to content

Commit

Permalink
Cover Image: Classes should be fraction of 100
Browse files Browse the repository at this point in the history
  • Loading branch information
mcsf committed Sep 29, 2017
1 parent eab53ef commit 7280973
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion blocks/library/cover-image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,5 @@ registerBlockType( 'core/cover-image', {
function dimRatioToClass( ratio ) {
return ( ratio === 0 || ratio === 50 )
? null
: 'has-background-dim-' + Math.round( ratio / 10 );
: 'has-background-dim-' + ( 10 * Math.round( ratio / 10 ) );
}
2 changes: 1 addition & 1 deletion blocks/library/cover-image/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}

@for $i from 1 through 10 {
&.has-background-dim.has-background-dim-#{ $i }:before {
&.has-background-dim.has-background-dim-#{ $i * 10 }:before {
background-color: rgba( black, $i * 0.1 );
}
}
Expand Down
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__cover-image.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- wp:core/cover-image {"url":"https://cldup.com/uuUqE_dXzy.jpg","dimRatio":40} -->
<section class="wp-block-cover-image has-background-dim-4 has-background-dim" style="background-image:url(https://cldup.com/uuUqE_dXzy.jpg);">
<section class="wp-block-cover-image has-background-dim-40 has-background-dim" style="background-image:url(https://cldup.com/uuUqE_dXzy.jpg);">
<h2>Guten Berg!</h2>
</section>
<!-- /wp:core/cover-image -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__cover-image.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"hasParallax": false,
"dimRatio": 40
},
"originalContent": "<section class=\"wp-block-cover-image has-background-dim-4 has-background-dim\" style=\"background-image:url(https://cldup.com/uuUqE_dXzy.jpg);\">\n <h2>Guten Berg!</h2>\n</section>"
"originalContent": "<section class=\"wp-block-cover-image has-background-dim-40 has-background-dim\" style=\"background-image:url(https://cldup.com/uuUqE_dXzy.jpg);\">\n <h2>Guten Berg!</h2>\n</section>"
}
]
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__cover-image.parsed.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"url": "https://cldup.com/uuUqE_dXzy.jpg",
"dimRatio": 40
},
"rawContent": "\n<section class=\"wp-block-cover-image has-background-dim-4 has-background-dim\" style=\"background-image:url(https://cldup.com/uuUqE_dXzy.jpg);\">\n <h2>Guten Berg!</h2>\n</section>\n"
"rawContent": "\n<section class=\"wp-block-cover-image has-background-dim-40 has-background-dim\" style=\"background-image:url(https://cldup.com/uuUqE_dXzy.jpg);\">\n <h2>Guten Berg!</h2>\n</section>\n"
},
{
"attrs": {},
Expand Down
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__cover-image.serialized.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- wp:core/cover-image {"url":"https://cldup.com/uuUqE_dXzy.jpg","dimRatio":40} -->
<section class="wp-block-cover-image has-background-dim-4 has-background-dim" style="background-image:url(https://cldup.com/uuUqE_dXzy.jpg);">
<section class="wp-block-cover-image has-background-dim-40 has-background-dim" style="background-image:url(https://cldup.com/uuUqE_dXzy.jpg);">
<h2>Guten Berg!</h2>
</section>
<!-- /wp:core/cover-image -->

0 comments on commit 7280973

Please sign in to comment.