diff --git a/packages/components/src/elevation/component.js b/packages/components/src/elevation/component.js deleted file mode 100644 index a225e665a9ff6..0000000000000 --- a/packages/components/src/elevation/component.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Internal dependencies - */ -import { useElevation } from './hook'; -import { createComponent } from '../ui/utils'; - -/** - * `Elevation` is a core component that renders shadow, using the library's shadow system. - * - * The shadow effect is generated using the `value` prop. - * - * @example - * ```jsx - * import { - * __experimentalElevation as Elevation, - * __experimentalSurface as Surface, - * __experimentalText as Text, - * } from '@wordpress/components'; - * - * function Example() { - * return ( - * - * Code is Poetry - * - * - * ); - * } - * ``` - */ -const Elevation = createComponent( { - as: 'div', - useHook: useElevation, - name: 'Elevation', -} ); - -export default Elevation; diff --git a/packages/components/src/elevation/component.tsx b/packages/components/src/elevation/component.tsx new file mode 100644 index 0000000000000..21b8864ae5ba1 --- /dev/null +++ b/packages/components/src/elevation/component.tsx @@ -0,0 +1,69 @@ +/** + * External dependencies + */ +// eslint-disable-next-line no-restricted-imports +import type { Ref } from 'react'; + +/** + * Internal dependencies + */ +import { + useContextSystem, + contextConnect, + PolymorphicComponentProps, +} from '../ui/context'; +import type { Props } from './types'; +import { ElevationView, ElevationViewProps } from './styles'; + +const DEFAULT_PROPS: ElevationViewProps = { + isInteractive: false, + offset: 0, + value: 0, + active: null, + focus: null, + hover: null, + borderRadius: 'inherit', +}; + +function Elevation( + props: PolymorphicComponentProps< Props, 'div', false >, + forwardedRef: Ref< any > +) { + const contextProps = useContextSystem( props, 'Elevation' ); + + return ( +