@intility/bifrost-react
Version:
React library for Intility's design system, Bifrost.
33 lines • 971 B
JavaScript
/* eslint-disable @typescript-eslint/no-explicit-any */
import { forwardRef } from "react";
import classNames from "classnames";
import { jsx as _jsx } from "react/jsx-runtime";
/**
* Responsive CSS Grid layout container, renders its children as columns based
* on a column width (300px columns by default)
*
* @see https://bifrost.intility.com/react/autoCol
*/
const AutoCol = /*#__PURE__*/forwardRef(({
children,
className,
style,
gap,
width,
...props
}, ref) => {
const styles = {
...style,
["--bf-autocol-gap"]: typeof gap === "number" ? gap + "px" : typeof gap === "string" ? gap : undefined,
["--bf-autocol-width"]: typeof width === "number" ? width + "px" : typeof width === "string" ? width : undefined
};
return /*#__PURE__*/_jsx("div", {
...props,
ref: ref,
className: classNames("bf-autocol", className),
style: styles,
children: children
});
});
AutoCol.displayName = "AutoCol";
export default AutoCol;