import cx from "classnames"; import React from "react"; import { genResponsiveClasses } from "../../utils"; export type GridColAlign = "top" | "middle" | "bottom" | "stretch"; export type GridColSize = | number | "shrink" | "fill" | "auto" | Record; export interface GridColProps extends React.HTMLAttributes { align?: GridColAlign; tag?: React.ElementType; size?: GridColSize; } const CLASS_ROOT = "grid__col"; export const GridCol = ({ className, align, tag = "div", size, ...other }: GridColProps) => { const responsiveClasses = genResponsiveClasses(CLASS_ROOT, size); const classes = cx( CLASS_ROOT, // Always apply base class ...responsiveClasses.filter(Boolean), // Filter out null/undefined values { [`align-self-${align}`]: align, }, className, ); const TagName = tag; return ; }; GridCol.displayName = "GridCol";