Skip to content

Commit

Permalink
Cater for variations where block.icon.src is not set #50
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Nov 18, 2021
1 parent 357a4dc commit 6485b9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/oik-blockicon/blockicons.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function BlockiconStyled( blocknamebarvariation, ...props ) {
var block = getBlockorVariation( blocknamebarvariation );
return(
<div className={ props.className } >
{ block ? <Icon icon={ block.icon.src } /> : <p>Hmm</p> }
{ block ? <Icon icon={ block.icon && block.icon.src ? block.icon.src : block.icon } /> : <p>Hmm</p> }
</div>


Expand Down
7 changes: 2 additions & 5 deletions src/oik-blockinfo/blockinfo.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
/*
* Block info renderer - displays the fields for the block info block
*
* @copyright (C) Copyright Bobbing Wide 2019,2020
* @copyright (C) Copyright Bobbing Wide 2019,2020,2021
* @author Herb Miller @bobbingwide
*
*/


import {BlockSupportsInserter, getBlockorVariation} from "../oik-blockicon/blockicons";
import {BlockVariations } from "../oik-blockicon/blockvariations";
const { getBlockType } = wp.blocks;
import { BlockiconStyled } from '../oik-blockicon/blockicons.js';
import { BlockListItem } from '../oik-blocklist/blocklist';


/**
*
* @param blocknamebarvariation
Expand Down Expand Up @@ -43,6 +40,7 @@ function BlockinfoStyled( blocknamebarvariation, showBlockLink, showBlockIcon, s
} else {
//console.log( block );
var blockicon = showBlockIcon ? BlockiconStyled(blocknamebarvariation, props) : null;
//console.log( blockicon );
var blockTypeName = showBlockTypeName ? <div>{block.block_name} {block.name}</div> : null;
var blockTitle = showTitle ? <div>{block.title}</div> : null;
var blockDescription = showDescription ? <div>{block.description}</div> : null;
Expand All @@ -69,7 +67,6 @@ function BlockinfoStyled( blocknamebarvariation, showBlockLink, showBlockIcon, s
);
}


}

export { BlockinfoStyled };

0 comments on commit 6485b9f

Please sign in to comment.