PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.3
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.3
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 / components / pro-note / index.js

index.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.3, at gutenberg/components/pro-note/index.js

50 lines 1.0 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 { Button } from '@wordpress/components';
4 import { useState } from '@wordpress/element';
5
6 import getIcon from '../../utils/get-icon';
7
8 export default function ProNote(props) {
9 const { title, children } = props;
10
11 const [collapsed, setCollapsed] = useState(props.collapsed);
12
13 return (
14 <div
15 className={classnames(
16 'ghostkit-pro-component-note',
17 collapsed && 'ghostkit-pro-component-note-collapsed'
18 )}
19 >
20 <div className="ghostkit-pro-component-note-inner">
21 {title && <h3>{title}</h3>}
22 {collapsed && (
23 <Button
24 onClick={() => {
25 setCollapsed(!collapsed);
26 }}
27 >
28 {getIcon('icon-arrow-right')}
29 </Button>
30 )}
31 {!collapsed && children && <div>{children}</div>}
32 </div>
33 </div>
34 );
35 }
36
37 /**
38 * Button for ProNote
39 * @param props
40 */
41 ProNote.Button = function ProNoteButton(props) {
42 const { children } = props;
43
44 return (
45 <a className="ghostkit-pro-component-note-button" {...props}>
46 {children}
47 </a>
48 );
49 };
50