Plugin Tabs noticias

This commit is contained in:
root
2026-04-14 13:50:04 -06:00
parent 299099d006
commit 19d08e5694
2334 changed files with 628926 additions and 113 deletions

View File

@@ -0,0 +1,146 @@
import * as areoi from '../_components/Core.js';
import * as grid from './template-parts-js/grid.js';
import * as stacked from './template-parts-js/stacked.js';
import * as carousel from './template-parts-js/carousel.js';
import meta from './block.json';
const ALLOWED_BLOCKS = ['areoi/banner-item'];
const BLOCKS_TEMPLATE = [
[ 'areoi/banner-item', {},
[
[ 'core/heading', { level: 1, content: 'Enter Heading' } ],
[ 'core/paragraph', { content: 'Enter description' } ],
[ 'areoi/button', {} ],
]
],
[ 'areoi/banner-item', {},
[
[ 'core/heading', { level: 2, content: 'Enter Heading' } ],
]
],
[ 'areoi/banner-item', {},
[
[ 'core/heading', { level: 2, content: 'Enter Heading' } ],
]
],
];
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"><rect fill="none" height="24" width="24"/><path d="M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M19,5v3H5V5H19z M19,10v4H5v-4H19z M5,19v-3h14v3H5z"/></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 } );
}
let child_blocks = wp.data.select( 'core/block-editor' ).getBlocks( block_id ),
layout = attributes['layout'] ? attributes['layout']: 'grid',
container = layout == 'grid' ? 'container-fluid' : 'container',
has_follows = child_blocks.length > 3 ? 'areoi-banner-grid-has-follows' : '';
const classes = [
'areoi-banner-' + layout,
has_follows,
( attributes['size'] && attributes['size'] != 'Default' ? attributes['size'] : '' ),
];
const blockProps = areoi.editor.useBlockProps( {
className: areoi.helper.GetClassName( classes ),
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, 'banner' ) }
{ !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>
<areoi.components.SelectControl
label="Layout"
labelPosition="top"
help="This will change the layout of any banner items you add within this banner."
value={ attributes.layout }
options={ [
{ label: 'Carousel', value: 'carousel' },
{ label: 'Stacked', value: 'stacked' },
{ label: 'Grid', value: 'grid' },
] }
onChange={ ( value ) => onChange( 'layout', value ) }
/>
</areoi.components.PanelRow>
<areoi.components.PanelRow>
<areoi.components.SelectControl
label="Size"
labelPosition="top"
help="Choose a predefined size for your banner. Small is 50vh, Medium is 75vh and Large is 100vh."
value={ attributes.size }
options={ [
{ label: 'Small', value: 'areoi-small' },
{ label: 'Medium', value: 'areoi-medium' },
{ label: 'Large', value: 'areoi-large' },
] }
onChange={ ( value ) => onChange( 'size', value ) }
/>
</areoi.components.PanelRow>
</areoi.components.PanelBody>
{ areoi.ResponsiveTabPanel( tabDevice, meta, props ) }
</areoi.editor.InspectorControls>
{ layout == 'stacked' &&
<>
{ stacked.render( areoi, child_blocks, BLOCKS_TEMPLATE, ALLOWED_BLOCKS ) }
</>
}
{ layout == 'grid' &&
<>
{ grid.render( areoi, child_blocks, BLOCKS_TEMPLATE, ALLOWED_BLOCKS ) }
</>
}
{ layout == 'carousel' &&
<>
{ carousel.render( areoi, child_blocks, BLOCKS_TEMPLATE, ALLOWED_BLOCKS ) }
</>
}
</div>
}
</>
);
},
save: () => {
return (
<areoi.editor.InnerBlocks.Content/>
);
},
} );

View File

@@ -0,0 +1,70 @@
{
"apiVersion": 2,
"name": "areoi/banner",
"title": "Banner",
"parent": null,
"category": "areoi-strips",
"description": "Choose from 3 different banner layouts with background images and videos.",
"textdomain": "default",
"keywords": [ "areoi", "bootstrap", "strips" ],
"example": {
"attributes": {
"preview": true
}
},
"attributes": {
"preview": {
"type": "boolean",
"default": false
},
"anchor": {
"type": "string",
"default": false
},
"block_id": {
"type": "string",
"default": null
},
"layout": {
"type": "string",
"default": "grid"
},
"size": {
"type": "string",
"default": "areoi-large"
},
"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": true,
"html": false
},
"editorScript": "areoi-blocks",
"editorStyle": "file:./index.css",
"style": "file:../../build/style.css"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

View File

@@ -0,0 +1,107 @@
.areoi-banner-item {
min-height: 100px;
}
.areoi-banner-grid {
height: calc( 100vh + 80px );
padding: 0 20px;
border: 1px dashed #ddd;
}
.areoi-banner-grid.areoi-small {
height: 50vh;
}
.areoi-banner-grid.areoi-medium {
height: 75vh;
}
.areoi-banner-grid > div {
height: 100%;
padding-left: 0 !important;
padding-right: 0 !important;
}
.areoi-banner-grid > div > .row > .block-editor-inner-blocks > .block-editor-block-list__layout {
display: grid;
grid-auto-rows: 1fr;
grid-template-columns: 1fr 1fr 1fr;
}
.areoi-banner-grid > div > .row > .block-editor-inner-blocks > .block-editor-block-list__layout > .banner-item {
width: 100%;
padding: 20px 0;
border: 1px dashed #ddd;
}
.areoi-banner-grid > div > .row > .block-editor-inner-blocks > .block-editor-block-list__layout > .banner-item:first-of-type {
grid-column-start: 1;
grid-column-end: 3;
grid-row-start: 1;
grid-row-end: 3;
}
.areoi-banner-grid > div > .row > .block-editor-inner-blocks > .block-editor-block-list__layout > .banner-item > .col {
height: 100%;
align-items: flex-end;
padding: 30px;
display: flex;
}
.areoi-banner-grid .areoi-banner-content {
max-width: 500px;
position: relative;
padding-bottom: calc(var(--bs-gutter-x) * .5);
}
.areoi-banner-grid .areoi-banner-content :last-child {
margin-bottom: 0;
}
.areoi-banner-stacked {
padding: 0 20px;
border: 1px dashed #ddd;
}
.areoi-banner-stacked .banner-item {
height: 100vh;
border: 1px dashed #ddd;
padding: 20px 0;
}
.areoi-banner-stacked.areoi-small .banner-item {
height: 50vh;
}
.areoi-banner-stacked.areoi-medium .banner-item {
height: 75vh;
}
.areoi-banner-stacked .banner-item > .container,
.areoi-banner-stacked .banner-item > .container > .row {
height: 100%;
}
.block-editor-block-list__layout.is-root-container .banner-item > .container > .row,
.block-editor-block-list__layout.is-root-container .banner-item > .container > .row.justify-content-center:not(.background .row) {
display: flex !important;
}
.areoi-banner-carousel {
padding: 0 20px;
border: 1px dashed #ddd;
}
.areoi-banner-carousel .banner-item {
height: 100vh;
border: 1px dashed #ddd;
padding: 20px 0;
}
.areoi-banner-carousel.areoi-small .banner-item {
height: 50vh;
}
.areoi-banner-carousel.areoi-medium .banner-item {
height: 75vh;
}
.areoi-banner-carousel .banner-item > .container,
.areoi-banner-carousel .banner-item > .container > .row {
height: 100%;
}
.block-editor-block-list__layout.is-root-container .areoi-banner-carousel .banner-item > .container > .row {
display: flex !important;
}
.block-editor-block-list__layout.is-root-container .areoi-banner-carousel .banner-item:not(:first-of-type) {
display: none;
}
.block-editor-block-list__layout.is-root-container .areoi-banner-carousel.is-selected .banner-item,
.block-editor-block-list__layout.is-root-container .areoi-banner-carousel.has-child-selected .banner-item {
display: block;
}

View File

@@ -0,0 +1,103 @@
.areoi-banner-grid {
height: 200vh;
}
.areoi-banner-grid.areoi-small {
height: 100vh;
}
.areoi-banner-grid.areoi-medium {
height: 150vh;
}
.areoi-banner-grid > div {
height: 100%;
}
.areoi-banner-grid > div > .row {
display: grid;
grid-auto-rows: 1fr;
grid-template-columns: 1fr;
}
.areoi-banner-grid > div > .row > .col:first-of-type {
grid-column-start: 1;
grid-column-end: 2;
grid-row-start: 1;
grid-row-end: 3;
}
.areoi-banner-grid .areoi-banner-item {
height: 100%;
align-items: flex-end;
}
.areoi-banner-grid .areoi-banner-content {
position: relative;
margin: 0 auto;
padding-bottom: calc(2rem + var(--bs-gutter-x) * .5);
}
.areoi-banner-grid .areoi-banner-content :last-child {
margin-bottom: 0;
}
@media only screen and ( min-width: 576px ) {
.areoi-banner-grid {
height: 100vh;
}
.areoi-banner-grid.areoi-small {
height: 50vh;
}
.areoi-banner-grid.areoi-medium {
height: 75vh;
}
.areoi-banner-grid > div > .row {
grid-template-columns: 1fr 1fr;
}
.areoi-banner-grid > div > .row > .col:first-of-type {
grid-column-end: 3;
}
.areoi-banner-grid .areoi-banner-content {
max-width: 540px;
padding: 2rem calc(var(--bs-gutter-x) * .5);
margin: 0;
}
}
@media only screen and ( min-width: 992px ) {
.areoi-banner-grid > div > .row {
grid-template-columns: 1fr 1fr 1fr;
}
.areoi-banner-grid .areoi-banner-content {
max-width: 500px;
padding: calc(2rem + var(--bs-gutter-x) * .5) 2rem;
}
}
.areoi-banner-stacked .areoi-banner-item {
min-height: 100vh;
display: flex;
align-items: center;
}
.areoi-banner-stacked.areoi-small .areoi-banner-item {
min-height: 50vh;
}
.areoi-banner-stacked.areoi-medium .areoi-banner-item {
min-height: 75vh;
}
.areoi-banner-stacked .areoi-banner-item .areoi-banner-media {
margin: 1rem 0;
}
.areoi-banner-carousel .areoi-banner-item {
min-height: 100vh;
display: flex;
align-items: center;
padding: 100px 0;
}
.areoi-banner-carousel.areoi-small .areoi-banner-item {
height: 50vh;
}
.areoi-banner-carousel.areoi-medium .areoi-banner-item {
height: 75vh;
}
.areoi-banner-carousel .areoi-banner-item .areoi-banner-media {
margin: 1rem 0;
}

View File

@@ -0,0 +1,18 @@
function render( areoi, child_blocks, BLOCKS_TEMPLATE, ALLOWED_BLOCKS )
{
var item_count = child_blocks.length;
if ( item_count ) {
return (
<div class="areoi-strip">
<areoi.editor.InnerBlocks template={ BLOCKS_TEMPLATE } allowedBlocks={ ALLOWED_BLOCKS } />
</div>
);
}
}
export {
render
}

View File

@@ -0,0 +1,20 @@
function render( areoi, child_blocks, BLOCKS_TEMPLATE, ALLOWED_BLOCKS )
{
var item_count = child_blocks.length;
if ( item_count ) {
return (
<div className={ areoi.helper.GetClassNameStr( [ 'container-fluid' ] ) }>
<div className={ areoi.helper.GetClassNameStr( [ 'row', 'h-100' ] ) }>
<areoi.editor.InnerBlocks template={ BLOCKS_TEMPLATE } allowedBlocks={ ALLOWED_BLOCKS } />
</div>
</div>
);
}
}
export {
render
}

View File

@@ -0,0 +1,18 @@
function render( areoi, child_blocks, BLOCKS_TEMPLATE, ALLOWED_BLOCKS )
{
var item_count = child_blocks.length;
if ( item_count ) {
return (
<div class="areoi-strip">
<areoi.editor.InnerBlocks template={ BLOCKS_TEMPLATE } allowedBlocks={ ALLOWED_BLOCKS } />
</div>
);
}
}
export {
render
}

View File

@@ -0,0 +1,25 @@
<?php
ob_start();
?>
<div id="<?php echo areoi_return_id( $attributes ) ?>-carousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
<?php foreach ( $contents as $content_key => $content ) : ?>
<button type="button" data-bs-target="#<?php echo areoi_return_id( $attributes ) ?>-carousel" data-bs-slide-to="<?php echo $content_key; ?>" class="<?php echo $content_key == 0 ? 'active' : '' ?>" aria-label="Slide <?php echo $content_key + 1; ?>"></button>
<?php endforeach; ?>
</div>
<div class="carousel-inner">
<?php foreach ( $contents as $content_key => $content ) : ?>
<div class="carousel-item <?php echo $content_key == 0 ? 'active' : '' ?>">
<?php echo $content ?>
</div>
<?php endforeach; ?>
</div>
</div>
<?php
$output .= ob_get_contents();
ob_end_clean();

View File

@@ -0,0 +1,17 @@
<?php
ob_start();
?>
<div class="container-fluid">
<div class="row h-100">
<?php foreach ( $contents as $content_key => $content ) : ?>
<div class="col position-relative">
<?php echo $content; ?>
</div>
<?php endforeach; ?>
</div>
</div>
<?php
$output .= ob_get_contents();
ob_end_clean();

View File

@@ -0,0 +1,9 @@
<?php
ob_start();
foreach ( $contents as $content_key => $content ) :
echo $content;
endforeach;
$output .= ob_get_contents();
ob_end_clean();