import { ReactFC } from '@formily/reactive-react' import { each } from '@nokecy/designable-shared' import cls from 'classnames' import React, { Fragment, useContext, useLayoutEffect, useRef } from 'react' import { DesignerLayoutContext } from '../context' import { IDesignerLayoutProps } from '../types' export const Layout: ReactFC = (props) => { const layout = useContext(DesignerLayoutContext) const ref = useRef(null) useLayoutEffect(() => { const { current } = ref const { variables } = props if (current && variables) { each(variables, (value, key) => { current.style.setProperty(`--${key}`, value) }) } }, [props.variables]) if (layout) { return {props.children} } return (
['position'], }} > {props.children}
) } Layout.defaultProps = { theme: 'light', prefixCls: 'dn-', position: 'fixed', }