PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
give / blocks / components / column-selector / index.js

index.js in GiveWP – Donation Plugin and Fundraising Platform 4.17.0, at blocks/components/column-selector/index.js

72 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import cx from 'classnames';
2 import './style.scss';
3
4 export function Selector({display, selected}) {
5 const displayValue = String(display);
6
7 return (
8 <div
9 className={cx(
10 'give_column_selector_container',
11 {'give_column_selector_selected': displayValue === selected}
12 )}
13 >
14 <>
15 {Array(display).fill(null).map((val, i) => <div key={i} className="give_column_selector_box"> </div>)}
16 </>
17 </div>
18 )
19 }
20
21 export function Row({children}) {
22 return (
23 <div className="give_column_selector_row">
24 {children}
25 </div>
26 )
27 }
28
29 export default function ({label, selected, help}) {
30 return (
31 <div className="give_column_selector">
32 {label && (
33 <p>{label}</p>
34 )}
35
36 {help && (
37 <p className="give_column_selector_help_text">{help}</p>
38 )}
39
40 {selected === '1' ? (
41 <Row>
42 <Selector
43 display={1}
44 selected={selected}
45 />
46 </Row>
47 ) : selected === '2' ? (
48 <Row>
49 <Selector
50 display={2}
51 selected={selected}
52 />
53 </Row>
54 ) : selected === '3' ? (
55 <Row>
56 <Selector
57 display={3}
58 selected={selected}
59 />
60 </Row>
61 ):
62 <Row>
63 <Selector
64 display={4}
65 selected={selected}
66 />
67 </Row>
68 }
69 </div>
70 )
71 }
72