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

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