PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.1.4
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.1.4
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
cartflows / modules / gutenberg / src / components / responsive-slider / index.js

index.js in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 3.1.4, at modules/gutenberg/src/components/responsive-slider/index.js

97 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1
2 import Range from '@Components/range/Range.js';
3 import { useDeviceType } from '@Controls/getPreviewType';
4 import { limitMax, limitMin } from '@Controls/unitWiseMinMaxOption';
5
6 const ResponsiveSlider = ( props ) => {
7 const deviceType = useDeviceType();
8 const output = {};
9 const maxDesk = limitMax( props.data.desktop.unit?.value, props, true );
10 const maxTab = limitMax( props.data.tablet.unit?.value, props, true );
11 const maxMob = limitMax( props.data.mobile.unit?.value, props, true );
12 const minDesk = limitMin( props.data.desktop.unit?.value, props, true );
13 const minTab = limitMin( props.data.tablet.unit?.value, props, true );
14 const minMob = limitMin( props.data.mobile.unit?.value, props, true );
15
16
17 output.Desktop = (
18 <>
19 <Range
20 { ...props }
21 label={ props.label }
22 value={ isNaN( props.data.desktop.value ) ? '' : props.data.desktop.value }
23 data={ {
24 value: props.data.desktop.value,
25 label: props.data.desktop.label,
26 } }
27 onChange={ props?.onChange ? ( value ) => {
28 if ( props?.onChange ) {
29 props.onChange( value )
30 }
31 } : false }
32
33 min={ minDesk }
34 max={ maxDesk }
35 unit={ props.data.desktop.unit || props.unit }
36 responsive={ true }
37 units={ props.units }
38 />
39 </>
40 );
41 output.Tablet = (
42 <>
43 <Range
44 { ...props }
45 label={ props.label }
46 value={ isNaN( props.data.tablet.value ) ? '' : props.data.tablet.value }
47 data={ {
48 value: props.data.tablet.value,
49 label: props.data.tablet.label,
50 } }
51 onChange={ props?.onChange ? ( value ) => {
52 if ( props?.onChange ) {
53 props.onChange( value )
54 }
55 } : false }
56 min={ minTab }
57 max={ maxTab }
58 unit={ props.data.tablet.unit || props.unit }
59 responsive={ true }
60 units={ props.units }
61 />
62 </>
63 );
64 output.Mobile = (
65 <>
66 <Range
67 { ...props }
68 label={ props.label }
69 value={ isNaN( props.data.mobile.value ) ? '' : props.data.mobile.value }
70 data={ {
71 value: props.data.mobile.value,
72 label: props.data.mobile.label,
73 } }
74 onChange={ props?.onChange ? ( value ) => {
75 if ( props?.onChange ) {
76 props.onChange( value )
77 }
78 } : false }
79 min={ minMob }
80 max={ maxMob }
81 unit={ props.data.mobile.unit || props.unit }
82 responsive={ true }
83 units={ props.units }
84 />
85 </>
86 );
87
88 return (
89 <div className="components-base-control uagb-responsive-range">
90 <div className="uagb-responsive-control-inner">
91 { output[ deviceType ] ? output[ deviceType ] : output.Desktop }
92 </div>
93 </div>
94 );
95 };
96 export default ResponsiveSlider;
97