Skip to content

Commit

Permalink
Issue #42 - Add styles to the block icon block ( oik-blocks/blockicon )
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Oct 26, 2020
1 parent 7b45750 commit 22a800a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
10 changes: 6 additions & 4 deletions blocks/oik-blockicon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ export default registerBlockType(
* the SVG to adjust in size.
*
* https://code.tutsplus.com/tutorials/implementing-block-style-variations-in-gutenberg-part-1--cms-32243
*/
styles: [
{ name: 'default', label: 'Default', isDefault: true },
{ name: 'svg64', label: 'Large' },
{ name: 'svg24', label: '24px'},
{ name: 'svg64', label: '64px', isDefault: true },
{ name: 'svg100', label: '100px'},
{ name: 'svg150', label: '150px'},
],
*/


edit: props => {

Expand Down
16 changes: 12 additions & 4 deletions blocks/oik-blockicon/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* oik-blockicon/style.scss */
.wp-block-oik-block-blockicon svg {
width: 20px;
height: 20px;
width: 24px;
height: 24px;
fill: currentColor;
}

.wp-block-oik-block-blockicon.svg64 svg {
Expand All @@ -18,7 +19,7 @@
}


.wp-block-oik-block-blockicon .is-style-svg64 {
.wp-block-oik-block-blockicon.is-style-svg64 {
svg {
width: 64px;
height: 64px;
Expand All @@ -29,6 +30,13 @@

}

/**
Override default styling for block icons.
*/
.wp-block-oik-block-blockicon .block-editor-block-icon {
display: inline;
}

@mixin sizeablesvg( $svg-size, $sizepx ) {
.wp-block-oik-block-blockicon.#{$svg-size} svg {
width: $sizepx;
Expand All @@ -44,7 +52,7 @@
}


.wp-block-oik-block-blockicon .is-style-#{$svg-size} {
.wp-block-oik-block-blockicon.is-style-#{$svg-size} {
svg {
width: $sizepx;
height: $sizepx;
Expand Down

0 comments on commit 22a800a

Please sign in to comment.