Plugin Tabs noticias
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
import * as areoi from '../_components/Core.js';
|
||||
import meta from './block.json';
|
||||
|
||||
const ALLOWED_BLOCKS = [];
|
||||
const BLOCKS_TEMPLATE = null;
|
||||
|
||||
const blockIcon = <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><path d="M0,0h24v24H0V0z" fill="none"/></g><g><g><path d="M13,2.05v3.03c3.39,0.49,6,3.39,6,6.92c0,0.9-0.18,1.75-0.48,2.54l2.6,1.53C21.68,14.83,22,13.45,22,12 C22,6.82,18.05,2.55,13,2.05z M12,19c-3.87,0-7-3.13-7-7c0-3.53,2.61-6.43,6-6.92V2.05C5.94,2.55,2,6.81,2,12 c0,5.52,4.47,10,9.99,10c3.31,0,6.24-1.61,8.06-4.09l-2.6-1.53C16.17,17.98,14.21,19,12,19z"/></g></g></svg>;
|
||||
|
||||
areoi.blocks.registerBlockType( meta, {
|
||||
icon: blockIcon,
|
||||
edit: props => {
|
||||
const {
|
||||
attributes,
|
||||
setAttributes,
|
||||
clientId
|
||||
} = props;
|
||||
|
||||
const { block_id } = attributes;
|
||||
if ( !block_id ) {
|
||||
setAttributes( { block_id: clientId } );
|
||||
}
|
||||
|
||||
const classes = [
|
||||
attributes.style,
|
||||
attributes.color,
|
||||
attributes.size ? attributes.style + attributes.size : ''
|
||||
];
|
||||
|
||||
const blockProps = areoi.editor.useBlockProps( {
|
||||
style: { cssText: areoi.helper.GetStyles( attributes ) }
|
||||
} );
|
||||
|
||||
function onChange( key, value ) {
|
||||
setAttributes( { [key]: value } );
|
||||
}
|
||||
|
||||
const tabDevice = ( tab ) => {
|
||||
return (
|
||||
<div>
|
||||
{ areoi.DisplayVisibility( areoi, attributes, onChange, tab ) }
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{ areoi.DisplayPreview( areoi, attributes, onChange, 'spinner' ) }
|
||||
|
||||
{ !attributes.preview &&
|
||||
<div { ...blockProps } data-anchor={ attributes.anchor ? ' : #' + attributes.anchor : '' }>
|
||||
<areoi.editor.InspectorControls key="setting">
|
||||
|
||||
<areoi.components.PanelBody title={ 'Settings' } initialOpen={ false }>
|
||||
|
||||
<areoi.components.PanelRow className="areoi-panel-row">
|
||||
<areoi.components.SelectControl
|
||||
label="Style"
|
||||
labelPosition="top"
|
||||
help="The border spinner uses currentColor for its border-color, meaning you can customize the color with text color utilities. You can use any of our text color utilities on the standard spinner."
|
||||
value={ attributes.style }
|
||||
options={ [
|
||||
{ label: 'Default', value: 'spinner-border' },
|
||||
{ label: 'Border', value: 'spinner-border' },
|
||||
{ label: 'Grow', value: 'spinner-grow' },
|
||||
] }
|
||||
onChange={ ( value ) => onChange( 'style', value ) }
|
||||
/>
|
||||
</areoi.components.PanelRow>
|
||||
|
||||
<areoi.components.PanelRow className="areoi-panel-row">
|
||||
<areoi.components.SelectControl
|
||||
label="Size"
|
||||
labelPosition="top"
|
||||
help="Add .spinner-border-sm and .spinner-grow-sm to make a smaller spinner that can quickly be used within other components."
|
||||
value={ attributes.size }
|
||||
options={ [
|
||||
{ label: 'Default', value: null },
|
||||
{ label: 'Small', value: '-sm' }
|
||||
] }
|
||||
onChange={ ( value ) => onChange( 'size', value ) }
|
||||
/>
|
||||
</areoi.components.PanelRow>
|
||||
|
||||
<areoi.components.PanelRow>
|
||||
<areoi.components.SelectControl
|
||||
label="Color"
|
||||
labelPosition="top"
|
||||
help="The border spinner uses currentColor for its border-color, meaning you can customize the color with text color utilities. You can use any of our text color utilities on the standard spinner."
|
||||
value={ attributes.color }
|
||||
options={ [
|
||||
{ label: 'Default', value: null },
|
||||
{ label: 'Primary', value: 'text-primary' },
|
||||
{ label: 'Secondary', value: 'text-secondary' },
|
||||
{ label: 'Success', value: 'text-success' },
|
||||
{ label: 'Danger', value: 'text-danger' },
|
||||
{ label: 'Warning', value: 'text-warning' },
|
||||
{ label: 'Info', value: 'text-info' },
|
||||
{ label: 'Light', value: 'text-light' },
|
||||
{ label: 'Dark', value: 'text-dark' },
|
||||
] }
|
||||
onChange={ ( value ) => onChange( 'color', value ) }
|
||||
/>
|
||||
</areoi.components.PanelRow>
|
||||
|
||||
</areoi.components.PanelBody>
|
||||
|
||||
{ areoi.ResponsiveTabPanel( tabDevice, meta, props ) }
|
||||
|
||||
</areoi.editor.InspectorControls>
|
||||
|
||||
<div className={ areoi.helper.GetClassNameStr( classes ) }></div>
|
||||
</div>
|
||||
}
|
||||
</>
|
||||
);
|
||||
},
|
||||
save: () => {
|
||||
return (
|
||||
<areoi.editor.InnerBlocks.Content/>
|
||||
);
|
||||
},
|
||||
} );
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"apiVersion": 2,
|
||||
"name": "areoi/spinner",
|
||||
"title": "Spinner",
|
||||
"parent": null,
|
||||
"category": "areoi-components",
|
||||
"description": "Indicate the loading state of a component or page with Bootstrap spinners, built entirely with HTML, CSS, and no JavaScript.",
|
||||
"textdomain": "default",
|
||||
"keywords": [ "areoi", "bootstrap", "component" ],
|
||||
"example": {
|
||||
"attributes": {
|
||||
"preview": true
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"preview": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"anchor": {
|
||||
"type": "string",
|
||||
"default": false
|
||||
},
|
||||
"block_id": {
|
||||
"type": "string",
|
||||
"default": null
|
||||
},
|
||||
|
||||
"style": {
|
||||
"type": "string",
|
||||
"default": "spinner-border"
|
||||
},
|
||||
"color": {
|
||||
"type": "string",
|
||||
"default": "text-primary"
|
||||
},
|
||||
"size": {
|
||||
"type": "string",
|
||||
"default": null
|
||||
},
|
||||
|
||||
"hide_xs": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"hide_sm": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"hide_md": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"hide_lg": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"hide_xl": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"hide_xxl": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"anchor": true,
|
||||
"align": false,
|
||||
"html": false
|
||||
},
|
||||
"editorScript": "areoi-blocks",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:../../build/style.css"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Reference in New Issue
Block a user