Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createBootstrapComponent(Component, opts) {
if (typeof opts === 'string') opts = { prefix: opts };
const isClassy = Component.prototype && Component.prototype.isReactComponent;
// If it's a functional component make sure we don't break it with a ref
const { prefix, forwardRefAs = isClassy ? 'ref' : 'innerRef' } = opts;
return forwardRef(
// eslint-disable-next-line react/prop-types
({ className, float, ...props }, ref) => {
props[forwardRefAs] = ref;
const prefixes = useContext(ThemeContext);
let floats = null;
if (float && Object.keys(float).length > 0) {
floats = Object.entries(float).reduce(
(acc, [property, value]) =>
acc +
(property !== 'default'
? `float-${property}-${value} `
: `float-${value} `),
'',
);
}
return (