UNPKG

@wordpress/components

Version:
45 lines (40 loc) 1.05 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@wordpress/element"; /** * External dependencies */ /** * Internal dependencies */ import { contextConnect } from '../ui/context'; import { View } from '../view'; import { useSurface } from './hook'; function UnconnectedSurface(props, forwardedRef) { const surfaceProps = useSurface(props); return createElement(View, _extends({}, surfaceProps, { ref: forwardedRef })); } /** * `Surface` is a core component that renders a primary background color. * * In the example below, notice how the `Surface` renders in white (or dark gray if in dark mode). * * ```jsx * import { * __experimentalSurface as Surface, * __experimentalText as Text, * } from '@wordpress/components'; * * function Example() { * return ( * <Surface> * <Text>Code is Poetry</Text> * </Surface> * ); * } * ``` */ export const Surface = contextConnect(UnconnectedSurface, 'Surface'); export default Surface; //# sourceMappingURL=component.js.map