PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.1.5
Tableberg – Simple Gutenberg Table Block v1.1.5
1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 All 42 releases
tableberg / admin / src / components / ProFilter.jsx

ProFilter.jsx in Tableberg – Simple Gutenberg Table Block 1.1.5, at admin/src/components/ProFilter.jsx

29 lines 898 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useEffect, useState } from "react";
2
3 /**
4 * Component to filter its children based on pro version status of current plugin.
5 *
6 * @param {Object} props component properties
7 * @param {boolean} props.proStatus pro version status, will be supplied via HOC
8 * @param {Array | Function | string} props.children component children
9 * @param {boolean} [props.invert=true] invert filter, if true, children will be rendered only if proStatus is false
10 * @class
11 */
12 function ProFilter({ proStatus = false, children, invert = true }) {
13 const [finalStatus, setFinalStatus] = useState(false);
14
15 /**
16 * useEffect hook.
17 */
18 useEffect(() => {
19 setFinalStatus(invert ? !proStatus : proStatus);
20 }, []);
21
22 return finalStatus && children;
23 }
24
25 /**
26 * @module ProFilter
27 */
28 export default ProFilter;
29