@webikon/webentor-core 0.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/pre-commit +40 -0
- package/.prettierrc.js +5 -0
- package/CHANGELOG.md +88 -0
- package/LICENCE.md +7 -0
- package/README.md +26 -0
- package/core-js/_alpine.ts +20 -0
- package/core-js/_slider.ts +232 -0
- package/core-js/_utils.ts +126 -0
- package/core-js/blocks-components/block-appender.tsx +36 -0
- package/core-js/blocks-components/button.tsx +424 -0
- package/core-js/blocks-components/custom-image-sizes-panel.tsx +197 -0
- package/core-js/blocks-components/index.ts +4 -0
- package/core-js/blocks-components/typography-picker-select.tsx +31 -0
- package/core-js/blocks-filters/_filter-core-typography.tsx +108 -0
- package/core-js/blocks-filters/_slider-settings.tsx +283 -0
- package/core-js/blocks-filters/index.ts +3 -0
- package/core-js/blocks-filters/responsive-settings/components/DisabledSliderInfo.tsx +10 -0
- package/core-js/blocks-filters/responsive-settings/constants.ts +11 -0
- package/core-js/blocks-filters/responsive-settings/index.tsx +196 -0
- package/core-js/blocks-filters/responsive-settings/settings/block-link/index.ts +1 -0
- package/core-js/blocks-filters/responsive-settings/settings/block-link/panel.tsx +47 -0
- package/core-js/blocks-filters/responsive-settings/settings/border/border/index.tsx +1 -0
- package/core-js/blocks-filters/responsive-settings/settings/border/border/properties.ts +27 -0
- package/core-js/blocks-filters/responsive-settings/settings/border/border/settings.tsx +310 -0
- package/core-js/blocks-filters/responsive-settings/settings/border/border-radius/index.tsx +1 -0
- package/core-js/blocks-filters/responsive-settings/settings/border/border-radius/properties.ts +31 -0
- package/core-js/blocks-filters/responsive-settings/settings/border/border-radius/settings.tsx +211 -0
- package/core-js/blocks-filters/responsive-settings/settings/border/index.ts +1 -0
- package/core-js/blocks-filters/responsive-settings/settings/border/panel.tsx +54 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/display/index.ts +2 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/display/properties.ts +167 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/display/settings.tsx +73 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/flexbox/index.ts +2 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/flexbox/properties.ts +187 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/flexbox/settings.tsx +131 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/grid/index.ts +2 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/grid/properties.ts +187 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/grid/settings.tsx +132 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/index.ts +4 -0
- package/core-js/blocks-filters/responsive-settings/settings/container/panel.tsx +92 -0
- package/core-js/blocks-filters/responsive-settings/settings/spacing/index.ts +3 -0
- package/core-js/blocks-filters/responsive-settings/settings/spacing/panel.tsx +45 -0
- package/core-js/blocks-filters/responsive-settings/settings/spacing/properties.ts +74 -0
- package/core-js/blocks-filters/responsive-settings/settings/spacing/settings.tsx +85 -0
- package/core-js/blocks-filters/responsive-settings/types/index.ts +68 -0
- package/core-js/blocks-filters/responsive-settings/utils.ts +321 -0
- package/core-js/blocks-utils/_use-block-parent.ts +27 -0
- package/core-js/blocks-utils/_use-post-types.ts +43 -0
- package/core-js/blocks-utils/_use-taxonomies.ts +29 -0
- package/core-js/blocks-utils/index.ts +3 -0
- package/core-js/config/webentor-config.ts +718 -0
- package/core-js/index.ts +14 -0
- package/core-js/types/_block-components.ts +7 -0
- package/core-js/types/_webentor-config.ts +182 -0
- package/package.json +98 -0
- package/resources/blocks/e-accordion/block.json +34 -0
- package/resources/blocks/e-accordion/e-accordion.block.tsx +125 -0
- package/resources/blocks/e-accordion/script.ts +1 -0
- package/resources/blocks/e-accordion/style.css +8 -0
- package/resources/blocks/e-accordion-group/block.json +56 -0
- package/resources/blocks/e-accordion-group/e-accordion-group.block.tsx +99 -0
- package/resources/blocks/e-breadcrumbs/block.json +41 -0
- package/resources/blocks/e-breadcrumbs/e-breadcrumbs.block.tsx +53 -0
- package/resources/blocks/e-button/block.json +32 -0
- package/resources/blocks/e-button/e-button.block.tsx +55 -0
- package/resources/blocks/e-gallery/block.json +90 -0
- package/resources/blocks/e-gallery/e-gallery.block.tsx +316 -0
- package/resources/blocks/e-icon-picker/block.json +37 -0
- package/resources/blocks/e-icon-picker/e-icon-picker.block.tsx +230 -0
- package/resources/blocks/e-icon-picker/style.css +17 -0
- package/resources/blocks/e-image/block.json +78 -0
- package/resources/blocks/e-image/e-image.block.tsx +331 -0
- package/resources/blocks/e-picker-query-loop/block.json +25 -0
- package/resources/blocks/e-picker-query-loop/e-picker-query-loop.block.tsx +189 -0
- package/resources/blocks/e-post-template/block.json +25 -0
- package/resources/blocks/e-post-template/e-post-template.block.tsx +100 -0
- package/resources/blocks/e-query-loop/block.json +36 -0
- package/resources/blocks/e-query-loop/constants.tsx +8 -0
- package/resources/blocks/e-query-loop/e-query-loop.block.tsx +270 -0
- package/resources/blocks/e-query-loop/taxonomy-controls.tsx +184 -0
- package/resources/blocks/e-slider/block.json +42 -0
- package/resources/blocks/e-slider/e-slider.block.tsx +100 -0
- package/resources/blocks/e-svg/block.json +37 -0
- package/resources/blocks/e-svg/e-svg.block.tsx +156 -0
- package/resources/blocks/e-tab-container/block.json +49 -0
- package/resources/blocks/e-tab-container/e-tab-container.block.tsx +123 -0
- package/resources/blocks/e-table/block.json +30 -0
- package/resources/blocks/e-table/e-table.block.tsx +120 -0
- package/resources/blocks/e-table/script.ts +48 -0
- package/resources/blocks/e-table-cell/block.json +40 -0
- package/resources/blocks/e-table-cell/e-table-cell.block.tsx +180 -0
- package/resources/blocks/e-table-row/block.json +28 -0
- package/resources/blocks/e-table-row/e-table-row.block.tsx +118 -0
- package/resources/blocks/e-tabs/block.json +27 -0
- package/resources/blocks/e-tabs/e-tabs.block.tsx +90 -0
- package/resources/blocks/l-404/block.json +51 -0
- package/resources/blocks/l-404/l-404.block.tsx +75 -0
- package/resources/blocks/l-flexible-container/block.json +34 -0
- package/resources/blocks/l-flexible-container/l-flexible-container.block.tsx +97 -0
- package/resources/blocks/l-footer/block.json +23 -0
- package/resources/blocks/l-footer/l-footer.block.tsx +51 -0
- package/resources/blocks/l-formatted-content/block.json +28 -0
- package/resources/blocks/l-formatted-content/l-formatted-content.block.tsx +97 -0
- package/resources/blocks/l-header/block.json +26 -0
- package/resources/blocks/l-header/l-header.block.tsx +100 -0
- package/resources/blocks/l-mobile-nav/block.json +15 -0
- package/resources/blocks/l-mobile-nav/l-mobile-nav.block.tsx +56 -0
- package/resources/blocks/l-mobile-nav/style.css +54 -0
- package/resources/blocks/l-nav-menu/block.json +27 -0
- package/resources/blocks/l-nav-menu/l-nav-menu.block.tsx +109 -0
- package/resources/blocks/l-nav-menu/style.css +134 -0
- package/resources/blocks/l-post-card/block.json +13 -0
- package/resources/blocks/l-post-card/l-post-card.block.tsx +52 -0
- package/resources/blocks/l-section/block.json +89 -0
- package/resources/blocks/l-section/l-section.block.tsx +316 -0
- package/resources/blocks/l-site-logo/block.json +15 -0
- package/resources/blocks/l-site-logo/l-site-logo.block.tsx +54 -0
- package/resources/core-components/slider/slider.script.ts +11 -0
- package/resources/core-components/slider/slider.style.css +134 -0
- package/resources/scripts/editor.ts +29 -0
- package/resources/styles/app.css +21 -0
- package/resources/styles/common/_editor.css +86 -0
- package/resources/styles/common/_form.css +83 -0
- package/resources/styles/common/_global.css +73 -0
- package/resources/styles/common/_theme.css +75 -0
- package/resources/styles/common/_utilities.css +33 -0
- package/resources/styles/common/_wordpress.css +110 -0
- package/resources/styles/components/_table.css +102 -0
- package/resources/styles/editor.css +16 -0
- package/resources/styles/partials/.gitkeep +0 -0
- package/resources/styles/partials/_header.css +21 -0
- package/resources/styles/partials/_pagination.css +35 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InnerBlocks,
|
|
3
|
+
InspectorControls,
|
|
4
|
+
MediaUpload,
|
|
5
|
+
MediaUploadCheck,
|
|
6
|
+
useBlockProps,
|
|
7
|
+
useInnerBlocksProps,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
9
|
+
import {
|
|
10
|
+
BlockEditProps,
|
|
11
|
+
registerBlockType,
|
|
12
|
+
TemplateArray,
|
|
13
|
+
} from '@wordpress/blocks';
|
|
14
|
+
import { Button, PanelBody, PanelRow } from '@wordpress/components';
|
|
15
|
+
import { applyFilters } from '@wordpress/hooks';
|
|
16
|
+
import { __ } from '@wordpress/i18n';
|
|
17
|
+
|
|
18
|
+
import { setImmutably } from '@webentorCore/_utils';
|
|
19
|
+
import {
|
|
20
|
+
CustomImageSizesPanel,
|
|
21
|
+
WebentorBlockAppender,
|
|
22
|
+
} from '@webentorCore/blocks-components';
|
|
23
|
+
import { useBlockParent } from '@webentorCore/blocks-utils/_use-block-parent';
|
|
24
|
+
|
|
25
|
+
import block from './block.json';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Edit component.
|
|
29
|
+
* See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
|
|
30
|
+
*
|
|
31
|
+
* @param {object} props The block props.
|
|
32
|
+
* @returns {Function} Render the edit screen
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
type AttributesType = {
|
|
36
|
+
coverImage: string;
|
|
37
|
+
template?: TemplateArray;
|
|
38
|
+
img?: { id: number; url: string; alt: string };
|
|
39
|
+
mobileImg?: { id: number; url: string; alt: string };
|
|
40
|
+
imgSize?: {
|
|
41
|
+
height: {
|
|
42
|
+
[key: string]: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
|
|
48
|
+
const { attributes, setAttributes, isSelected } = props;
|
|
49
|
+
|
|
50
|
+
const blockProps = useBlockProps();
|
|
51
|
+
const parentBlockProps = useBlockParent();
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Filter allowed blocks used in webentor/l-section inner block
|
|
55
|
+
*/
|
|
56
|
+
const allowedBlocks: string[] = applyFilters(
|
|
57
|
+
'webentor.core.l-section.allowedBlocks',
|
|
58
|
+
null,
|
|
59
|
+
blockProps,
|
|
60
|
+
parentBlockProps,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Filter template used in webentor/l-section inner block
|
|
65
|
+
*/
|
|
66
|
+
const defaultTemplate: TemplateArray = attributes?.template ?? [];
|
|
67
|
+
const template: TemplateArray = applyFilters(
|
|
68
|
+
'webentor.core.l-section.template',
|
|
69
|
+
defaultTemplate,
|
|
70
|
+
blockProps,
|
|
71
|
+
parentBlockProps,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const { children, ...innerBlocksProps } = useInnerBlocksProps(
|
|
75
|
+
{},
|
|
76
|
+
{
|
|
77
|
+
allowedBlocks,
|
|
78
|
+
template,
|
|
79
|
+
renderAppender: false, // Disable default appender
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// Preview image for block inserter
|
|
84
|
+
if (attributes.coverImage) {
|
|
85
|
+
return <img src={attributes.coverImage} width="468" />;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const hasInnerBlocks = children && React.Children.count(children) > 0;
|
|
89
|
+
|
|
90
|
+
const onSelectImage = (media) => {
|
|
91
|
+
setAttributes({
|
|
92
|
+
img: { id: media.id, url: media.url, alt: media.alt },
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const removeImage = () => {
|
|
97
|
+
setAttributes({ img: null });
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const onSelectMobileImage = (media) => {
|
|
101
|
+
setAttributes({
|
|
102
|
+
mobileImg: { id: media.id, url: media.url, alt: media.alt },
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const removeMobileImage = () => {
|
|
107
|
+
setAttributes({ mobileImg: null });
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const handleEnabledChange = (enabled: boolean, breakpoint: string) => {
|
|
111
|
+
// Set custom size enabled/disabled
|
|
112
|
+
// For some reason, this doesn't work with setImmutably
|
|
113
|
+
setAttributes({
|
|
114
|
+
imgSize: {
|
|
115
|
+
...attributes?.imgSize,
|
|
116
|
+
enabled: {
|
|
117
|
+
...attributes?.imgSize?.enabled,
|
|
118
|
+
[breakpoint]: enabled,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const handleHeightChange = (height: number, breakpoint: string) => {
|
|
125
|
+
setAttributes(
|
|
126
|
+
setImmutably(attributes, ['imgSize', 'height', breakpoint], height),
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const handleCropChange = (crop: boolean, breakpoint: string) => {
|
|
131
|
+
setAttributes(
|
|
132
|
+
setImmutably(attributes, ['imgSize', 'crop', breakpoint], crop),
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<>
|
|
138
|
+
<InspectorControls>
|
|
139
|
+
<PanelBody title="Background Image Settings" initialOpen={false}>
|
|
140
|
+
<PanelRow>
|
|
141
|
+
<div className="wbtr:flex wbtr:flex-col">
|
|
142
|
+
<p className="wbtr:mb-2 wbtr:uppercase">
|
|
143
|
+
{__('Desktop Image', 'webentor')}
|
|
144
|
+
</p>
|
|
145
|
+
<MediaUploadCheck>
|
|
146
|
+
<MediaUpload
|
|
147
|
+
onSelect={onSelectImage}
|
|
148
|
+
allowedTypes={['image']}
|
|
149
|
+
value={attributes?.img?.id}
|
|
150
|
+
render={({ open }) => (
|
|
151
|
+
<Button
|
|
152
|
+
onClick={open}
|
|
153
|
+
className={
|
|
154
|
+
attributes?.img?.id
|
|
155
|
+
? 'wbtr:h-fit! wbtr:w-fit! wbtr:p-0!'
|
|
156
|
+
: ''
|
|
157
|
+
}
|
|
158
|
+
variant={attributes?.img?.id ? undefined : 'secondary'}
|
|
159
|
+
>
|
|
160
|
+
{attributes?.img?.id ? (
|
|
161
|
+
<img
|
|
162
|
+
src={attributes.img.url}
|
|
163
|
+
alt={attributes.img?.alt}
|
|
164
|
+
width="100%"
|
|
165
|
+
/>
|
|
166
|
+
) : (
|
|
167
|
+
__('Select Desktop Image', 'webentor')
|
|
168
|
+
)}
|
|
169
|
+
</Button>
|
|
170
|
+
)}
|
|
171
|
+
/>
|
|
172
|
+
</MediaUploadCheck>
|
|
173
|
+
|
|
174
|
+
{attributes?.img?.id && (
|
|
175
|
+
<Button
|
|
176
|
+
onClick={removeImage}
|
|
177
|
+
className="wbtr:h-fit! wbtr:w-fit!"
|
|
178
|
+
variant="link"
|
|
179
|
+
isDestructive
|
|
180
|
+
>
|
|
181
|
+
{__('Remove Desktop Image', 'webentor')}
|
|
182
|
+
</Button>
|
|
183
|
+
)}
|
|
184
|
+
</div>
|
|
185
|
+
</PanelRow>
|
|
186
|
+
|
|
187
|
+
<PanelRow>
|
|
188
|
+
<div className="wbtr:flex wbtr:flex-col">
|
|
189
|
+
<p className="wbtr:mb-2 wbtr:uppercase">
|
|
190
|
+
{__('Mobile Image', 'webentor')}
|
|
191
|
+
</p>
|
|
192
|
+
<div className="wbtr:mb-2">
|
|
193
|
+
Used for devices up to 480px screen width.
|
|
194
|
+
</div>
|
|
195
|
+
<MediaUploadCheck>
|
|
196
|
+
<MediaUpload
|
|
197
|
+
onSelect={onSelectMobileImage}
|
|
198
|
+
allowedTypes={['image']}
|
|
199
|
+
value={attributes?.mobileImg?.id}
|
|
200
|
+
render={({ open }) => (
|
|
201
|
+
<Button
|
|
202
|
+
onClick={open}
|
|
203
|
+
className={
|
|
204
|
+
attributes?.mobileImg?.id
|
|
205
|
+
? 'wbtr:h-fit! wbtr:w-fit! wbtr:p-0!'
|
|
206
|
+
: ''
|
|
207
|
+
}
|
|
208
|
+
variant={
|
|
209
|
+
attributes?.mobileImg?.id ? undefined : 'secondary'
|
|
210
|
+
}
|
|
211
|
+
>
|
|
212
|
+
{attributes?.mobileImg?.id ? (
|
|
213
|
+
<img
|
|
214
|
+
src={attributes.mobileImg.url}
|
|
215
|
+
alt={attributes.mobileImg?.alt}
|
|
216
|
+
width="100%"
|
|
217
|
+
/>
|
|
218
|
+
) : (
|
|
219
|
+
__('Select Mobile Image', 'webentor')
|
|
220
|
+
)}
|
|
221
|
+
</Button>
|
|
222
|
+
)}
|
|
223
|
+
/>
|
|
224
|
+
</MediaUploadCheck>
|
|
225
|
+
|
|
226
|
+
{attributes?.mobileImg?.id && (
|
|
227
|
+
<Button
|
|
228
|
+
onClick={removeMobileImage}
|
|
229
|
+
className="wbtr:h-fit! wbtr:w-fit!"
|
|
230
|
+
variant="link"
|
|
231
|
+
isDestructive
|
|
232
|
+
>
|
|
233
|
+
{__('Remove Mobile Image', 'webentor')}
|
|
234
|
+
</Button>
|
|
235
|
+
)}
|
|
236
|
+
</div>
|
|
237
|
+
</PanelRow>
|
|
238
|
+
|
|
239
|
+
<PanelRow>
|
|
240
|
+
<CustomImageSizesPanel
|
|
241
|
+
attributes={attributes}
|
|
242
|
+
imgSizeAttribute="imgSize"
|
|
243
|
+
onEnabledChange={handleEnabledChange}
|
|
244
|
+
onHeightChange={handleHeightChange}
|
|
245
|
+
onCropChange={handleCropChange}
|
|
246
|
+
alwaysEnabled
|
|
247
|
+
hideWidth
|
|
248
|
+
noticeBefore={() => (
|
|
249
|
+
<>
|
|
250
|
+
<div>
|
|
251
|
+
Notice: This is not height used for the section/hero. Please
|
|
252
|
+
set section height <strong>Container Settings</strong>.{' '}
|
|
253
|
+
<br />
|
|
254
|
+
Image Height settings below are needed just so image can be
|
|
255
|
+
properly optimized, resized and cropped on frontend.
|
|
256
|
+
</div>
|
|
257
|
+
<br />
|
|
258
|
+
</>
|
|
259
|
+
)}
|
|
260
|
+
/>
|
|
261
|
+
</PanelRow>
|
|
262
|
+
</PanelBody>
|
|
263
|
+
</InspectorControls>
|
|
264
|
+
|
|
265
|
+
<div {...blockProps} className={`w-section ${blockProps.className}`}>
|
|
266
|
+
<div
|
|
267
|
+
{...innerBlocksProps}
|
|
268
|
+
className={`${innerBlocksProps.className} container wbtr:relative wbtr:z-[2] wbtr:flex wbtr:flex-col`}
|
|
269
|
+
>
|
|
270
|
+
{children}
|
|
271
|
+
|
|
272
|
+
{/* Only show appender if no inner blocks or if the block is selected */}
|
|
273
|
+
{(!hasInnerBlocks || isSelected) && (
|
|
274
|
+
<div className="wbtr:my-2 wbtr:flex wbtr:items-center wbtr:justify-center">
|
|
275
|
+
<WebentorBlockAppender
|
|
276
|
+
rootClientId={props.clientId}
|
|
277
|
+
text={__('Add Section Content', 'webentor')}
|
|
278
|
+
/>
|
|
279
|
+
</div>
|
|
280
|
+
)}
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
{attributes?.img?.id && (
|
|
284
|
+
<>
|
|
285
|
+
<div className="wbtr:absolute wbtr:inset-0 wbtr:z-[1] wbtr:bg-black wbtr:opacity-20"></div>
|
|
286
|
+
<img
|
|
287
|
+
src={attributes.img.url}
|
|
288
|
+
alt="banner-img"
|
|
289
|
+
className="wbtr:absolute wbtr:top-0 wbtr:left-0 wbtr:hidden wbtr:!h-full wbtr:!w-full wbtr:object-cover wbtr:md:block"
|
|
290
|
+
/>
|
|
291
|
+
<img
|
|
292
|
+
src={attributes.mobileImg?.url || attributes.img.url}
|
|
293
|
+
alt="banner-img"
|
|
294
|
+
className="wbtr:absolute wbtr:top-0 wbtr:left-0 wbtr:block wbtr:!h-full wbtr:!w-full wbtr:object-cover wbtr:md:hidden"
|
|
295
|
+
/>
|
|
296
|
+
</>
|
|
297
|
+
)}
|
|
298
|
+
</div>
|
|
299
|
+
</>
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
|
|
305
|
+
*
|
|
306
|
+
* @return {null} Dynamic blocks do not save the HTML.
|
|
307
|
+
*/
|
|
308
|
+
const BlockSave = () => <InnerBlocks.Content />;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Register block.
|
|
312
|
+
*/
|
|
313
|
+
registerBlockType(block, {
|
|
314
|
+
edit: BlockEdit,
|
|
315
|
+
save: BlockSave,
|
|
316
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../schemas/webentor-block.json",
|
|
3
|
+
"name": "webentor/l-site-logo",
|
|
4
|
+
"title": "Site Logo",
|
|
5
|
+
"description": "Website logo with link to homepage",
|
|
6
|
+
"category": "webentor-layout",
|
|
7
|
+
"icon": "admin-site-alt3",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"logo",
|
|
10
|
+
"site logo",
|
|
11
|
+
"website logo"
|
|
12
|
+
],
|
|
13
|
+
"attributes": {},
|
|
14
|
+
"supports": {}
|
|
15
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useBlockProps } from '@wordpress/block-editor';
|
|
2
|
+
import { BlockEditProps, registerBlockType } from '@wordpress/blocks';
|
|
3
|
+
|
|
4
|
+
import block from './block.json';
|
|
5
|
+
|
|
6
|
+
// TODO: Add logo image?
|
|
7
|
+
// import Logo from '@images/svg/site-logo.svg';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Edit component.
|
|
11
|
+
* See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#edit
|
|
12
|
+
*
|
|
13
|
+
* @param {object} props The block props.
|
|
14
|
+
* @returns {Function} Render the edit screen
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
type AttributesType = {
|
|
18
|
+
coverImage: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
|
|
22
|
+
const { attributes } = props;
|
|
23
|
+
|
|
24
|
+
const blockProps = useBlockProps();
|
|
25
|
+
|
|
26
|
+
// Preview image for block inserter
|
|
27
|
+
if (attributes.coverImage) {
|
|
28
|
+
return <img src={attributes.coverImage} width="468" />;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<div {...blockProps} className={`${blockProps.className}`}>
|
|
34
|
+
Logo
|
|
35
|
+
{/* <img src={Logo} alt="Logo" className="mx-auto h-20 w-20" /> */}
|
|
36
|
+
</div>
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save
|
|
43
|
+
*
|
|
44
|
+
* @return {null} Dynamic blocks do not save the HTML.
|
|
45
|
+
*/
|
|
46
|
+
const BlockSave = () => null;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Register block.
|
|
50
|
+
*/
|
|
51
|
+
registerBlockType(block, {
|
|
52
|
+
edit: BlockEdit,
|
|
53
|
+
save: BlockSave,
|
|
54
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SliderComponent } from '@webentorCore/_slider';
|
|
2
|
+
|
|
3
|
+
// Add initialization code
|
|
4
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
5
|
+
document.querySelectorAll('.js-slider').forEach((element) => {
|
|
6
|
+
// Parse data-slider attribute to get params
|
|
7
|
+
const params = JSON.parse(element.getAttribute('data-slider') || '{}');
|
|
8
|
+
|
|
9
|
+
new SliderComponent(element, params);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
/** Plugins **/
|
|
3
|
+
@import 'swiper/css';
|
|
4
|
+
@import 'swiper/css/a11y';
|
|
5
|
+
@import 'swiper/css/navigation';
|
|
6
|
+
@import 'swiper/css/pagination';
|
|
7
|
+
@import 'swiper/css/effect-fade';
|
|
8
|
+
|
|
9
|
+
:root {
|
|
10
|
+
--slider-timer-progress: 0;
|
|
11
|
+
|
|
12
|
+
--slider-arrow-color: var(--color-gray-900);
|
|
13
|
+
--slider-arrow-color-inverted: var(--color-white);
|
|
14
|
+
--slider-arrow-height: 30px;
|
|
15
|
+
--slider-arrow-width: 30px;
|
|
16
|
+
|
|
17
|
+
--slider-pagination-color: var(--color-gray-900);
|
|
18
|
+
--slider-pagination-color-inverted: var(--color-white);
|
|
19
|
+
|
|
20
|
+
--slider-pagination-bullet-height: 8px;
|
|
21
|
+
--slider-pagination-bullet-width: 32px;
|
|
22
|
+
--slider-pagination-bullet-border-radius: var(--border-radius-full);
|
|
23
|
+
--slider-pagination-bullet-opacity: 0.4;
|
|
24
|
+
--slider-pagination-bullet-opacity-active: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.slider-enabled {
|
|
28
|
+
.swiper-container {
|
|
29
|
+
.swiper-wrapper {
|
|
30
|
+
/* Reset all flex properties to initial (default) values to avoid conflicts with Swiper slider and Gutenberg responsive settings for other breakpoints */
|
|
31
|
+
display: flex; /* Swiper slider must always be flex */
|
|
32
|
+
gap: 0;
|
|
33
|
+
flex-direction: initial;
|
|
34
|
+
justify-content: initial;
|
|
35
|
+
align-items: initial;
|
|
36
|
+
align-content: initial;
|
|
37
|
+
flex-wrap: initial;
|
|
38
|
+
flex-grow: initial;
|
|
39
|
+
flex-shrink: initial;
|
|
40
|
+
flex-basis: initial;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.slider-pagination {
|
|
45
|
+
.swiper-pagination-bullets {
|
|
46
|
+
display: flex;
|
|
47
|
+
|
|
48
|
+
&.swiper-pagination-lock {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.slider {
|
|
56
|
+
&.has-autoplay-control {
|
|
57
|
+
.swiper-pagination-bullets.swiper-pagination-horizontal {
|
|
58
|
+
width: auto;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.slider-autoplay-icon--play {
|
|
62
|
+
display: block;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&.is-playing .slider-autoplay-icon--play {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.slider-autoplay-icon--stop {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.is-playing .slider-autoplay-icon--stop {
|
|
74
|
+
display: block;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.slider-timer {
|
|
78
|
+
display: block;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.slider-timer-circle {
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: 0;
|
|
84
|
+
left: 0;
|
|
85
|
+
width: 100%;
|
|
86
|
+
height: 100%;
|
|
87
|
+
stroke-width: 4px;
|
|
88
|
+
stroke: currentcolor;
|
|
89
|
+
fill: none;
|
|
90
|
+
stroke-dashoffset: calc(125.6px * (1 - var(--slider-timer-progress)));
|
|
91
|
+
stroke-dasharray: 125.6; /* 2 * Math.PI * 20 */
|
|
92
|
+
transform: rotate(-90deg);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.slider-arrow-btn {
|
|
97
|
+
color: var(--slider-arrow-color);
|
|
98
|
+
width: var(--slider-arrow-width);
|
|
99
|
+
height: var(--slider-arrow-height);
|
|
100
|
+
|
|
101
|
+
&:hover {
|
|
102
|
+
opacity: 0.6;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.slider-pagination,
|
|
107
|
+
.slider-timer {
|
|
108
|
+
color: var(--slider-pagination-color);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.slider-pagination-bullet {
|
|
112
|
+
background-color: currentcolor;
|
|
113
|
+
opacity: var(--slider-pagination-bullet-opacity);
|
|
114
|
+
width: var(--slider-pagination-bullet-width);
|
|
115
|
+
height: var(--slider-pagination-bullet-height);
|
|
116
|
+
border-radius: var(--slider-pagination-bullet-border-radius);
|
|
117
|
+
|
|
118
|
+
&.is-active {
|
|
119
|
+
opacity: var(--slider-pagination-bullet-opacity-active);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&.has-darkmode {
|
|
124
|
+
.slider-arrow-btn {
|
|
125
|
+
color: var(--slider-arrow-color-inverted);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.slider-pagination,
|
|
129
|
+
.slider-timer {
|
|
130
|
+
color: var(--slider-pagination-color-inverted);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Import all core blocks
|
|
2
|
+
// TODO: maybe add filter to customize this list
|
|
3
|
+
import '@blocks/e-accordion/e-accordion.block';
|
|
4
|
+
import '@blocks/e-accordion-group/e-accordion-group.block';
|
|
5
|
+
import '@blocks/e-breadcrumbs/e-breadcrumbs.block';
|
|
6
|
+
import '@blocks/e-button/e-button.block';
|
|
7
|
+
import '@blocks/e-gallery/e-gallery.block';
|
|
8
|
+
import '@blocks/e-image/e-image.block';
|
|
9
|
+
import '@blocks/e-picker-query-loop/e-picker-query-loop.block';
|
|
10
|
+
import '@blocks/e-post-template/e-post-template.block';
|
|
11
|
+
import '@blocks/e-query-loop/e-query-loop.block';
|
|
12
|
+
import '@blocks/e-slider/e-slider.block';
|
|
13
|
+
import '@blocks/e-svg/e-svg.block';
|
|
14
|
+
import '@blocks/e-tab-container/e-tab-container.block';
|
|
15
|
+
import '@blocks/e-table/e-table.block';
|
|
16
|
+
import '@blocks/e-table-cell/e-table-cell.block';
|
|
17
|
+
import '@blocks/e-table-row/e-table-row.block';
|
|
18
|
+
import '@blocks/e-tabs/e-tabs.block';
|
|
19
|
+
import '@blocks/l-404/l-404.block';
|
|
20
|
+
import '@blocks/l-flexible-container/l-flexible-container.block';
|
|
21
|
+
import '@blocks/l-footer/l-footer.block';
|
|
22
|
+
import '@blocks/l-formatted-content/l-formatted-content.block';
|
|
23
|
+
import '@blocks/l-header/l-header.block';
|
|
24
|
+
import '@blocks/l-mobile-nav/l-mobile-nav.block';
|
|
25
|
+
import '@blocks/l-nav-menu/l-nav-menu.block';
|
|
26
|
+
import '@blocks/l-post-card/l-post-card.block';
|
|
27
|
+
import '@blocks/l-section/l-section.block';
|
|
28
|
+
import '@blocks/l-site-logo/l-site-logo.block';
|
|
29
|
+
import '@blocks/e-icon-picker/e-icon-picker.block';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@import 'tailwindcss' prefix(wbtr);
|
|
2
|
+
@source "../views/";
|
|
3
|
+
@source "../core-components/";
|
|
4
|
+
@source "../blocks/";
|
|
5
|
+
@source "../../app/";
|
|
6
|
+
|
|
7
|
+
/* Tailwind Config */
|
|
8
|
+
@import './common/_theme';
|
|
9
|
+
@import './common/_utilities';
|
|
10
|
+
|
|
11
|
+
/** Common **/
|
|
12
|
+
@import './common/_global';
|
|
13
|
+
@import './common/_wordpress';
|
|
14
|
+
@import './common/_form';
|
|
15
|
+
|
|
16
|
+
/** Components */
|
|
17
|
+
@import './components/_table';
|
|
18
|
+
|
|
19
|
+
/** Partials */
|
|
20
|
+
@import './partials/_header';
|
|
21
|
+
@import './partials/_pagination';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
.post-type-post .editor-styles-wrapper {
|
|
2
|
+
font-family: var(--font-primary), serif;
|
|
3
|
+
max-width: 900px;
|
|
4
|
+
width: 100%;
|
|
5
|
+
margin: 0 auto;
|
|
6
|
+
padding-left: 20px;
|
|
7
|
+
padding-right: 20px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.editor-styles-wrapper {
|
|
11
|
+
.has-primary-font-family {
|
|
12
|
+
font-family: var(--font-primary);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.has-heading-font-family {
|
|
16
|
+
font-family: var(--font-heading);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
ul {
|
|
20
|
+
list-style: outside;
|
|
21
|
+
margin-left: 24px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.w-link-settings {
|
|
26
|
+
.block-editor-link-control {
|
|
27
|
+
min-width: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.block-editor-url-input {
|
|
31
|
+
min-width: auto;
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 0 16px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.wp-block-post-title {
|
|
38
|
+
margin-bottom: 20px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Margins for the content, which is added right to the root container, e.g. on blogs */
|
|
42
|
+
.is-root-container {
|
|
43
|
+
> p,
|
|
44
|
+
> ul,
|
|
45
|
+
> ol,
|
|
46
|
+
> h1,
|
|
47
|
+
> h2,
|
|
48
|
+
> h3,
|
|
49
|
+
> h4,
|
|
50
|
+
> h5,
|
|
51
|
+
> h6,
|
|
52
|
+
> figure,
|
|
53
|
+
> .wp-block-embed,
|
|
54
|
+
> .wp-block-webentor-e-image {
|
|
55
|
+
margin-bottom: 20px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.wp-block-webentor-e-image {
|
|
60
|
+
img {
|
|
61
|
+
max-height: 100%;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Dirty fix for hiding empty typography panel, see https://github.com/WordPress/gutenberg/issues/61231 */
|
|
66
|
+
.typography-block-support-panel:has(
|
|
67
|
+
.components-tools-panel-header + :empty:last-child
|
|
68
|
+
) {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Fix responsive settings tabs */
|
|
73
|
+
.w-responsive-settings-tabs {
|
|
74
|
+
.components-tab-panel__tabs {
|
|
75
|
+
justify-content: space-between;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.components-tab-panel__tabs-item {
|
|
79
|
+
padding: 0 6px;
|
|
80
|
+
flex-shrink: 0;
|
|
81
|
+
|
|
82
|
+
&.is-active {
|
|
83
|
+
font-weight: bold;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|