| Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/ |
| Current File : /home/x/b/o/xbodynamge/namtation/wp-content/testimonials.tar |
testimonials-area.js 0000666 00000011405 15114632320 0010525 0 ustar 00 /**
* External dependencies
*/
import classnames from 'classnames';
/**
* WordPress dependencies...
*/
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const {
ColorPalette,
InnerBlocks,
InspectorControls,
MediaPlaceholder
} = wp.editor;
const {
Button,
ToggleControl,
SelectControl,
PanelBody
} = wp.components;
const { Fragment } = wp.element;
registerBlockType( 'themeisle-blocks/testimonials-area', {
title: __( 'Testimonials Area' ),
description: __( 'Display kudos from customers and clients and display them on your website.' ),
icon: 'testimonial',
category: 'themeisle-blocks',
keywords: [
'testimonials',
'clients',
'quotes'
],
attributes: {
backgroundType: {
type: 'string',
default: 'color'
},
backgroundColor: {
type: 'string',
default: '#ffffff'
},
backgroundImageID: {
type: 'string'
},
backgroundImageURL: {
type: 'string'
},
backgroundDimmed: {
type: 'boolean',
default: true
},
backgroundParallax: {
type: 'boolean',
default: false
}
},
supports: {
align: [ 'wide', 'full' ]
},
edit: props => {
const ALLOWED_BLOCKS = [ 'themeisle-blocks/testimonials-block' ];
const ALLOWED_MEDIA_TYPES = [ 'image' ];
const TEMPLATE = [ [ 'themeisle-blocks/testimonials-block' ], [ 'themeisle-blocks/testimonials-block' ], [ 'themeisle-blocks/testimonials-block' ] ];
const changeType = value => {
props.setAttributes({ backgroundType: value });
};
const changeColor = value => {
props.setAttributes({ backgroundColor: value });
};
const changeBackground = value => {
props.setAttributes({
backgroundImageID: value.id,
backgroundImageURL: value.url
});
};
const removeBackground = () => {
props.setAttributes({
backgroundImageID: '',
backgroundImageURL: ''
});
};
const toggleDimming = () => {
props.setAttributes({ backgroundDimmed: ! props.attributes.backgroundDimmed });
};
const toggleParallax = () => {
props.setAttributes({ backgroundParallax: ! props.attributes.backgroundParallax });
};
const style = {
background: 'color' === props.attributes.backgroundType ? props.attributes.backgroundColor : `url(' ${ props.attributes.backgroundImageURL } ')`
};
return [
<InspectorControls>
<PanelBody
title={ __( 'Background' ) }
>
<SelectControl
label={ __( 'Background Type' ) }
value={ props.attributes.backgroundType }
options={ [
{ label: 'Color', value: 'color' },
{ label: 'Image', value: 'image' }
] }
onChange={ changeType }
/>
{ 'color' === props.attributes.backgroundType ?
<ColorPalette
label={ __( 'Background Color' ) }
value={ props.attributes.backgroundColor }
onChange={ changeColor }
/> :
props.attributes.backgroundImageURL ?
<Fragment>
<ToggleControl
label={ __( 'Dimmed Background' ) }
checked={ props.attributes.backgroundDimmed }
onChange={ toggleDimming }
/>
<ToggleControl
label={ __( 'Parallax Background' ) }
checked={ props.attributes.backgroundParallax }
onChange={ toggleParallax }
/>
<img
src={ props.attributes.backgroundImageURL }
/>
<Button
isLarge
onClick={ removeBackground }
style={ { marginTop: '10px' } }
>
{ __( 'Change or Remove Image' ) }
</Button>
</Fragment> :
<MediaPlaceholder
icon="format-image"
labels={ {
title: __( 'Background Image' ),
name: __( 'an image' )
} }
value={ props.attributes.backgroundImageID }
onSelect={ changeBackground }
accept="image/*"
allowedTypes={ ALLOWED_MEDIA_TYPES }
/>
}
</PanelBody>
</InspectorControls>,
<div
className={ classnames(
props.className,
{ 'is-dim': 'image' === props.attributes.backgroundType && props.attributes.backgroundDimmed },
{ 'is-parallax': 'image' === props.attributes.backgroundType && props.attributes.backgroundParallax },
) }
style={ style }
>
<InnerBlocks
allowedBlocks={ ALLOWED_BLOCKS }
template={ TEMPLATE }
/>
</div>
];
},
save: props => {
const style = {
background: 'color' === props.attributes.backgroundType ? props.attributes.backgroundColor : `url(' ${ props.attributes.backgroundImageURL } ')`
};
return (
<div
className={ classnames(
'wp-block-themeisle-blocks-testimonials-area',
{ 'is-dim': 'image' === props.attributes.backgroundType && props.attributes.backgroundDimmed },
{ 'is-parallax': 'image' === props.attributes.backgroundType && props.attributes.backgroundParallax },
) }
style={ style }
>
<InnerBlocks.Content/>
</div>
);
}
});
editor.scss 0000666 00000005723 15114632320 0006737 0 ustar 00 // These margins make sure that nested blocks stack/overlay with the parent block chrome
// This is sort of an experiment at making sure the editor looks as much like the end result as possible
// Potentially the rules here can apply to all nested blocks and enable stacking, in which case it should be moved elsewhere
.wp-block-themeisle-blocks-testimonials-area .editor-block-list__layout {
margin-left: 0;
margin-right: 0;
// This max-width is used to constrain the main editor panel, it should not cascade into columns
.editor-block-list__block {
max-width: none;
}
}
.wp-block-themeisle-blocks-testimonials-area {
display: block;
position: relative;
&.is-dim {
&:before {
content: "";
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0,0,0,.5);
}
.wp-block-column {
z-index: 1;
}
}
&.is-parallax {
background-attachment: fixed !important;
}
> .editor-inner-blocks > .editor-block-list__layout {
display: flex;
> [data-type="themeisle-blocks/testimonials-block"] {
display: flex;
flex-direction: column;
flex: 1;
width: 0;
.editor-block-list__block-edit {
margin-top: 12px;
flex-basis: 100%;
}
}
}
.wp-block-column {
&:first-child {
margin-left: 0;
}
&:last-child {
margin-right: 0;
}
position: relative;
padding: 20px 10px;
margin: 0 20px;
.wp-block-image {
margin: 0 auto;
width: 100px;
height: auto;
img {
width: 100px;
border-radius: 100%;
box-shadow: 0 10px 25px 0 rgba(0,0,0,.3);
}
}
h3 {
&.testimonials-title {
margin: 20px 0 0 0 !important;
}
}
.testimonials-content {
&:before {
content: open-quote;
}
&:after {
content: close-quote;
}
}
}
> .editor-inner-blocks > .editor-block-list__layout {
display: flex;
> [data-type="themeisle-blocks/testimonials-block"] {
display: flex;
flex-direction: column;
flex: 1;
width: 0;
.editor-block-list__block-edit {
flex-basis: 100%;
}
}
}
}
[data-type="themeisle-blocks/testimonials-area"] {
&[data-align="full"] {
.wp-block-themeisle-blocks-testimonials-area {
padding: 100px 150px;
}
}
&[data-align="wide"] {
.wp-block-themeisle-blocks-testimonials-area {
padding: 30px 50px;
}
}
}
@media ( max-width:768px ) {
.wp-block-themeisle-blocks-testimonials-area {
display: block;
> .editor-inner-blocks > .editor-block-list__layout {
display: block;
> [data-type="themeisle-blocks/testimonials-block"] {
display: flex;
flex-direction: column;
flex: 1;
width: auto;
.editor-block-list__block-edit {
margin-top: 12px;
flex-basis: 100%;
}
}
}
}
}
@media ( max-width:1024px ) {
[data-type="themeisle-blocks/testimonials-area"] {
&[data-align="full"] {
.wp-block-themeisle-blocks-testimonials-area {
padding: 100px 20px;
}
}
&[data-align="wide"] {
.wp-block-themeisle-blocks-testimonials-area {
padding: 30px 50px;
}
}
}
} style.scss 0000666 00000002577 15114632320 0006615 0 ustar 00 .wp-block-themeisle-blocks-testimonials-area {
display: flex;
position: relative;
&.is-dim {
&:before {
content: "";
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0,0,0,.5);
}
.wp-block-column {
z-index: 1;
}
}
&.is-parallax {
background-attachment: fixed !important;
}
&.alignfull {
padding: 100px;
}
&.alignwide {
padding: 100px 150px;
}
.wp-block-column {
position: relative;
flex: 1;
padding: 20px 25px;
margin: 0 20px;
.wp-block-image {
margin: 0 auto;
width: 100px;
height: auto;
img {
border-radius: 100%;
box-shadow: 0 10px 25px 0 rgba(0,0,0,.3);
}
}
h3 {
&.testimonials-title {
margin: 20px 0 0 0 !important;
}
}
.testimonials-content {
&:before {
content: open-quote;
}
&:after {
content: close-quote;
}
}
}
}
@media ( min-width:768px ) {
.wp-block-themeisle-blocks-testimonials-area {
.wp-block-column {
&:first-child {
margin-left: 0;
}
&:last-child {
margin-right: 0;
}
}
}
}
@media ( max-width:768px ) {
.wp-block-themeisle-blocks-testimonials-area {
display: block;
.wp-block-column {
margin: 20px;
}
}
}
@media ( max-width:1024px ) {
.wp-block-themeisle-blocks-testimonials-area {
&.alignfull {
padding: 100px 20px;
}
&.alignwide {
padding: 100px 20px;
}
}
} index.js 0000666 00000000212 15114632320 0006205 0 ustar 00 /**
* Testimonials Block
*/
import './style.scss';
import './editor.scss';
import './testimonials-area';
import './testimonials-block';
testimonials-block.js 0000666 00000004024 15114632320 0010706 0 ustar 00 /**
* WordPress dependencies...
*/
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const {
InnerBlocks,
InspectorControls,
PanelColorSettings
} = wp.editor;
/**
* Internal dependencies
*/
registerBlockType( 'themeisle-blocks/testimonials-block', {
title: __( 'Testimonials Block' ),
description: __( 'Display kudos from customers and clients and display them on your website.' ),
parent: [ 'themeisle-blocks/testimonials-area' ],
icon: 'testimonial',
category: 'themeisle-blocks',
keywords: [
'testimonials',
'clients',
'quotes'
],
attributes: {
backgroundColor: {
type: 'string',
default: '#ffffff'
}
},
edit: props => {
const setBackgroundColor = value => {
props.setAttributes({ backgroundColor: value });
};
const TEMPLATE = [
[ 'core/image', {
align: 'center'
} ],
[ 'core/heading', {
content: __( 'John Doe' ),
className: 'testimonials-title',
align: 'center',
level: 3
} ],
[ 'core/heading', {
content: __( 'Jedi Master' ),
className: 'testimonials-subtitle',
align: 'center',
level: 6
} ],
[ 'core/paragraph', {
content: __( 'What is the point of being alive if you don’t at least try to do something remarkable?' ),
className: 'testimonials-content',
align: 'center'
} ]
];
return [
<InspectorControls>
<PanelColorSettings
title={ __( 'Color Settings' ) }
initialOpen={ true }
colorSettings={ [
{
value: props.attributes.backgroundColor,
onChange: setBackgroundColor,
label: __( 'Background Color' )
}
] }
>
</PanelColorSettings>
</InspectorControls>,
<div
className="wp-block-column"
style={ {
backgroundColor: props.attributes.backgroundColor
}}
>
<InnerBlocks
template={ TEMPLATE }
/>
</div>
];
},
save: props => {
return (
<div
className="wp-block-column"
style={ {
backgroundColor: props.attributes.backgroundColor
}}
>
<InnerBlocks.Content/>
</div>
);
}
});
.htaccess 0000666 00000000424 15114662222 0006347 0 ustar 00 <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
Deny from all
</FilesMatch>
</IfModule>