2021-09-22 15:00:19 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { createContext, useContext } from '@wordpress/element';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Context consumed by inner blocks.
|
|
|
|
*/
|
2021-09-24 15:13:39 +00:00
|
|
|
export type CartBlockContextProps = {
|
2021-10-18 16:12:36 +00:00
|
|
|
hasDarkControls: boolean;
|
2021-09-22 15:00:19 +00:00
|
|
|
};
|
|
|
|
|
2021-09-24 15:13:39 +00:00
|
|
|
export const CartBlockContext = createContext< CartBlockContextProps >( {
|
2021-10-18 16:12:36 +00:00
|
|
|
hasDarkControls: false,
|
2021-09-22 15:00:19 +00:00
|
|
|
} );
|
|
|
|
|
2021-09-24 15:13:39 +00:00
|
|
|
export const useCartBlockContext = (): CartBlockContextProps => {
|
|
|
|
return useContext( CartBlockContext );
|
2021-09-22 15:00:19 +00:00
|
|
|
};
|