UNPKG

@nwebui/react-niagara-px

Version:
25 lines 835 B
import React from "react"; import useWidgetChanged from "./useWidgetChanged"; import { color } from "./utils"; import { Widget } from "./Widget"; const Rect = function ({ nativeWidget, children }) { useWidgetChanged(nativeWidget); const geom = nativeWidget.gets("geom"); const fill = nativeWidget.gets("fill"); const style = { background: color(fill), }; if (geom) { const [x, y, w, h] = geom.split(",").map((x) => +x); Object.assign(style, { position: "absolute", left: `${x}px`, top: `${y}px`, width: `${w}px`, height: `${h}px`, }); } return (React.createElement(Widget, { nativeWidget: nativeWidget, style: style }, children)); }; export default Rect; //# sourceMappingURL=Rect.js.map