@atlaskit/primitives
Version:
Primitives are token-backed low-level building blocks.
19 lines (18 loc) • 530 B
JavaScript
import { createContext, useContext } from 'react';
/**
* __Surface context__
*
* A surface context provides context information on the current background (if set).
*/
export const SurfaceContext = /*#__PURE__*/createContext('elevation.surface');
/**
* __useSurface__
*
* Return the current surface. If no parent sets a surface color it falls back to the default surface.
*
* @see SurfaceContext
*/
export const useSurface = () => {
return useContext(SurfaceContext);
};
SurfaceContext.displayName = 'SurfaceProvider';