Skip to content

Commit

Permalink
Issue #27 - Add component for Block create command
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Feb 21, 2019
1 parent 641ae6e commit b93f616
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 47 deletions.
2 changes: 1 addition & 1 deletion blocks/build/css/blocks.editor.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion blocks/build/css/blocks.style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ div.bw_css{background-color:#f8f8f8}.bw_css code{display:block;margin-top:10px;b
div.bw_csv{width:100%}
.wp-block-oik-block-blockicon.svg64 svg{width:64px;height:64px}.svg64 .editor-block-icon,.svg64 .editor-block-icon svg{width:64px;height:64px;max-height:64px;max-width:64px}.wp-block-oik-block-blockicon .is-style-svg64 svg{width:64px;height:64px;max-height:64px;max-width:64px}
.wp-block-oik-block-blockicon.svg64 svg{width:64px;height:64px}.svg64 .editor-block-icon,.svg64 .editor-block-icon svg{width:64px;height:64px;max-height:64px;max-width:64px}.wp-block-oik-block-blockicon .is-style-svg64 svg{width:64px;height:64px;max-height:64px;max-width:64px}
.wp-block-oik-block-blockicon.svg64 svg{width:64px;height:64px}.svg64 .editor-block-icon,.svg64 .editor-block-icon svg{width:64px;height:64px;max-height:64px;max-width:64px}.wp-block-oik-block-blockicon .is-style-svg64 svg{width:64px;height:64px;max-height:64px;max-width:64px}
pre.wp-block-oik-block-blocklist{font-size:10px}
4 changes: 2 additions & 2 deletions blocks/build/js/editor.blocks.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions blocks/oik-blocklist/blocklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Fragment = wp.element.Fragment;
import { BlockiconStyled } from '../oik-blockicon/blockicons.js';
import { getNameSpace} from './blockprefix.js';

function BlockListStyled( prefix, showBlockTypeName, showTitle, showDescription, showBatch, ...props ) {
function BlockListStyled( prefix, showBlockTypeName, showTitle, showDescription, showBatch, component, ...props ) {
//var block = getBlockType( blockname ) ;
//var blockicon = BlockiconStyled( blockname, props );
//var blockTypeName = showBlockTypeName ? <div>{ blockname }</div> : null;
Expand All @@ -32,7 +32,7 @@ function BlockListStyled( prefix, showBlockTypeName, showTitle, showDescription,
if ( showBatch ) {
var blocklist = <pre>
cd ~/public_html/wp-content/plugins/oik-shortcodes/admin
{block_types.map( (block) => BlockCreateItem( block )) }
{block_types.map( (block) => BlockCreateItem( block, component )) }
</pre>
} else
{
Expand Down Expand Up @@ -75,9 +75,9 @@ function BlockListItem( block ) {
);
}

function BlockCreateItem( block ) {
function BlockCreateItem( block, component ) {
console.log( block );
return( <Fragment><br/>oikwp oik-create-blocks.php {block.name} "{block.title}" component url=blocks.wp-a2z.org</Fragment> );
return( <Fragment><br/>oikwp oik-create-blocks.php {block.name} "{block.title}" {component} url=blocks.wp-a2z.org</Fragment> );
}

export { BlockListStyled };
14 changes: 2 additions & 12 deletions blocks/oik-blocklist/editor.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
.wp-block-oik-block-blockicon {
.is-style-svg64 {
svg {
width: 64px;
height: 64px;
max-height: 64px;
max-width: 64px;
}
}

}
/* Editor styling for oik-blocklist */

.wp-block-oik-block-blocklist {
pre {
font-size: 12px;
font-size: 10px;
}
}
16 changes: 15 additions & 1 deletion blocks/oik-blocklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ export default registerBlockType(
showBatch: {
type: 'boolean',
default: false
},

component: {
type: 'string',
default: ""
}


Expand Down Expand Up @@ -127,11 +132,16 @@ export default registerBlockType(
props.setAttributes( { showBatch: ! props.attributes.showBatch } );
}

const onChangeComponent = ( event ) => {
props.setAttributes( { component: event } );
}

var blocklist = BlockListStyled( props.attributes.prefix,
props.attributes.showBlockTypeName,
props.attributes.showTitle,
props.attributes.showDescription,
props.attributes.showBatch,
props.attributes.component,
props );


Expand Down Expand Up @@ -181,6 +191,10 @@ export default registerBlockType(

</PanelRow>

<PanelRow>
<TextControl label={"Component"} value={ props.attributes.component} onChange={ onChangeComponent }/>
</PanelRow>



</PanelBody>
Expand All @@ -201,7 +215,7 @@ export default registerBlockType(
/>
*/
save: props => {
return BlockListStyled( props.attributes.prefix, props.attributes.showBlockTypeName, props.attributes.showTitle, props.attributes.showDescription, props.attributes.showBatch, props );
return BlockListStyled( props.attributes.prefix, props.attributes.showBlockTypeName, props.attributes.showTitle, props.attributes.showDescription, props.attributes.showBatch, props.attributes.component, props );
},
},
);
30 changes: 4 additions & 26 deletions blocks/oik-blocklist/style.scss
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@

/* oik-blockicon/style.scss */
.wp-block-oik-block-blockicon.svg64 svg {
width: 64px;
height: 64px;
}

.svg64 .editor-block-icon,
.svg64 .editor-block-icon svg {
width: 64px;
height: 64px;
max-height: 64px;
max-width: 64px;
}


.wp-block-oik-block-blockicon .is-style-svg64 {
svg {
width: 64px;
height: 64px;
max-height: 64px;
max-width: 64px;
}


}
/* oik-blocklist/style.scss */
pre.wp-block-oik-block-blocklist {
font-size: 10px;
}

0 comments on commit b93f616

Please sign in to comment.