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 / AssetProvider.jsx

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

29 lines 829 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { welcomePageAssets } from "../data/settings-menu-data";
2
3 /**
4 * Store asset provider.
5 *
6 * Component child should be a function that will be called with the asset object.
7 *
8 * @param {Object} props component properties
9 * @param {Function} props.children children function, this function will be called with the asset object
10 * @param {Array} props.assetIds array of asset ids to be fetched from data store
11 * @class
12 */
13 function AssetProvider({ children, assetIds = [] }) {
14 const getAsset = assetId => {
15 return welcomePageAssets?.[assetId];
16 };
17 const assetObj = assetIds.reduce((acc, assetId) => {
18 acc[assetId] = getAsset(assetId);
19 return acc;
20 }, {});
21
22 return children(assetObj);
23 }
24
25 /**
26 * @module AssetProvider
27 */
28 export default AssetProvider;
29