PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.9.0
GenerateBlocks v1.9.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 / library-selector.js
generateblocks / src / pattern-library / components Last commit date
add-library.js 2 years ago category-list.js 2 years ago insert-pattern.js 2 years ago library-cache.js 2 years ago library-layout.js 2 years ago library-provider.js 2 years ago library-selector.js 2 years ago manage-libraries.js 2 years ago pattern-details-header.js 2 years ago pattern-details.js 2 years ago pattern-list.js 2 years ago pattern-search.js 2 years ago pattern.js 2 years ago selected-patterns.js 2 years ago
library-selector.js
43 lines
1 import { Button, ButtonGroup } from '@wordpress/components';
2 import { useLibrary } from './library-provider';
3 import AddLibrary from './add-library';
4
5 export default function LibrarySelector() {
6 const {
7 libraries,
8 activeLibrary,
9 setActiveLibrary,
10 setIsLocal,
11 setPublicKey,
12 setActiveCategory,
13 loading,
14 } = useLibrary();
15
16 return (
17 <div className="pattern-library-selector">
18 <ButtonGroup>
19 { libraries.map( ( library ) => (
20 <Button
21 key={ library.id }
22 isPressed={ library.id === activeLibrary.id }
23 variant="secondary"
24 onClick={ () => {
25 setActiveLibrary( library );
26 setIsLocal( !! library.isLocal );
27 setPublicKey( library.publicKey );
28 setActiveCategory( '' );
29 } }
30 style={ {
31 pointerEvents: !! loading ? 'none' : '',
32 } }
33 >
34 { library.name }
35 </Button>
36 ) ) }
37
38 <AddLibrary />
39 </ButtonGroup>
40 </div>
41 );
42 }
43