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 / utils / is-flex-item / index.js
generateblocks / src / utils / is-flex-item Last commit date
index.js 2 years ago
index.js
46 lines
1 export default function isFlexItem( props ) {
2 const {
3 device,
4 display,
5 displayTablet,
6 displayMobile,
7 computedStyles = { display: '' },
8 } = props;
9
10 // Check for a computed value if one is provided
11 const { display: computedValue = '' } = computedStyles;
12
13 // If the computed style is flex, we can assume it's a flex item.
14 if ( 'flex' === computedValue ) {
15 return true;
16 }
17
18 // Check local attributes to determine if a flex item
19 let flexItem = false;
20
21 if ( 'Desktop' === device && display.includes( 'flex' ) ) {
22 flexItem = true;
23 }
24
25 if ( 'Tablet' === device ) {
26 if (
27 ( displayTablet && displayTablet.includes( 'flex' ) ) ||
28 ( ! displayTablet && display.includes( 'flex' ) )
29 ) {
30 flexItem = true;
31 }
32 }
33
34 if ( 'Mobile' === device ) {
35 if (
36 ( displayMobile && displayMobile.includes( 'flex' ) ) ||
37 ( ! displayMobile && displayTablet && displayTablet.includes( 'flex' ) ) ||
38 ( ! displayMobile && ! displayTablet && display.includes( 'flex' ) )
39 ) {
40 flexItem = true;
41 }
42 }
43
44 return flexItem;
45 }
46