@eightshift/frontend-libs-tailwind 1.5.0 → 2.0.1
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/.gitattributes +8 -30
- package/.github/workflows/ci.yml +2 -1
- package/CHANGELOG.md +29 -1
- package/bun.lock +1009 -0
- package/package.json +16 -26
- package/schemas/globalManifest.json +5 -0
- package/scripts/components/picker-placeholder.js +1 -1
- package/scripts/editor/colors.js +2 -2
- package/scripts/editor/options.js +1 -1
- package/scripts/editor/registration.js +4 -7
- package/scripts/editor/store.js +19 -0
- package/scripts/helpers/cookies.js +24 -16
- package/scripts/plugins/yoast-seo.js +71 -45
- package/webpack/base.mjs +0 -5
- package/webpack/helpers.mjs +1 -5
- package/webpack/index.mjs +0 -1
- package/webpack/project.mjs +0 -5
- 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
- package/bun.lockb +0 -0
- package/readme/packages.md +0 -74
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { __, sprintf, _n } from '@wordpress/i18n';
|
|
2
|
-
import { props, checkAttr, getAttrKey, MediaPicker, wpSearchRoute } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
-
import { ShareOptions } from '../../../components/share/components/share-options';
|
|
4
|
-
import { BaseControl, Repeater, RepeaterItem, LinkInput, Toggle } from '@eightshift/ui-components';
|
|
5
|
-
import { icons } from '@eightshift/ui-components/icons';
|
|
6
|
-
import { truncate } from '@eightshift/ui-components/utilities';
|
|
7
|
-
import manifest from '../manifest.json';
|
|
8
|
-
|
|
9
|
-
export const SiteFooterOptions = ({ attributes, setAttributes, randId, setRandId }) => {
|
|
10
|
-
const siteFooterLogoUrl = checkAttr('siteFooterLogoUrl', attributes, manifest);
|
|
11
|
-
const siteFooterLogoId = checkAttr('siteFooterLogoId', attributes, manifest);
|
|
12
|
-
const siteFooterPrimary = checkAttr('siteFooterPrimary', attributes, manifest);
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<>
|
|
16
|
-
<BaseControl
|
|
17
|
-
icon={icons.iconGeneric}
|
|
18
|
-
label={__('Logo', '%g_textdomain%')}
|
|
19
|
-
>
|
|
20
|
-
<MediaPicker
|
|
21
|
-
onChange={({ id, url }) => {
|
|
22
|
-
setAttributes({
|
|
23
|
-
[getAttrKey('siteFooterLogoId', attributes, manifest)]: id,
|
|
24
|
-
[getAttrKey('siteFooterLogoUrl', attributes, manifest)]: url,
|
|
25
|
-
});
|
|
26
|
-
}}
|
|
27
|
-
imageId={siteFooterLogoId}
|
|
28
|
-
imageUrl={siteFooterLogoUrl}
|
|
29
|
-
imageMode='contain'
|
|
30
|
-
/>
|
|
31
|
-
</BaseControl>
|
|
32
|
-
|
|
33
|
-
<ShareOptions
|
|
34
|
-
{...props('share', attributes, { setAttributes })}
|
|
35
|
-
noUseToggle
|
|
36
|
-
/>
|
|
37
|
-
|
|
38
|
-
<Repeater
|
|
39
|
-
icon={icons.linkNav}
|
|
40
|
-
label={__('Links', '%g_textdomain%')}
|
|
41
|
-
items={siteFooterPrimary}
|
|
42
|
-
onChange={(value) => setAttributes({ [getAttrKey('siteFooterPrimary', attributes, manifest)]: value })}
|
|
43
|
-
addDefaultItem={{
|
|
44
|
-
header: '',
|
|
45
|
-
items: [
|
|
46
|
-
{
|
|
47
|
-
text: '',
|
|
48
|
-
url: '',
|
|
49
|
-
newTab: false,
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
{(item) => {
|
|
55
|
-
const { header, items, updateData, itemIndex } = item;
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<RepeaterItem
|
|
59
|
-
label={header?.length > 0 ? header : __('New section', '%g_textdomain%')}
|
|
60
|
-
subtitle={
|
|
61
|
-
items.length > 0 && sprintf(_n('%d link', '%d links', items.length, '%g_textdomain%'), items.length)
|
|
62
|
-
}
|
|
63
|
-
>
|
|
64
|
-
<Repeater
|
|
65
|
-
icon={icons.link}
|
|
66
|
-
label={__('Links', '%g_textdomain%')}
|
|
67
|
-
items={items}
|
|
68
|
-
onChange={(value) => updateData({ items: value })}
|
|
69
|
-
addDefaultItem={{
|
|
70
|
-
text: '',
|
|
71
|
-
url: '',
|
|
72
|
-
newTab: false,
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
{(item) => {
|
|
76
|
-
const { text, url, newTab, updateData } = item;
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<RepeaterItem
|
|
80
|
-
label={text?.length > 0 ? text : __('New link', '%g_textdomain%')}
|
|
81
|
-
subtitle={truncate(url?.replace(window.location.origin, ''), 30)}
|
|
82
|
-
>
|
|
83
|
-
<LinkInput
|
|
84
|
-
icon={url?.includes('#')}
|
|
85
|
-
url={url}
|
|
86
|
-
onChange={({ url }) => updateData({ url: url })}
|
|
87
|
-
fetchSuggestions={wpSearchRoute}
|
|
88
|
-
/>
|
|
89
|
-
|
|
90
|
-
<Toggle
|
|
91
|
-
icon={icons.newTab}
|
|
92
|
-
label={__('Open in new tab', '%g_textdomain%')}
|
|
93
|
-
checked={newTab}
|
|
94
|
-
onChange={(value) => updateData({ newTab: value })}
|
|
95
|
-
/>
|
|
96
|
-
</RepeaterItem>
|
|
97
|
-
);
|
|
98
|
-
}}
|
|
99
|
-
</Repeater>
|
|
100
|
-
</RepeaterItem>
|
|
101
|
-
);
|
|
102
|
-
}}
|
|
103
|
-
</Repeater>
|
|
104
|
-
</>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/block.json",
|
|
3
|
-
"blockName": "site-footer",
|
|
4
|
-
"title": "Site footer",
|
|
5
|
-
"description": "Add extra navigation links, a logo, and social media buttons to complete your posts.",
|
|
6
|
-
"category": "eightshift",
|
|
7
|
-
"icon": {
|
|
8
|
-
"src": "es-card-teaser-alt-2"
|
|
9
|
-
},
|
|
10
|
-
"keywords": [
|
|
11
|
-
"site",
|
|
12
|
-
"footer"
|
|
13
|
-
],
|
|
14
|
-
"example": {
|
|
15
|
-
"attributes": {
|
|
16
|
-
"siteFooterLogoUrl": "https://loremflickr.com/200/150"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"attributes": {
|
|
20
|
-
"siteFooterPrimary": {
|
|
21
|
-
"type": "array",
|
|
22
|
-
"default": []
|
|
23
|
-
},
|
|
24
|
-
"siteFooterLogoUrl": {
|
|
25
|
-
"type": "string"
|
|
26
|
-
},
|
|
27
|
-
"siteFooterLogoId": {
|
|
28
|
-
"type": "number"
|
|
29
|
-
},
|
|
30
|
-
"siteFooterCopyright": {
|
|
31
|
-
"type": "string"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"components": {
|
|
35
|
-
"share": "share"
|
|
36
|
-
},
|
|
37
|
-
"tailwind": {
|
|
38
|
-
"base": {
|
|
39
|
-
"twClasses": "pt-8 pb-4"
|
|
40
|
-
},
|
|
41
|
-
"parts": {
|
|
42
|
-
"topContainer": {
|
|
43
|
-
"twClasses": "sm:grid sm:grid-cols-[auto,_1fr] sm:gap-x-20 px-2"
|
|
44
|
-
},
|
|
45
|
-
"bottomContainer": {
|
|
46
|
-
"twClasses": "mt-8 flex items-center justify-between gap-8 border-t border-t-gray-200 pt-4 px-2"
|
|
47
|
-
},
|
|
48
|
-
"copyright": {
|
|
49
|
-
"twClasses": "inline-flex gap-1 text-sm text-gray-400"
|
|
50
|
-
},
|
|
51
|
-
"linksContainer": {
|
|
52
|
-
"twClasses": "grid grid-cols-1 sm:grid-cols-[repeat(auto-fill,_minmax(10rem,_1fr))] gap-x-8 gap-y-4 mt-8 sm:mt-0"
|
|
53
|
-
},
|
|
54
|
-
"sectionContainer": {
|
|
55
|
-
"twClasses": "space-y-0.5"
|
|
56
|
-
},
|
|
57
|
-
"sectionTitle": {
|
|
58
|
-
"twClasses": "text-sm font-medium text-gray-500"
|
|
59
|
-
},
|
|
60
|
-
"link": {
|
|
61
|
-
"twClasses": "block w-fit text-base text-gray-700 hover:underline underline-offset-2 decoration-navy-500 decoration-2",
|
|
62
|
-
"twClassesEditorOnly": "text-base text-gray-700"
|
|
63
|
-
},
|
|
64
|
-
"logo": {
|
|
65
|
-
"twClasses": "min-h-16 w-28",
|
|
66
|
-
"twClassesEditorOnly": "min-h-16 max-w-28 p-1 [&_img]:!object-contain"
|
|
67
|
-
},
|
|
68
|
-
"share": {
|
|
69
|
-
"twClasses": "mt-5"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SiteFooterEditor } from './components/site-footer-editor';
|
|
2
|
-
import { SiteFooterOptions } from './components/site-footer-options';
|
|
3
|
-
import { GutenbergBlock } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
|
-
|
|
5
|
-
export const SiteFooter = (props) => {
|
|
6
|
-
return (
|
|
7
|
-
<GutenbergBlock
|
|
8
|
-
{...props}
|
|
9
|
-
options={SiteFooterOptions}
|
|
10
|
-
editor={SiteFooterEditor}
|
|
11
|
-
/>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Site footer block 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
|
-
$siteFooterPrimary = Helpers::checkAttr('siteFooterPrimary', $attributes, $manifest);
|
|
14
|
-
$siteFooterCopyright = Helpers::checkAttr('siteFooterCopyright', $attributes, $manifest);
|
|
15
|
-
|
|
16
|
-
$siteFooterLogoUrl = Helpers::checkAttr('siteFooterLogoUrl', $attributes, $manifest);
|
|
17
|
-
$siteFooterLogoId = Helpers::checkAttr('siteFooterLogoId', $attributes, $manifest);
|
|
18
|
-
|
|
19
|
-
$logoAlt = get_post_meta($siteFooterLogoId, '_wp_attachment_image_alt', true) ?? '';
|
|
20
|
-
?>
|
|
21
|
-
|
|
22
|
-
<div class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest)); ?>">
|
|
23
|
-
<div class="<?php echo esc_attr(Helpers::tailwindClasses('topContainer', $attributes, $manifest)); ?>">
|
|
24
|
-
<a href="<?php echo esc_url(get_home_url()); ?>">
|
|
25
|
-
<img
|
|
26
|
-
src="<?php echo esc_attr($siteFooterLogoUrl); ?>"
|
|
27
|
-
alt="<?php echo esc_attr($logoAlt); ?>"
|
|
28
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('logo', $attributes, $manifest)); ?>"
|
|
29
|
-
>
|
|
30
|
-
</a>
|
|
31
|
-
<div class="<?php echo esc_attr(Helpers::tailwindClasses('linksContainer', $attributes, $manifest)); ?>">
|
|
32
|
-
|
|
33
|
-
<?php
|
|
34
|
-
foreach ($siteFooterPrimary as $index => $value) {
|
|
35
|
-
$items = $value['items'] ?? [];
|
|
36
|
-
$header = $value['header'] ?? '';
|
|
37
|
-
?>
|
|
38
|
-
<div class="<?php echo esc_attr(Helpers::tailwindClasses('sectionContainer', $attributes, $manifest)); ?>">
|
|
39
|
-
<p class="<?php echo esc_attr(Helpers::tailwindClasses('sectionTitle', $attributes, $manifest)); ?>">
|
|
40
|
-
<?php echo wp_kses_post($header); ?>
|
|
41
|
-
</p>
|
|
42
|
-
|
|
43
|
-
<?php
|
|
44
|
-
foreach ($items as $item) {
|
|
45
|
-
$url = $item['url'] ?? '';
|
|
46
|
-
?>
|
|
47
|
-
<a
|
|
48
|
-
href="<?php echo esc_url($item['url']); ?>"
|
|
49
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('link', $attributes, $manifest)); ?>"
|
|
50
|
-
<?php if ($item['newTab'] ?? false) { ?>
|
|
51
|
-
target="_blank"
|
|
52
|
-
rel="noopener noreferrer"
|
|
53
|
-
<?php } ?>
|
|
54
|
-
>
|
|
55
|
-
<?php echo wp_kses_post($item['text'] ?? ''); ?>
|
|
56
|
-
</a>
|
|
57
|
-
<?php } ?>
|
|
58
|
-
</div>
|
|
59
|
-
<?php } ?>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<div class="<?php echo esc_attr(Helpers::tailwindClasses('bottomContainer', $attributes, $manifest)); ?>">
|
|
64
|
-
<?php if (!empty($siteFooterCopyright)) { ?>
|
|
65
|
-
<span class="<?php echo esc_attr(Helpers::tailwindClasses('copyright', $attributes, $manifest)); ?>">
|
|
66
|
-
© <?php echo esc_attr($siteFooterCopyright); ?>
|
|
67
|
-
</span>
|
|
68
|
-
<?php } ?>
|
|
69
|
-
|
|
70
|
-
<?php
|
|
71
|
-
echo Helpers::render('share', Helpers::props('share', $attributes));
|
|
72
|
-
?>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { RichText } from '@wordpress/block-editor';
|
|
3
|
-
import { checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
|
-
import { ImagePlaceholder } from '@eightshift/ui-components';
|
|
5
|
-
import manifest from '../manifest.json';
|
|
6
|
-
|
|
7
|
-
export const SiteNavigationEditor = ({ attributes, setAttributes }) => {
|
|
8
|
-
const siteNavigationLinks = checkAttr('siteNavigationLinks', attributes, manifest);
|
|
9
|
-
const siteNavigationLogoUrl = checkAttr('siteNavigationLogoUrl', attributes, manifest);
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<div className={tailwindClasses(attributes, manifest)}>
|
|
13
|
-
<ImagePlaceholder
|
|
14
|
-
style='simple'
|
|
15
|
-
imageMode='contain'
|
|
16
|
-
url={siteNavigationLogoUrl}
|
|
17
|
-
size='fullWidth'
|
|
18
|
-
className={tailwindClasses('logo', attributes, manifest)}
|
|
19
|
-
/>
|
|
20
|
-
|
|
21
|
-
<div className={tailwindClasses('linkContainer', attributes, manifest)}>
|
|
22
|
-
{siteNavigationLinks.map(({ text }, index) => {
|
|
23
|
-
return (
|
|
24
|
-
<RichText
|
|
25
|
-
placeholder={__('Item', '%g_textdomain%')}
|
|
26
|
-
value={text}
|
|
27
|
-
onChange={(value) => {
|
|
28
|
-
const newLinks = [...siteNavigationLinks];
|
|
29
|
-
newLinks[index].text = value;
|
|
30
|
-
setAttributes({ [getAttrKey('siteNavigationLinks', attributes, manifest)]: newLinks });
|
|
31
|
-
}}
|
|
32
|
-
allowedFormats={[]}
|
|
33
|
-
className={tailwindClasses('link', attributes, manifest)}
|
|
34
|
-
withoutInteractiveFormatting
|
|
35
|
-
disableLineBreaks
|
|
36
|
-
/>
|
|
37
|
-
);
|
|
38
|
-
})}
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { checkAttr, getAttrKey, MediaPicker, wpSearchRoute } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
-
import { BaseControl, Repeater, RepeaterItem, LinkInput, Toggle, Spacer } from '@eightshift/ui-components';
|
|
4
|
-
import { icons } from '@eightshift/ui-components/icons';
|
|
5
|
-
import { truncate } from '@eightshift/ui-components/utilities';
|
|
6
|
-
import manifest from '../manifest.json';
|
|
7
|
-
|
|
8
|
-
export const SiteNavigationOptions = ({ attributes, setAttributes }) => {
|
|
9
|
-
const siteNavigationLinks = checkAttr('siteNavigationLinks', attributes, manifest);
|
|
10
|
-
const siteNavigationLogoUrl = checkAttr('siteNavigationLogoUrl', attributes, manifest);
|
|
11
|
-
const siteNavigationLogoId = checkAttr('siteNavigationLogoId', attributes, manifest);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
<BaseControl
|
|
16
|
-
icon={icons.iconGeneric}
|
|
17
|
-
label={__('Logo', '%g_textdomain%')}
|
|
18
|
-
>
|
|
19
|
-
<MediaPicker
|
|
20
|
-
onChange={({ id, url }) => {
|
|
21
|
-
setAttributes({
|
|
22
|
-
[getAttrKey('siteNavigationLogoId', attributes, manifest)]: id,
|
|
23
|
-
[getAttrKey('siteNavigationLogoUrl', attributes, manifest)]: url,
|
|
24
|
-
});
|
|
25
|
-
}}
|
|
26
|
-
imageId={siteNavigationLogoId}
|
|
27
|
-
imageUrl={siteNavigationLogoUrl}
|
|
28
|
-
imageMode='contain'
|
|
29
|
-
/>
|
|
30
|
-
|
|
31
|
-
<Spacer />
|
|
32
|
-
|
|
33
|
-
<Repeater
|
|
34
|
-
icon={icons.link}
|
|
35
|
-
label={__('Links', '%g_textdomain%')}
|
|
36
|
-
items={siteNavigationLinks}
|
|
37
|
-
onChange={(value) => setAttributes({ [getAttrKey('siteNavigationLinks', attributes, manifest)]: value })}
|
|
38
|
-
addDefaultItem={{
|
|
39
|
-
text: '',
|
|
40
|
-
url: '',
|
|
41
|
-
newTab: false,
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
{(item) => {
|
|
45
|
-
const { text, url, newTab, updateData } = item;
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<RepeaterItem
|
|
49
|
-
icon={text?.length < 1 && icons.solidCircleGradient}
|
|
50
|
-
label={text?.length > 0 ? text : __('New link', '%g_textdomain%')}
|
|
51
|
-
subtitle={truncate(url?.replace(window.location.origin, ''), 30)}
|
|
52
|
-
>
|
|
53
|
-
<LinkInput
|
|
54
|
-
icon={url?.includes('#')}
|
|
55
|
-
url={url}
|
|
56
|
-
onChange={({ url }) => updateData({ url: url })}
|
|
57
|
-
fetchSuggestions={wpSearchRoute}
|
|
58
|
-
/>
|
|
59
|
-
|
|
60
|
-
<Toggle
|
|
61
|
-
icon={icons.newTab}
|
|
62
|
-
label={__('Open in new tab', '%g_textdomain%')}
|
|
63
|
-
checked={newTab}
|
|
64
|
-
onChange={(value) => updateData({ newTab: value })}
|
|
65
|
-
/>
|
|
66
|
-
</RepeaterItem>
|
|
67
|
-
);
|
|
68
|
-
}}
|
|
69
|
-
</Repeater>
|
|
70
|
-
</BaseControl>
|
|
71
|
-
</>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/block.json",
|
|
3
|
-
"blockName": "site-navigation",
|
|
4
|
-
"title": "Site navigation",
|
|
5
|
-
"description": "Add top-level navigation links to your website.",
|
|
6
|
-
"category": "eightshift",
|
|
7
|
-
"icon": {
|
|
8
|
-
"src": "es-navbar"
|
|
9
|
-
},
|
|
10
|
-
"keywords": [
|
|
11
|
-
"site",
|
|
12
|
-
"navigation",
|
|
13
|
-
"navbar"
|
|
14
|
-
],
|
|
15
|
-
"example": {
|
|
16
|
-
"attributes": {
|
|
17
|
-
"siteNavigationLogoUrl": "https://loremflickr.com/200/150"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"attributes": {
|
|
21
|
-
"siteNavigationLinks": {
|
|
22
|
-
"type": "array",
|
|
23
|
-
"default": []
|
|
24
|
-
},
|
|
25
|
-
"siteNavigationLogoUrl": {
|
|
26
|
-
"type": "string"
|
|
27
|
-
},
|
|
28
|
-
"siteNavigationLogoId": {
|
|
29
|
-
"type": "number"
|
|
30
|
-
},
|
|
31
|
-
"wrapperUse": {
|
|
32
|
-
"type": "boolean",
|
|
33
|
-
"default": false
|
|
34
|
-
},
|
|
35
|
-
"wrapperNoControls": {
|
|
36
|
-
"type": "boolean",
|
|
37
|
-
"default": true
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"tailwind": {
|
|
41
|
-
"base": {
|
|
42
|
-
"twClasses": "flex items-center justify-between gap-4 max-w-screen-md mx-auto h-full ~sm/md:~px-8/20",
|
|
43
|
-
"twClassesEditorOnly": "flex items-center justify-between gap-4 p-1"
|
|
44
|
-
},
|
|
45
|
-
"parts": {
|
|
46
|
-
"wrapper": {
|
|
47
|
-
"twClasses": "bg-white border-b border-b-gray-100 ~sm/md:~h-16/20"
|
|
48
|
-
},
|
|
49
|
-
"logo": {
|
|
50
|
-
"twClasses": "~sm/md:~w-20/28",
|
|
51
|
-
"twClassesEditorOnly": "max-w-32"
|
|
52
|
-
},
|
|
53
|
-
"link": {
|
|
54
|
-
"twClasses": "text-base text-gray-700 hover:underline underline-offset-2 decoration-red-500 decoration-2",
|
|
55
|
-
"twClassesEditorOnly": "text-base"
|
|
56
|
-
},
|
|
57
|
-
"drawerLink": {
|
|
58
|
-
"twClasses": "text-lg sm:text-base text-gray-700 hover:underline underline-offset-2 decoration-red-500 decoration-2 block py-4 sm:py-2"
|
|
59
|
-
},
|
|
60
|
-
"linkContainer": {
|
|
61
|
-
"twClasses": "hidden sm:flex items-center gap-6 pr-2"
|
|
62
|
-
},
|
|
63
|
-
"button": {
|
|
64
|
-
"twClasses": "size-9 flex items-center justify-center rounded-md border border-gray-500 hover:bg-gray-500 focus:outline-none focus-visible:ring focus-visible:ring-navy-500/30 text-gray-600 hover:text-white transition"
|
|
65
|
-
},
|
|
66
|
-
"modalWrapper": {
|
|
67
|
-
"twClasses": "hidden open:block group"
|
|
68
|
-
},
|
|
69
|
-
"modalBackdrop": {
|
|
70
|
-
"twClasses": "fixed inset-0 wp-admin-bar-offset bg-black/50 z-30 duration-300 group-aria-hidden:animate-out group-aria-hidden:fade-out animate-in fade-in-0"
|
|
71
|
-
},
|
|
72
|
-
"modalContent": {
|
|
73
|
-
"twClasses": "bg-white rounded-lg ~sm/md:~m-2/6 sm:w-80 p-6 sm:p-4 sm:pl-6 space-y-3 sm:ml-auto shadow-md animate-in slide-in-from-top-4 group-aria-hidden:animate-out group-aria-hidden:slide-out-to-top-4"
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SiteNavigationEditor } from './components/site-navigation-editor';
|
|
2
|
-
import { SiteNavigationOptions } from './components/site-navigation-options';
|
|
3
|
-
import { GutenbergBlock } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
|
-
|
|
5
|
-
export const SiteNavigation = (props) => {
|
|
6
|
-
return (
|
|
7
|
-
<GutenbergBlock
|
|
8
|
-
{...props}
|
|
9
|
-
options={SiteNavigationOptions}
|
|
10
|
-
editor={SiteNavigationEditor}
|
|
11
|
-
/>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Site navigation block 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
|
-
$blockJsClass = $attributes['blockJsClass'] ?? '';
|
|
14
|
-
|
|
15
|
-
$siteNavigationLinks = Helpers::checkAttr('siteNavigationLinks', $attributes, $manifest) ?? [];
|
|
16
|
-
$siteNavigationLogoUrl = Helpers::checkAttr('siteNavigationLogoUrl', $attributes, $manifest);
|
|
17
|
-
$siteNavigationLogoId = Helpers::checkAttr('siteNavigationLogoId', $attributes, $manifest);
|
|
18
|
-
|
|
19
|
-
$logoAlt = get_post_meta($siteNavigationLogoId, '_wp_attachment_image_alt', true) ?? '';
|
|
20
|
-
|
|
21
|
-
$drawerId = 'navbar-mobile-flyout';
|
|
22
|
-
?>
|
|
23
|
-
|
|
24
|
-
<nav class="<?php echo esc_attr(Helpers::tailwindClasses('wrapper', $attributes, $manifest)); ?>">
|
|
25
|
-
<div class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest)); ?>">
|
|
26
|
-
<a href="<?php echo esc_url(get_home_url()); ?>">
|
|
27
|
-
<img
|
|
28
|
-
src="<?php echo esc_attr($siteNavigationLogoUrl); ?>"
|
|
29
|
-
alt="<?php echo esc_attr($logoAlt); ?>"
|
|
30
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('logo', $attributes, $manifest)); ?>"
|
|
31
|
-
>
|
|
32
|
-
</a>
|
|
33
|
-
|
|
34
|
-
<div class="<?php echo esc_attr(Helpers::tailwindClasses('linkContainer', $attributes, $manifest)); ?>">
|
|
35
|
-
<?php
|
|
36
|
-
foreach ($siteNavigationLinks as $navLink) {
|
|
37
|
-
$url = $navLink['url'] ?? '';
|
|
38
|
-
$text = $navLink['text'] ?? '';
|
|
39
|
-
|
|
40
|
-
if (empty($url) || empty($text)) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
?>
|
|
44
|
-
<a
|
|
45
|
-
href="<?php echo esc_attr($url); ?>"
|
|
46
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('link', $attributes, $manifest)); ?>"
|
|
47
|
-
<?php if ($navLink['newTab'] ?? false) { ?>
|
|
48
|
-
target="_blank"
|
|
49
|
-
rel="noopener noreferrer"
|
|
50
|
-
<?php } ?>
|
|
51
|
-
>
|
|
52
|
-
<?php echo wp_kses_post($text); ?>
|
|
53
|
-
</a>
|
|
54
|
-
<?php } ?>
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
<button class="<?php echo esc_attr(Helpers::tailwindClasses('button', $attributes, $manifest, 'sm:hidden')); ?>" data-micromodal-trigger="<?php echo esc_attr($drawerId); ?>">
|
|
58
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
|
59
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" />
|
|
60
|
-
</svg>
|
|
61
|
-
</button>
|
|
62
|
-
</div>
|
|
63
|
-
</nav>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<div id="<?php echo esc_attr($drawerId); ?>" aria-hidden="true" class="<?php echo esc_attr(Helpers::tailwindClasses('modalWrapper', $attributes, $manifest)); ?>">
|
|
67
|
-
<div tabindex="-1" class="<?php echo esc_attr(Helpers::tailwindClasses('modalBackdrop', $attributes, $manifest)); ?>" data-micromodal-close>
|
|
68
|
-
<div class="<?php echo esc_attr(Helpers::tailwindClasses('modalContent', $attributes, $manifest)); ?>" role="dialog" aria-modal="true" aria-label="<?php echo esc_html__('Main menu', '%g_textdomain%'); ?>-title">
|
|
69
|
-
<button class="<?php echo esc_attr(Helpers::tailwindClasses('button', $attributes, $manifest, 'ml-auto')); ?>" aria-label="Close menu" data-micromodal-close>
|
|
70
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
|
71
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
|
|
72
|
-
</svg>
|
|
73
|
-
</button>
|
|
74
|
-
|
|
75
|
-
<div id="<?php echo esc_attr($drawerId); ?>-content">
|
|
76
|
-
<?php
|
|
77
|
-
foreach ($siteNavigationLinks as $navLink) {
|
|
78
|
-
$url = $navLink['url'] ?? '';
|
|
79
|
-
$text = $navLink['text'] ?? '';
|
|
80
|
-
|
|
81
|
-
if (empty($url) || empty($text)) {
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
?>
|
|
85
|
-
<a
|
|
86
|
-
href="<?php echo esc_attr($url); ?>"
|
|
87
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('drawerLink', $attributes, $manifest)); ?>"
|
|
88
|
-
<?php if ($navLink['newTab'] ?? false) { ?>
|
|
89
|
-
target="_blank"
|
|
90
|
-
rel="noopener noreferrer"
|
|
91
|
-
<?php } ?>
|
|
92
|
-
>
|
|
93
|
-
<?php echo wp_kses_post($text); ?>
|
|
94
|
-
</a>
|
|
95
|
-
<?php } ?>
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import domReady from '@wordpress/dom-ready';
|
|
2
|
-
|
|
3
|
-
domReady(async () => {
|
|
4
|
-
const tocBlocks = document.querySelectorAll('.js-block-table-of-contents');
|
|
5
|
-
|
|
6
|
-
if (tocBlocks?.length < 1) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
tocBlocks.forEach((tocBlock) => {
|
|
11
|
-
const levelsToUse = tocBlock?.dataset?.levels ?? 'h1,h2,h3,h4,h5,h6';
|
|
12
|
-
|
|
13
|
-
const headings = document.querySelectorAll(`.main-content :where(${levelsToUse})`);
|
|
14
|
-
|
|
15
|
-
headings.forEach((heading) => {
|
|
16
|
-
const entry = document.createElement('button');
|
|
17
|
-
entry.className = 'block py-0.5 focus:outline-none group';
|
|
18
|
-
|
|
19
|
-
const itemClassName =
|
|
20
|
-
'transition text-sm rounded group-hover:bg-navy-100 group-hover:ring-4 group-hover:ring-navy-100 group-hover:text-navy-950 group-focus-visible:bg-navy-950 group-focus-visible:ring-4 group-focus-visible:ring-navy-950 group-focus-visible:text-navy-50';
|
|
21
|
-
|
|
22
|
-
let preText = '';
|
|
23
|
-
const dash = '–';
|
|
24
|
-
|
|
25
|
-
const dashClassName = 'text-gray-300 mr-1.5 tracking-tighter';
|
|
26
|
-
|
|
27
|
-
switch (heading.tagName.toLowerCase()) {
|
|
28
|
-
case 'h2':
|
|
29
|
-
preText = `<span class="${dashClassName}">${dash}</span>`;
|
|
30
|
-
break;
|
|
31
|
-
case 'h3':
|
|
32
|
-
preText = `<span class="${dashClassName}">${dash.repeat(2)}</span>`;
|
|
33
|
-
break;
|
|
34
|
-
case 'h4':
|
|
35
|
-
preText = `<span class="${dashClassName}">${dash.repeat(3)}</span>`;
|
|
36
|
-
break;
|
|
37
|
-
case 'h5':
|
|
38
|
-
preText = `<span class="${dashClassName}">${dash.repeat(4)}</span>`;
|
|
39
|
-
break;
|
|
40
|
-
case 'h6':
|
|
41
|
-
preText = `<span class="${dashClassName}">${dash.repeat(5)}</span>`;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
entry.innerHTML = `${preText}<span class="${itemClassName}${heading.tagName.toLowerCase() !== 'h1' ? 'px-0.5' : ''}">${heading.innerText}</span>`;
|
|
46
|
-
|
|
47
|
-
entry.addEventListener('click', () => {
|
|
48
|
-
heading.scrollIntoView({
|
|
49
|
-
behavior: 'smooth',
|
|
50
|
-
block: 'start',
|
|
51
|
-
inline: 'start',
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
tocBlock.appendChild(entry);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|