PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 2.0.2
GenerateBlocks v2.0.2
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 / components / alignment-matrix / index.js
generateblocks / src / components / alignment-matrix Last commit date
components 2 years ago index.js 2 years ago styles.scss 2 years ago
index.js
57 lines
1 import { Dropdown, ToolbarButton } from '@wordpress/components';
2 import './styles.scss';
3 import { __ } from '@wordpress/i18n';
4 import Matrix from './components/matrix';
5
6 function AlignmentMatrix( { activeCell, onChange, direction, children } ) {
7 return (
8 <Dropdown
9 className="gb-alignment-matrix"
10 contentClassName="gb-alignment-matrix-content"
11 popoverProps={ { variant: 'toolbar', placement: 'bottom-center' } }
12 focusOnMount={ true }
13 renderToggle={ ( { isOpen, onToggle } ) => {
14 const openOnArrowDown = ( event ) => {
15 if ( ! isOpen && event.keyCode === 40 ) {
16 event.preventDefault();
17 onToggle();
18 }
19 };
20
21 return (
22 <ToolbarButton
23 onClick={ onToggle }
24 aria-haspopup="true"
25 aria-expanded={ isOpen }
26 onKeyDown={ openOnArrowDown }
27 label={ __( 'Change content position', 'generateblocks' ) }
28 icon={ (
29 <Matrix
30 isCompact
31 isOpen={ isOpen }
32 direction={ direction }
33 activeCell={ activeCell }
34 />
35 ) }
36 showTooltip
37 disabled={ false }
38 />
39 );
40 } }
41 renderContent={ () => (
42 <div className="gb-alignment-matrix-content">
43 <div className="gb-alignment-matrix-content-buttons">
44 { children }
45 </div>
46 <Matrix
47 activeCell={ activeCell }
48 onChange={ onChange }
49 />
50 </div>
51 ) }
52 />
53 );
54 }
55
56 export default AlignmentMatrix;
57