PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 2.2.0
GenerateBlocks v2.2.0
trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.3.0
generateblocks / src / pattern-library / components / add-library.js
generateblocks / src / pattern-library / components Last commit date
add-library.js 2 years ago category-list.js 1 year ago insert-pattern.js 2 years ago library-cache.js 2 years ago library-layout.js 1 year ago library-provider.js 2 years ago library-selector.js 1 year ago manage-libraries.js 2 years ago pattern-details-header.js 1 year ago pattern-details.js 1 year ago pattern-list.js 1 year ago pattern-search.js 2 years ago pattern.js 1 year ago selected-patterns.js 1 year ago
add-library.js
46 lines
1 import { Button, Modal } from '@wordpress/components';
2 import { useState } from '@wordpress/element';
3 import { __ } from '@wordpress/i18n';
4 import { plus } from '@wordpress/icons';
5 import { applyFilters } from '@wordpress/hooks';
6 import { useLibrary } from './library-provider';
7
8 function DefaultMessage( { setShowAddLibrary, setLibraries } ) {
9 const content = (
10 <>
11 <p>{ __( 'This feature requires GenerateBlocks Pro.', 'generateblocks' ) }</p>
12 </>
13 );
14
15 return applyFilters( 'generateblocks.patternLibrary.addLibraryContent', content, { setShowAddLibrary, setLibraries } );
16 }
17
18 export default function AddLibrary() {
19 const [ showAddLibrary, setShowAddLibrary ] = useState( false );
20 const { setLibraries } = useLibrary();
21
22 return (
23 <>
24 <Button
25 variant="secondary"
26 icon={ plus }
27 onClick={ () => setShowAddLibrary( true ) }
28 label={ __( 'Add Library', 'generateblocks' ) }
29 />
30
31 { !! showAddLibrary &&
32 <Modal
33 title={ __( 'Add Library', 'generateblocks' ) }
34 onRequestClose={ () => setShowAddLibrary( false ) }
35 className="gblocks-patterns-add-library"
36 >
37 <DefaultMessage
38 setShowAddLibrary={ setShowAddLibrary }
39 setLibraries={ setLibraries }
40 />
41 </Modal>
42 }
43 </>
44 );
45 }
46