UNPKG

@gechiui/components

Version:
45 lines (41 loc) 1.21 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@gechiui/element"; /** * Internal dependencies */ import { contextConnect } from '../ui/context'; import { View } from '../view'; import { useSurface } from './hook'; /** * @param {import('../ui/context').GeChiUIComponentProps<import('./types').Props, 'div'>} props * @param {import('react').Ref<any>} forwardedRef */ function Surface(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 '@gechiui/components'; * * function Example() { * return ( * <Surface> * <Text>Code is Poetry</Text> * </Surface> * ); * } * ``` */ const ConnectedSurface = contextConnect(Surface, 'Surface'); export default ConnectedSurface; //# sourceMappingURL=component.js.map