@intility/bifrost-react
Version:
React library for Intility's design system, Bifrost.
26 lines (25 loc) • 1.02 kB
JavaScript
/* eslint-disable @typescript-eslint/no-explicit-any */ import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRef } from "react";
import classNames from "classnames";
/**
* Grid child component for spanning multiple columns
*/ const GridSpan = /*#__PURE__*/ forwardRef(({ cols = 1, small, medium, large, xl, xxl, style, className, children, ...props }, ref)=>{
const styles = {
...style,
["--bf-grid-span"]: cols,
["--bf-grid-span-s"]: small ?? cols,
["--bf-grid-span-m"]: medium ?? small ?? cols,
["--bf-grid-span-l"]: large ?? medium ?? small ?? cols,
["--bf-grid-span-xl"]: xl ?? large ?? medium ?? small ?? cols,
["--bf-grid-span-xxl"]: xxl ?? xl ?? large ?? medium ?? small ?? cols
};
return /*#__PURE__*/ _jsx("div", {
...props,
className: classNames("bf-grid-span", className),
style: styles,
ref: ref,
children: children
});
});
GridSpan.displayName = "Grid.Span";
export default GridSpan;