@eightshift/frontend-libs-tailwind 1.4.8 → 2.0.0
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/CHANGELOG.md +20 -0
- package/bun.lockb +0 -0
- package/package.json +28 -35
- package/scripts/components/block-inserter.js +1 -1
- package/scripts/components/file-picker.js +17 -3
- package/scripts/components/picker-placeholder.js +5 -7
- package/scripts/components/server-side-render.js +1 -1
- package/scripts/components/settings/settings.js +21 -20
- package/blocks/init/assets/application-admin.js +0 -10
- package/blocks/init/assets/application.js +0 -13
- package/blocks/init/assets/fonts/fraunces-italic-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/fraunces-italic-latin.woff2 +0 -0
- package/blocks/init/assets/fonts/fraunces-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/fraunces-latin.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-italic-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-italic-latin.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-latin.woff2 +0 -0
- package/blocks/init/assets/images/index.js +0 -5
- package/blocks/init/assets/scripts/application-admin.js +0 -7
- package/blocks/init/assets/scripts/application.js +0 -3
- package/blocks/init/assets/scripts/theme-colors.js +0 -39
- package/blocks/init/assets/styles/application-admin.css +0 -6
- package/blocks/init/assets/styles/application.css +0 -3
- package/blocks/init/src/Blocks/assets/application-blocks-editor.js +0 -14
- package/blocks/init/src/Blocks/assets/application-blocks-frontend.js +0 -13
- package/blocks/init/src/Blocks/assets/application-blocks.js +0 -9
- package/blocks/init/src/Blocks/assets/scripts/application-blocks-editor.js +0 -65
- package/blocks/init/src/Blocks/assets/scripts/application-blocks-frontend.js +0 -24
- package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +0 -262
- package/blocks/init/src/Blocks/assets/scripts/shared.js +0 -25
- package/blocks/init/src/Blocks/assets/styles/application-blocks-editor.css +0 -15
- package/blocks/init/src/Blocks/assets/styles/application-blocks-frontend.css +0 -9
- package/blocks/init/src/Blocks/assets/styles/application-blocks.css +0 -1
- package/blocks/init/src/Blocks/assets/styles/editor/editor-overrides.css +0 -15
- package/blocks/init/src/Blocks/assets/styles/fonts.css +0 -90
- package/blocks/init/src/Blocks/assets/styles/tailwind.css +0 -30
- package/blocks/init/src/Blocks/components/admin-theme-options/admin-theme-options.php +0 -20
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/index.js +0 -36
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/pages/parts.js +0 -56
- package/blocks/init/src/Blocks/components/admin-theme-options/manifest.json +0 -5
- package/blocks/init/src/Blocks/components/button/assets/index.js +0 -22
- package/blocks/init/src/Blocks/components/button/button.php +0 -88
- package/blocks/init/src/Blocks/components/button/components/button-editor.js +0 -36
- package/blocks/init/src/Blocks/components/button/components/button-options.js +0 -134
- package/blocks/init/src/Blocks/components/button/manifest.json +0 -302
- package/blocks/init/src/Blocks/components/card/card.php +0 -42
- package/blocks/init/src/Blocks/components/card/components/card-editor.js +0 -43
- package/blocks/init/src/Blocks/components/card/components/card-options.js +0 -55
- package/blocks/init/src/Blocks/components/card/manifest.json +0 -111
- package/blocks/init/src/Blocks/components/head/head.php +0 -52
- package/blocks/init/src/Blocks/components/head/manifest.json +0 -17
- package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +0 -26
- package/blocks/init/src/Blocks/components/heading/components/heading-options.js +0 -62
- package/blocks/init/src/Blocks/components/heading/heading.php +0 -45
- package/blocks/init/src/Blocks/components/heading/manifest.json +0 -76
- package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +0 -42
- package/blocks/init/src/Blocks/components/hero/components/hero-options.js +0 -100
- package/blocks/init/src/Blocks/components/hero/hero.php +0 -45
- package/blocks/init/src/Blocks/components/hero/manifest.json +0 -96
- package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +0 -23
- package/blocks/init/src/Blocks/components/icon/components/icon-options.js +0 -65
- package/blocks/init/src/Blocks/components/icon/icon.php +0 -53
- package/blocks/init/src/Blocks/components/icon/manifest.json +0 -1238
- package/blocks/init/src/Blocks/components/image/components/image-editor.js +0 -64
- package/blocks/init/src/Blocks/components/image/components/image-options.js +0 -111
- package/blocks/init/src/Blocks/components/image/image.php +0 -68
- package/blocks/init/src/Blocks/components/image/manifest.json +0 -125
- package/blocks/init/src/Blocks/components/list/components/list-editor.js +0 -30
- package/blocks/init/src/Blocks/components/list/components/list-options.js +0 -62
- package/blocks/init/src/Blocks/components/list/list.php +0 -32
- package/blocks/init/src/Blocks/components/list/manifest.json +0 -127
- package/blocks/init/src/Blocks/components/load-more/assets/index.js +0 -19
- package/blocks/init/src/Blocks/components/load-more/assets/load-more.js +0 -146
- package/blocks/init/src/Blocks/components/load-more/components/load-more-editor.js +0 -14
- package/blocks/init/src/Blocks/components/load-more/components/load-more-options.js +0 -19
- package/blocks/init/src/Blocks/components/load-more/load-more.php +0 -47
- package/blocks/init/src/Blocks/components/load-more/manifest.json +0 -39
- package/blocks/init/src/Blocks/components/modal/assets/index.js +0 -27
- package/blocks/init/src/Blocks/components/modal/manifest.json +0 -48
- package/blocks/init/src/Blocks/components/modal/modal.php +0 -46
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +0 -38
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +0 -48
- package/blocks/init/src/Blocks/components/paragraph/manifest.json +0 -81
- package/blocks/init/src/Blocks/components/paragraph/paragraph.php +0 -33
- package/blocks/init/src/Blocks/components/post-header/manifest.json +0 -5
- package/blocks/init/src/Blocks/components/post-header/post-header.php +0 -24
- package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +0 -53
- package/blocks/init/src/Blocks/components/quote/components/quote-options.js +0 -29
- package/blocks/init/src/Blocks/components/quote/manifest.json +0 -47
- package/blocks/init/src/Blocks/components/quote/quote.php +0 -49
- package/blocks/init/src/Blocks/components/share/assets/index.js +0 -39
- package/blocks/init/src/Blocks/components/share/components/share-editor.js +0 -28
- package/blocks/init/src/Blocks/components/share/components/share-options.js +0 -112
- package/blocks/init/src/Blocks/components/share/manifest.json +0 -72
- package/blocks/init/src/Blocks/components/share/share.php +0 -69
- package/blocks/init/src/Blocks/components/tracking-before-body-end/manifest.json +0 -5
- package/blocks/init/src/Blocks/components/tracking-before-body-end/tracking-before-body-end.php +0 -9
- package/blocks/init/src/Blocks/components/tracking-head/manifest.json +0 -5
- package/blocks/init/src/Blocks/components/tracking-head/tracking-head.php +0 -9
- package/blocks/init/src/Blocks/components/video/components/video-editor.js +0 -74
- package/blocks/init/src/Blocks/components/video/components/video-options.js +0 -279
- package/blocks/init/src/Blocks/components/video/manifest.json +0 -120
- package/blocks/init/src/Blocks/components/video/video.php +0 -70
- package/blocks/init/src/Blocks/custom/accordion/accordion-block.js +0 -15
- package/blocks/init/src/Blocks/custom/accordion/accordion.php +0 -28
- package/blocks/init/src/Blocks/custom/accordion/assets/index.js +0 -37
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-editor.js +0 -22
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-options.js +0 -18
- package/blocks/init/src/Blocks/custom/accordion/manifest.json +0 -32
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item-block.js +0 -19
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +0 -46
- package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +0 -60
- package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +0 -69
- package/blocks/init/src/Blocks/custom/button/button-block.js +0 -13
- package/blocks/init/src/Blocks/custom/button/button.php +0 -11
- package/blocks/init/src/Blocks/custom/button/components/button-editor.js +0 -12
- package/blocks/init/src/Blocks/custom/button/components/button-options.js +0 -12
- package/blocks/init/src/Blocks/custom/button/manifest.json +0 -18
- package/blocks/init/src/Blocks/custom/card/card-block.js +0 -13
- package/blocks/init/src/Blocks/custom/card/card.php +0 -11
- package/blocks/init/src/Blocks/custom/card/components/card-editor.js +0 -12
- package/blocks/init/src/Blocks/custom/card/components/card-options.js +0 -15
- package/blocks/init/src/Blocks/custom/card/manifest.json +0 -18
- package/blocks/init/src/Blocks/custom/carousel/assets/index.js +0 -46
- package/blocks/init/src/Blocks/custom/carousel/assets/navigation.js +0 -31
- package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +0 -40
- package/blocks/init/src/Blocks/custom/carousel/carousel-block.js +0 -21
- package/blocks/init/src/Blocks/custom/carousel/carousel.php +0 -61
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +0 -25
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-options.js +0 -47
- package/blocks/init/src/Blocks/custom/carousel/manifest.json +0 -130
- package/blocks/init/src/Blocks/custom/column/column-block.js +0 -21
- package/blocks/init/src/Blocks/custom/column/column-hooks.js +0 -32
- package/blocks/init/src/Blocks/custom/column/column.php +0 -21
- package/blocks/init/src/Blocks/custom/column/components/column-editor.js +0 -22
- package/blocks/init/src/Blocks/custom/column/components/column-options.js +0 -580
- package/blocks/init/src/Blocks/custom/column/manifest.json +0 -625
- package/blocks/init/src/Blocks/custom/columns/columns-block.js +0 -20
- package/blocks/init/src/Blocks/custom/columns/columns.php +0 -21
- package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +0 -81
- package/blocks/init/src/Blocks/custom/columns/components/columns-options.js +0 -104
- package/blocks/init/src/Blocks/custom/columns/manifest.json +0 -581
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +0 -28
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +0 -248
- package/blocks/init/src/Blocks/custom/featured-content/featured-content-block.js +0 -13
- package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +0 -139
- package/blocks/init/src/Blocks/custom/featured-content/manifest.json +0 -131
- package/blocks/init/src/Blocks/custom/featured-content/partials/cards.php +0 -39
- package/blocks/init/src/Blocks/custom/group/components/group-editor.js +0 -6
- package/blocks/init/src/Blocks/custom/group/group-block.js +0 -14
- package/blocks/init/src/Blocks/custom/group/group.php +0 -10
- package/blocks/init/src/Blocks/custom/group/manifest.json +0 -32
- package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +0 -15
- package/blocks/init/src/Blocks/custom/heading/components/heading-options.js +0 -38
- package/blocks/init/src/Blocks/custom/heading/heading-block.js +0 -13
- package/blocks/init/src/Blocks/custom/heading/heading-transforms.js +0 -26
- package/blocks/init/src/Blocks/custom/heading/heading.php +0 -15
- package/blocks/init/src/Blocks/custom/heading/manifest.json +0 -79
- package/blocks/init/src/Blocks/custom/hero/components/hero-editor.js +0 -12
- package/blocks/init/src/Blocks/custom/hero/components/hero-options.js +0 -14
- package/blocks/init/src/Blocks/custom/hero/hero-block.js +0 -13
- package/blocks/init/src/Blocks/custom/hero/hero.php +0 -11
- package/blocks/init/src/Blocks/custom/hero/manifest.json +0 -17
- package/blocks/init/src/Blocks/custom/image/components/image-editor.js +0 -12
- package/blocks/init/src/Blocks/custom/image/components/image-options.js +0 -14
- package/blocks/init/src/Blocks/custom/image/image-block.js +0 -13
- package/blocks/init/src/Blocks/custom/image/image.php +0 -11
- package/blocks/init/src/Blocks/custom/image/manifest.json +0 -33
- package/blocks/init/src/Blocks/custom/list/components/list-editor.js +0 -14
- package/blocks/init/src/Blocks/custom/list/components/list-options.js +0 -39
- package/blocks/init/src/Blocks/custom/list/list-block.js +0 -13
- package/blocks/init/src/Blocks/custom/list/list.php +0 -15
- package/blocks/init/src/Blocks/custom/list/manifest.json +0 -58
- package/blocks/init/src/Blocks/custom/map/assets/index.js +0 -20
- package/blocks/init/src/Blocks/custom/map/assets/map-controller.js +0 -41
- package/blocks/init/src/Blocks/custom/map/assets/utils.js +0 -161
- package/blocks/init/src/Blocks/custom/map/components/map-components.js +0 -403
- package/blocks/init/src/Blocks/custom/map/components/map-editor.js +0 -56
- package/blocks/init/src/Blocks/custom/map/components/map-options.js +0 -550
- package/blocks/init/src/Blocks/custom/map/manifest.json +0 -79
- package/blocks/init/src/Blocks/custom/map/map-block.js +0 -13
- package/blocks/init/src/Blocks/custom/map/map.php +0 -52
- package/blocks/init/src/Blocks/custom/map/styles.css +0 -2
- package/blocks/init/src/Blocks/custom/modal/components/modal-editor.js +0 -90
- package/blocks/init/src/Blocks/custom/modal/manifest.json +0 -51
- package/blocks/init/src/Blocks/custom/modal/modal-block.js +0 -14
- package/blocks/init/src/Blocks/custom/modal/modal.php +0 -20
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +0 -17
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-options.js +0 -38
- package/blocks/init/src/Blocks/custom/paragraph/manifest.json +0 -82
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-block.js +0 -13
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-transforms.js +0 -46
- package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +0 -15
- package/blocks/init/src/Blocks/custom/quote/components/quote-editor.js +0 -12
- package/blocks/init/src/Blocks/custom/quote/components/quote-options.js +0 -14
- package/blocks/init/src/Blocks/custom/quote/manifest.json +0 -17
- package/blocks/init/src/Blocks/custom/quote/quote-block.js +0 -13
- package/blocks/init/src/Blocks/custom/quote/quote.php +0 -13
- package/blocks/init/src/Blocks/custom/share/components/share-editor.js +0 -6
- package/blocks/init/src/Blocks/custom/share/components/share-options.js +0 -12
- package/blocks/init/src/Blocks/custom/share/manifest.json +0 -19
- package/blocks/init/src/Blocks/custom/share/share-block.js +0 -13
- package/blocks/init/src/Blocks/custom/share/share.php +0 -11
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +0 -57
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +0 -106
- package/blocks/init/src/Blocks/custom/site-footer/manifest.json +0 -73
- package/blocks/init/src/Blocks/custom/site-footer/site-footer-block.js +0 -13
- package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +0 -74
- package/blocks/init/src/Blocks/custom/site-navigation/assets/index.js +0 -9
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +0 -42
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-options.js +0 -73
- package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +0 -77
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation-block.js +0 -13
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +0 -99
- package/blocks/init/src/Blocks/custom/table-of-contents/assets/index.js +0 -58
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +0 -38
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-options.js +0 -32
- package/blocks/init/src/Blocks/custom/table-of-contents/manifest.json +0 -48
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents-block.js +0 -13
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +0 -31
- package/blocks/init/src/Blocks/custom/video/components/video-editor.js +0 -6
- package/blocks/init/src/Blocks/custom/video/components/video-options.js +0 -12
- package/blocks/init/src/Blocks/custom/video/manifest.json +0 -29
- package/blocks/init/src/Blocks/custom/video/video-block.js +0 -13
- package/blocks/init/src/Blocks/custom/video/video.php +0 -22
- package/blocks/init/src/Blocks/manifest.json +0 -32
- package/blocks/init/src/Blocks/variations/card-simple/manifest.json +0 -17
- package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +0 -12
- package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +0 -364
- package/blocks/init/src/Blocks/wrapper/manifest.json +0 -459
- package/blocks/init/src/Blocks/wrapper/styles-editor.css +0 -13
- package/blocks/init/src/Blocks/wrapper/styles.css +0 -19
- package/blocks/init/src/Blocks/wrapper/wrapper.js +0 -27
- package/blocks/init/src/Blocks/wrapper/wrapper.php +0 -34
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { checkAttr, getAttrKey } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
-
import { ComponentToggle, Toggle } from '@eightshift/ui-components';
|
|
4
|
-
import { icons, JsxSvg } from '@eightshift/ui-components/icons';
|
|
5
|
-
import manifest from './../manifest.json';
|
|
6
|
-
|
|
7
|
-
export const QuoteOptions = (attributes) => {
|
|
8
|
-
const { setAttributes, ...rest } = attributes;
|
|
9
|
-
|
|
10
|
-
const quoteUse = checkAttr('quoteUse', attributes, manifest);
|
|
11
|
-
const quoteShowIcon = checkAttr('quoteShowIcon', attributes, manifest);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<ComponentToggle
|
|
15
|
-
label={manifest.title}
|
|
16
|
-
icon={icons.paragraph}
|
|
17
|
-
onChange={(value) => setAttributes({ [getAttrKey('quoteUse', attributes, manifest)]: value })}
|
|
18
|
-
useComponent={quoteUse}
|
|
19
|
-
{...rest}
|
|
20
|
-
>
|
|
21
|
-
<Toggle
|
|
22
|
-
icon={<JsxSvg svg={manifest.resources.quoteIcon} />}
|
|
23
|
-
label={__('Icon', '%g_textdomain%')}
|
|
24
|
-
checked={quoteShowIcon}
|
|
25
|
-
onChange={(value) => setAttributes({ [getAttrKey('quoteShowIcon', attributes, manifest)]: value })}
|
|
26
|
-
/>
|
|
27
|
-
</ComponentToggle>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
-
"componentName": "quote",
|
|
4
|
-
"title": "Quote",
|
|
5
|
-
"componentClass": "quote",
|
|
6
|
-
"example": {
|
|
7
|
-
"attributes": {
|
|
8
|
-
"quoteUse": true
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"attributes": {
|
|
12
|
-
"quoteUse": {
|
|
13
|
-
"type": "boolean",
|
|
14
|
-
"default": true
|
|
15
|
-
},
|
|
16
|
-
"quoteShowIcon": {
|
|
17
|
-
"type": "boolean",
|
|
18
|
-
"default": "true"
|
|
19
|
-
},
|
|
20
|
-
"quoteText": {
|
|
21
|
-
"type": "string"
|
|
22
|
-
},
|
|
23
|
-
"quoteAuthor": {
|
|
24
|
-
"type": "string"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"resources": {
|
|
28
|
-
"quoteIcon": "<svg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36' fill='none'><path d='M27.058 17.98c-2.467 0-4.343-.569-5.628-1.705-1.259-1.162-1.888-2.698-1.888-4.61 0-2.117.77-3.834 2.312-5.15C23.396 5.17 25.246 4.5 27.404 4.5c2.493 0 4.549.84 6.168 2.518C35.19 8.696 36 11.188 36 14.493c0 2.944-.527 5.578-1.58 7.902-1.054 2.298-2.519 4.21-4.394 5.733-1.85 1.523-3.983 2.582-6.399 3.176-.925.232-1.657.258-2.197.077-.514-.206-.848-.568-1.002-1.084-.128-.49-.038-.956.27-1.395.334-.439.964-.826 1.889-1.162 1.721-.62 3.135-1.394 4.24-2.324 1.13-.93 1.965-1.91 2.505-2.943.565-1.06.848-2.027.848-2.905 0-.491-.142-.879-.424-1.163-.257-.284-.745-.426-1.465-.426h-1.233Zm-19.58.038c-2.467 0-4.33-.568-5.59-1.704C.63 15.152 0 13.602 0 11.666 0 9.548.758 7.83 2.274 6.514 3.816 5.171 5.666 4.5 7.824 4.5c2.519 0 4.574.84 6.167 2.518 1.62 1.678 2.429 4.17 2.429 7.475 0 2.944-.527 5.578-1.58 7.902-1.054 2.324-2.506 4.248-4.356 5.771-1.85 1.524-3.983 2.57-6.398 3.138-.951.232-1.683.258-2.197.077-.514-.206-.848-.568-1.002-1.084-.129-.465-.039-.917.27-1.356.333-.465.95-.865 1.85-1.2 1.721-.62 3.134-1.395 4.24-2.325 1.13-.93 1.965-1.91 2.505-2.943.565-1.033.848-2.002.848-2.905 0-.491-.142-.866-.424-1.124-.257-.284-.746-.426-1.465-.426H7.478Z' fill='currentColor'/></svg>"
|
|
29
|
-
},
|
|
30
|
-
"tailwind": {
|
|
31
|
-
"parts": {
|
|
32
|
-
"container": {
|
|
33
|
-
"twClasses": "pl-7 py-5 border-l-4 border-l-gray-300"
|
|
34
|
-
},
|
|
35
|
-
"quote-text": {
|
|
36
|
-
"twClasses": "text-gray-900 font-display ~text-4xl/6xl !leading-none italic text-balance max-w-prose tracking-tight"
|
|
37
|
-
},
|
|
38
|
-
"author": {
|
|
39
|
-
"twClasses": "font-sans text-sm text-gray-500 mt-4 font-light",
|
|
40
|
-
"twClassesEditorOnly": "inline-flex gap-1 font-sans text-sm text-gray-500 mt-2 font-light"
|
|
41
|
-
},
|
|
42
|
-
"icon": {
|
|
43
|
-
"twClasses": "ml-1 ~mb-3/4 pointer-events-none text-gray-400 size-6"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Quote component template.
|
|
5
|
-
*
|
|
6
|
-
* @package %g_namespace%
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
|
|
10
|
-
|
|
11
|
-
$manifest = Helpers::getManifestByDir(__DIR__);
|
|
12
|
-
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
13
|
-
|
|
14
|
-
$quoteUse = Helpers::checkAttr('quoteUse', $attributes, $manifest);
|
|
15
|
-
|
|
16
|
-
if (!$quoteUse) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
$quoteText = Helpers::checkAttr('quoteText', $attributes, $manifest);
|
|
21
|
-
$quoteAuthor = Helpers::checkAttr('quoteAuthor', $attributes, $manifest);
|
|
22
|
-
$quoteShowIcon = Helpers::checkAttr('quoteShowIcon', $attributes, $manifest);
|
|
23
|
-
|
|
24
|
-
$iconClass = Helpers::tailwindClasses('icon', $attributes, $manifest);
|
|
25
|
-
|
|
26
|
-
$icon = $manifest['resources']['quoteIcon'];
|
|
27
|
-
$icon = str_replace('<svg', '<svg class="' . $iconClass . '"', $icon);
|
|
28
|
-
$icon = str_replace('<svg', '<svg aria-hidden="true"', $icon);
|
|
29
|
-
?>
|
|
30
|
-
|
|
31
|
-
<figure class="<?php echo esc_attr(Helpers::tailwindClasses('container', $attributes, $manifest, $additionalClass)); ?>">
|
|
32
|
-
<?php
|
|
33
|
-
if ($quoteShowIcon) {
|
|
34
|
-
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
35
|
-
echo $icon;
|
|
36
|
-
}
|
|
37
|
-
?>
|
|
38
|
-
|
|
39
|
-
<blockquote class="<?php echo esc_attr(Helpers::tailwindClasses('quote-text', $attributes, $manifest)); ?>">
|
|
40
|
-
<?php echo wp_kses_post($quoteText); ?>
|
|
41
|
-
</blockquote>
|
|
42
|
-
|
|
43
|
-
<?php if (!empty($quoteAuthor)) { ?>
|
|
44
|
-
<figcaption class="<?php echo esc_attr(Helpers::tailwindClasses('author', $attributes, $manifest)); ?>">
|
|
45
|
-
—
|
|
46
|
-
<?php echo wp_kses_post($quoteAuthor); ?>
|
|
47
|
-
</figcaption>
|
|
48
|
-
<?php } ?>
|
|
49
|
-
</figure>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import domReady from '@wordpress/dom-ready';
|
|
2
|
-
import manifest from '../manifest.json';
|
|
3
|
-
|
|
4
|
-
domReady(async () => {
|
|
5
|
-
const shareTargets = document.querySelectorAll(`.${manifest.componentJsClass}[data-mode='share']`);
|
|
6
|
-
|
|
7
|
-
if (shareTargets.length < 1) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const openShareDialog = async ({ shareUrl, pageUrl, pageTitle }) => {
|
|
12
|
-
const navigatorShareData = {
|
|
13
|
-
title: pageTitle,
|
|
14
|
-
url: pageUrl,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
if ('share' in navigator && navigator?.canShare(navigatorShareData)) {
|
|
18
|
-
await navigator?.share(navigatorShareData);
|
|
19
|
-
} else {
|
|
20
|
-
window.open(
|
|
21
|
-
shareUrl,
|
|
22
|
-
'share-post',
|
|
23
|
-
'height=600,width=800,left=0,top=0,location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1',
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
shareTargets.forEach((element) => {
|
|
29
|
-
element.querySelectorAll(`.${manifest.componentJsClass}-link`).forEach((link) => {
|
|
30
|
-
link.addEventListener('click', () => {
|
|
31
|
-
openShareDialog({
|
|
32
|
-
shareUrl: link?.dataset?.shareUrl ?? '',
|
|
33
|
-
pageUrl: link?.dataset?.pageUrl ?? '',
|
|
34
|
-
pageTitle: link?.dataset?.pageTitle ?? '',
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { checkAttr, classnames, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
|
-
import { JsxSvg } from '@eightshift/ui-components/icons';
|
|
3
|
-
import manifest from '../manifest.json';
|
|
4
|
-
|
|
5
|
-
export const ShareEditor = (attributes) => {
|
|
6
|
-
const { additionalClass } = attributes;
|
|
7
|
-
|
|
8
|
-
const shareUse = checkAttr('shareUse', attributes, manifest);
|
|
9
|
-
|
|
10
|
-
if (!shareUse) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const shareTargets = checkAttr('shareTargets', attributes, manifest);
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div className={tailwindClasses('container', attributes, manifest, additionalClass)}>
|
|
18
|
-
{shareTargets.map((network) => {
|
|
19
|
-
return (
|
|
20
|
-
<JsxSvg
|
|
21
|
-
className={tailwindClasses('icon', attributes, manifest)}
|
|
22
|
-
svg={manifest?.networks?.[network]?.icon}
|
|
23
|
-
/>
|
|
24
|
-
);
|
|
25
|
-
})}
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { checkAttr, getAttrKey, getHiddenOptions } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
-
import manifest from '../manifest.json';
|
|
4
|
-
import {
|
|
5
|
-
ComponentToggle,
|
|
6
|
-
OptionSelect,
|
|
7
|
-
DraggableList,
|
|
8
|
-
DraggableListItem,
|
|
9
|
-
Spacer,
|
|
10
|
-
Switch,
|
|
11
|
-
} from '@eightshift/ui-components';
|
|
12
|
-
import { icons, JsxSvg } from '@eightshift/ui-components/icons';
|
|
13
|
-
|
|
14
|
-
export const ShareOptions = (attributes) => {
|
|
15
|
-
const { hideOptions, setAttributes, ...rest } = attributes;
|
|
16
|
-
|
|
17
|
-
const hiddenOptions = getHiddenOptions(hideOptions);
|
|
18
|
-
|
|
19
|
-
const shareUse = checkAttr('shareUse', attributes, manifest);
|
|
20
|
-
|
|
21
|
-
const shareTargets = checkAttr('shareTargets', attributes, manifest);
|
|
22
|
-
const shareMode = checkAttr('shareMode', attributes, manifest);
|
|
23
|
-
|
|
24
|
-
const networksToShow = Object.entries(manifest.networks).reduce((current, [name, info]) => {
|
|
25
|
-
if (shareMode === 'share' && !info?.shareUrl) {
|
|
26
|
-
return current;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return [...current, { name: name, enabled: shareTargets.includes(name), ...info }];
|
|
30
|
-
}, []);
|
|
31
|
-
|
|
32
|
-
const modeOptions = [
|
|
33
|
-
{
|
|
34
|
-
label: __('Link to social networks', '%g_textdomain%'),
|
|
35
|
-
icon: icons.link,
|
|
36
|
-
value: 'links',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
label: __('Share the current URL', '%g_textdomain%'),
|
|
40
|
-
subtitle: __('Unavailable for some networks', '%g_textdomain%'),
|
|
41
|
-
icon: icons.share,
|
|
42
|
-
value: 'share',
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
const pickerSectionTitle = shareMode
|
|
47
|
-
? __('Share targets', '%g_textdomain%')
|
|
48
|
-
: __('Social networks', '%g_textdomain%');
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<ComponentToggle
|
|
52
|
-
label={manifest.title}
|
|
53
|
-
icon={icons.share}
|
|
54
|
-
onChange={(value) => setAttributes({ [getAttrKey('shareUse', attributes, manifest)]: value })}
|
|
55
|
-
useComponent={shareUse}
|
|
56
|
-
{...rest}
|
|
57
|
-
>
|
|
58
|
-
<OptionSelect
|
|
59
|
-
aria-label={__('Share mode', '%g_textdomain%')}
|
|
60
|
-
value={shareMode}
|
|
61
|
-
options={modeOptions}
|
|
62
|
-
onChange={(value) =>
|
|
63
|
-
setAttributes({
|
|
64
|
-
[getAttrKey('shareMode', attributes, manifest)]: value,
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
type='radiosSegmented'
|
|
68
|
-
hidden={hiddenOptions?.mode}
|
|
69
|
-
vertical
|
|
70
|
-
/>
|
|
71
|
-
|
|
72
|
-
<Spacer />
|
|
73
|
-
|
|
74
|
-
<DraggableList
|
|
75
|
-
icon={icons.globe}
|
|
76
|
-
label={pickerSectionTitle}
|
|
77
|
-
items={networksToShow}
|
|
78
|
-
onChange={(value) => {
|
|
79
|
-
const newValue = value.reduce((current, { name, enabled }) => {
|
|
80
|
-
if (!enabled) {
|
|
81
|
-
return current;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return [...current, name];
|
|
85
|
-
}, []);
|
|
86
|
-
|
|
87
|
-
setAttributes({ [getAttrKey('shareTargets', attributes, manifest)]: newValue });
|
|
88
|
-
}}
|
|
89
|
-
hidden={hiddenOptions?.networks}
|
|
90
|
-
key={shareMode}
|
|
91
|
-
>
|
|
92
|
-
{(item) => {
|
|
93
|
-
const { enabled, title, icon, updateData } = item;
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<DraggableListItem
|
|
97
|
-
icon={<JsxSvg svg={icon} />}
|
|
98
|
-
label={title}
|
|
99
|
-
>
|
|
100
|
-
<Switch
|
|
101
|
-
checked={enabled}
|
|
102
|
-
onChange={(value) => {
|
|
103
|
-
updateData({ enabled: value });
|
|
104
|
-
}}
|
|
105
|
-
/>
|
|
106
|
-
</DraggableListItem>
|
|
107
|
-
);
|
|
108
|
-
}}
|
|
109
|
-
</DraggableList>
|
|
110
|
-
</ComponentToggle>
|
|
111
|
-
);
|
|
112
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
-
"componentName": "share",
|
|
4
|
-
"title": "Share",
|
|
5
|
-
"componentClass": "share",
|
|
6
|
-
"componentJsClass": "js-share",
|
|
7
|
-
"example": {
|
|
8
|
-
"attributes": {
|
|
9
|
-
"shareUse": true
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"attributes": {
|
|
13
|
-
"shareTargets": {
|
|
14
|
-
"type": "array",
|
|
15
|
-
"default": [
|
|
16
|
-
"facebook",
|
|
17
|
-
"linkedin",
|
|
18
|
-
"youtube",
|
|
19
|
-
"instagram"
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
"shareMode": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"default": "links"
|
|
25
|
-
},
|
|
26
|
-
"shareUse": {
|
|
27
|
-
"type": "boolean",
|
|
28
|
-
"default": true
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"networks": {
|
|
32
|
-
"facebook": {
|
|
33
|
-
"url": "https://www.facebook.com/infinumcom",
|
|
34
|
-
"title": "Facebook",
|
|
35
|
-
"icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z' fill='currentColor'/></svg>",
|
|
36
|
-
"shareUrl": "https://www.facebook.com/sharer/sharer.php?u=POST_URL"
|
|
37
|
-
},
|
|
38
|
-
"x": {
|
|
39
|
-
"url": "https://x.com/infinum",
|
|
40
|
-
"title": "X (formerly Twitter)",
|
|
41
|
-
"icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z' fill='currentColor'/></svg>",
|
|
42
|
-
"shareUrl": "https://x.com/intent/post?url=POST_URL&text=POST_TITLE"
|
|
43
|
-
},
|
|
44
|
-
"linkedin": {
|
|
45
|
-
"url": "https://www.linkedin.com/company/infinum/",
|
|
46
|
-
"title": "LinkedIn",
|
|
47
|
-
"icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z' fill='currentColor'/></svg>",
|
|
48
|
-
"shareUrl": "https://www.linkedin.com/sharing/share-offsite/?url=POST_URL"
|
|
49
|
-
},
|
|
50
|
-
"youtube": {
|
|
51
|
-
"url": "https://www.youtube.com/channel/UCQV7qsvmrpe8IbCWZsv3Low",
|
|
52
|
-
"title": "YouTube",
|
|
53
|
-
"icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z' fill='currentColor'/></svg>"
|
|
54
|
-
},
|
|
55
|
-
"instagram": {
|
|
56
|
-
"url": "https://www.instagram.com/infinumcom/",
|
|
57
|
-
"title": "Instagram",
|
|
58
|
-
"icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M7.03.084c-1.277.06-2.149.264-2.91.563a5.874 5.874 0 0 0-2.124 1.388 5.878 5.878 0 0 0-1.38 2.127C.321 4.926.12 5.8.064 7.076.008 8.354-.005 8.764.001 12.023c.007 3.259.021 3.667.083 4.947.061 1.277.264 2.149.563 2.911.308.789.72 1.457 1.388 2.123a5.872 5.872 0 0 0 2.129 1.38c.763.295 1.636.496 2.913.552 1.278.056 1.689.069 4.947.063 3.257-.007 3.668-.021 4.947-.082 1.28-.06 2.147-.265 2.91-.563a5.881 5.881 0 0 0 2.123-1.388 5.881 5.881 0 0 0 1.38-2.129c.295-.763.496-1.636.551-2.912.056-1.28.07-1.69.063-4.948-.006-3.258-.02-3.667-.081-4.947-.06-1.28-.264-2.148-.564-2.911a5.892 5.892 0 0 0-1.387-2.123 5.857 5.857 0 0 0-2.128-1.38c-.764-.294-1.636-.496-2.914-.55C15.647.009 15.236-.006 11.977 0 8.718.008 8.31.021 7.03.084m.14 21.693c-1.17-.05-1.805-.245-2.228-.408a3.736 3.736 0 0 1-1.382-.895 3.695 3.695 0 0 1-.9-1.378c-.165-.423-.363-1.058-.417-2.228-.06-1.264-.072-1.644-.08-4.848-.006-3.204.006-3.583.061-4.848.05-1.169.246-1.805.408-2.228.216-.561.477-.96.895-1.382a3.705 3.705 0 0 1 1.379-.9c.423-.165 1.057-.361 2.227-.417 1.265-.06 1.644-.072 4.848-.08 3.203-.006 3.583.006 4.85.062 1.168.05 1.804.244 2.227.408.56.216.96.475 1.382.895.421.42.681.817.9 1.378.165.422.362 1.056.417 2.227.06 1.265.074 1.645.08 4.848.005 3.203-.006 3.583-.061 4.848-.051 1.17-.245 1.805-.408 2.23-.216.56-.477.96-.896 1.38a3.705 3.705 0 0 1-1.378.9c-.422.165-1.058.362-2.226.418-1.266.06-1.645.072-4.85.079-3.204.007-3.582-.006-4.848-.06m9.783-16.192a1.44 1.44 0 1 0 1.437-1.442 1.44 1.44 0 0 0-1.437 1.442M5.839 12.012a6.161 6.161 0 1 0 12.323-.024 6.162 6.162 0 0 0-12.323.024M8 12.008A4 4 0 1 1 12.008 16 4 4 0 0 1 8 12.008' fill='currentColor'/></svg>"
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"tailwind": {
|
|
62
|
-
"parts": {
|
|
63
|
-
"container": {
|
|
64
|
-
"twClasses": "flex items-center gap-2.5"
|
|
65
|
-
},
|
|
66
|
-
"icon": {
|
|
67
|
-
"twClasses": "text-gray-400 hover:text-gray-900 focus:outline-none focus-visible:text-navy-500 [&>svg]:size-5 transition",
|
|
68
|
-
"twClassesEditorOnly": "text-gray-400 size-5"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Share component template.
|
|
5
|
-
*
|
|
6
|
-
* @package %g_namespace%
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
|
|
10
|
-
|
|
11
|
-
$manifest = Helpers::getManifestByDir(__DIR__);
|
|
12
|
-
|
|
13
|
-
$shareUse = Helpers::checkAttr('shareUse', $attributes, $manifest);
|
|
14
|
-
|
|
15
|
-
if (!$shareUse) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
$shareTargets = Helpers::checkAttr('shareTargets', $attributes, $manifest);
|
|
20
|
-
$shareMode = Helpers::checkAttr('shareMode', $attributes, $manifest);
|
|
21
|
-
|
|
22
|
-
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
23
|
-
|
|
24
|
-
?>
|
|
25
|
-
<div
|
|
26
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('container', $attributes, $manifest, $additionalClass, $manifest['componentJsClass'])); ?>"
|
|
27
|
-
data-mode="<?php echo esc_attr($shareMode); ?>"
|
|
28
|
-
>
|
|
29
|
-
<?php
|
|
30
|
-
if ($shareMode === 'share') {
|
|
31
|
-
foreach ($shareTargets as $networkName) {
|
|
32
|
-
$shareUrl = $manifest['networks'][$networkName]['shareUrl'] ?? '';
|
|
33
|
-
$shareUrl = str_replace('POST_TITLE', get_the_title(), $shareUrl);
|
|
34
|
-
$shareUrl = str_replace('POST_URL', get_the_permalink(), $shareUrl);
|
|
35
|
-
$shareUrl = str_replace('POST_FEATURED_IMAGE', get_the_post_thumbnail_url(get_the_ID(), 'large'), $shareUrl);
|
|
36
|
-
?>
|
|
37
|
-
<button
|
|
38
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('icon', $attributes, $manifest, "{$manifest['componentJsClass']}-link")); ?>"
|
|
39
|
-
data-network="<?php echo esc_attr($networkName); ?>"
|
|
40
|
-
data-share-url="<?php echo esc_url($shareUrl); ?>"
|
|
41
|
-
data-page-title="<?php echo esc_attr(get_the_title()); ?>"
|
|
42
|
-
data-page-url="<?php echo esc_url(get_the_permalink()); ?>"
|
|
43
|
-
>
|
|
44
|
-
<?php
|
|
45
|
-
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
46
|
-
echo $manifest['networks'][$networkName]['icon'] ?? '';
|
|
47
|
-
?>
|
|
48
|
-
</button>
|
|
49
|
-
<?php }
|
|
50
|
-
} elseif ($shareMode === 'links') {
|
|
51
|
-
foreach ($shareTargets as $networkName) {
|
|
52
|
-
?>
|
|
53
|
-
<a
|
|
54
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('icon', $attributes, $manifest)); ?>"
|
|
55
|
-
href="<?php echo esc_url($manifest['networks'][$networkName]['url'] ?? ''); ?>"
|
|
56
|
-
title="<?php echo esc_attr($manifest['networks'][$networkName]['title'] ?? ''); ?>"
|
|
57
|
-
target="_blank"
|
|
58
|
-
rel="noreferrer noopener"
|
|
59
|
-
>
|
|
60
|
-
<?php
|
|
61
|
-
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
62
|
-
echo $manifest['networks'][$networkName]['icon'] ?? '';
|
|
63
|
-
?>
|
|
64
|
-
</a>
|
|
65
|
-
<?php
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
?>
|
|
69
|
-
</div>
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { ManageFileButton, checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
-
import { HStack, MediaPlaceholder, VStack } from '@eightshift/ui-components';
|
|
4
|
-
import { icons } from '@eightshift/ui-components/icons';
|
|
5
|
-
import manifest from '../manifest.json';
|
|
6
|
-
|
|
7
|
-
export const VideoEditor = (attributes) => {
|
|
8
|
-
const { setAttributes, additionalClass } = attributes;
|
|
9
|
-
|
|
10
|
-
const videoUse = checkAttr('videoUse', attributes, manifest);
|
|
11
|
-
const videoUrl = checkAttr('videoUrl', attributes, manifest);
|
|
12
|
-
|
|
13
|
-
if (!videoUse) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const hasVideo = videoUrl?.length > 0;
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<>
|
|
21
|
-
{!hasVideo && (
|
|
22
|
-
<MediaPlaceholder
|
|
23
|
-
style='simple'
|
|
24
|
-
size='video'
|
|
25
|
-
icon={icons.video}
|
|
26
|
-
helpText={
|
|
27
|
-
<VStack className='mt-2 text-center'>
|
|
28
|
-
{__('Add a video', 'eightshift-frontend-libs')}
|
|
29
|
-
|
|
30
|
-
<HStack>
|
|
31
|
-
<ManageFileButton
|
|
32
|
-
type='browse'
|
|
33
|
-
onChange={({ id, url, mime, mime_type }) =>
|
|
34
|
-
setAttributes({
|
|
35
|
-
[getAttrKey('videoId', attributes, manifest)]: id,
|
|
36
|
-
[getAttrKey('videoUrl', attributes, manifest)]: url,
|
|
37
|
-
[getAttrKey('videoMimeType', attributes, manifest)]:
|
|
38
|
-
typeof mime === 'undefined' ? mime_type : mime,
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
allowedTypes={manifest.allowedTypes}
|
|
42
|
-
kind='video'
|
|
43
|
-
/>
|
|
44
|
-
|
|
45
|
-
<ManageFileButton
|
|
46
|
-
type='upload'
|
|
47
|
-
onChange={({ id, url, mime, mime_type }) =>
|
|
48
|
-
setAttributes({
|
|
49
|
-
[getAttrKey('videoId', attributes, manifest)]: id,
|
|
50
|
-
[getAttrKey('videoUrl', attributes, manifest)]: url,
|
|
51
|
-
[getAttrKey('videoMimeType', attributes, manifest)]:
|
|
52
|
-
typeof mime === 'undefined' ? mime_type : mime,
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
allowedTypes={['video/mp4', 'video/webm']}
|
|
56
|
-
kind='video'
|
|
57
|
-
/>
|
|
58
|
-
</HStack>
|
|
59
|
-
</VStack>
|
|
60
|
-
}
|
|
61
|
-
/>
|
|
62
|
-
)}
|
|
63
|
-
|
|
64
|
-
{hasVideo && (
|
|
65
|
-
<video
|
|
66
|
-
className={tailwindClasses('video', attributes, manifest, additionalClass)}
|
|
67
|
-
src={videoUrl}
|
|
68
|
-
controls
|
|
69
|
-
muted
|
|
70
|
-
/>
|
|
71
|
-
)}
|
|
72
|
-
</>
|
|
73
|
-
);
|
|
74
|
-
};
|