Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 1x 1x | import { createContext } from '@wordpress/element';
/**
* Paid Block context
* Used to pass data between components of a Paid Block.
*/
export const PaidBlockContext = createContext();
/**
* Paid Block Provider
*
* @param {object} props - Provider properties.
* @param {Function} props.onBannerVisibilityChange - Callback to set banner visibility.
* @param {boolean} props.hasParentBanner - True if a parent of this block has a banner, which may or may not be visible.
* @param {boolean} props.children - Provider Children.
* @return {*} Provider component.
*/
export const PaidBlockProvider = ( { onBannerVisibilityChange, hasParentBanner, children } ) => (
<PaidBlockContext.Provider
value={ { onBannerVisibilityChange, hasParentBanner } }
children={ children }
/>
);
|