PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.2
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / blocks / tabs / deprecated.js

deprecated.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.2, at gutenberg/blocks/tabs/deprecated.js

70 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import classnames from 'classnames/dedupe';
2
3 import {
4 RichText,
5 useBlockProps,
6 useInnerBlocksProps,
7 } from '@wordpress/block-editor';
8 import { applyFilters } from '@wordpress/hooks';
9
10 import metadata from './block.json';
11
12 const { name } = metadata;
13
14 export default [
15 // v3.1.2
16 {
17 ...metadata,
18 save: function BlockSave(props) {
19 const {
20 tabActive,
21 trigger,
22 buttonsVerticalAlign,
23 buttonsAlign,
24 tabsData = [],
25 } = props.attributes;
26
27 let className = classnames(
28 'ghostkit-tabs',
29 buttonsVerticalAlign && 'ghostkit-tabs-buttons-vertical',
30 trigger && `ghostkit-tabs-buttons-trigger-${trigger}`
31 );
32
33 className = applyFilters('ghostkit.blocks.className', className, {
34 ...{ name },
35 ...props,
36 });
37
38 const blockProps = useBlockProps.save({
39 className,
40 'data-tab-active': tabActive,
41 });
42 const innerBlockProps = useInnerBlocksProps.save({
43 className: 'ghostkit-tabs-content',
44 });
45
46 return (
47 <div {...blockProps}>
48 <div
49 className={classnames(
50 'ghostkit-tabs-buttons',
51 `ghostkit-tabs-buttons-align-${buttonsAlign}`
52 )}
53 >
54 {tabsData.map((tabData) => (
55 <RichText.Content
56 tagName="a"
57 href={`#${tabData.slug}`}
58 className="ghostkit-tabs-buttons-item"
59 key={`tab_button_${tabData.slug}`}
60 value={tabData.title}
61 />
62 ))}
63 </div>
64 <div {...innerBlockProps} />
65 </div>
66 );
67 },
68 },
69 ];
70