react-rounded-border
Version:
React rounded border is a simple package that can add a round border to elements in React
17 lines (16 loc) • 588 B
JavaScript
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import { isValidElement, cloneElement, Children } from 'react';
export default function({ children, enabled = true }) {
function addExtraProps(child) {
if (/*#__PURE__*/ isValidElement(child)) {
return /*#__PURE__*/ cloneElement(child, {
// @ts-ignore
'rounded-border': enabled ? 'true' : 'false'
});
}
return child;
}
return /*#__PURE__*/ _jsx(_Fragment, {
children: Children.map(children, addExtraProps)
});
}