forked from hpcc-systems/HPCC-Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCardGroup.tsx
More file actions
60 lines (54 loc) · 1.63 KB
/
Copy pathCardGroup.tsx
File metadata and controls
60 lines (54 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import * as React from "react";
import { makeStyles, mergeClasses, tokens } from "@fluentui/react-components";
const useStyles = makeStyles({
root: {
display: "grid",
alignItems: "start",
alignContent: "start",
justifyContent: "start",
placeContent: "start",
width: "100%",
boxSizing: "border-box",
}
});
export interface CardGroupProps {
children?: React.ReactNode;
minColumnWidth?: number | string;
autoRows?: number | string;
columnGap?: string;
rowGap?: string;
paddingInline?: string;
paddingBlock?: string;
scrollY?: boolean;
className?: string;
style?: React.CSSProperties;
}
export const CardGroup: React.FunctionComponent<CardGroupProps> = ({
children,
minColumnWidth = 280,
autoRows = 320,
columnGap = tokens.spacingHorizontalM,
rowGap = tokens.spacingHorizontalM,
paddingInline = tokens.spacingHorizontalM,
paddingBlock = tokens.spacingVerticalM,
scrollY = false,
className,
style
}) => {
const styles = useStyles();
const toCssLen = (v: number | string) => typeof v === "number" ? `${v}px` : v;
const computedStyle: React.CSSProperties = {
gridTemplateColumns: `repeat(auto-fill, minmax(${toCssLen(minColumnWidth)}, 1fr))`,
columnGap,
rowGap,
paddingInline,
paddingBlock,
gridAutoRows: toCssLen(autoRows),
overflowY: scrollY ? "auto" : undefined,
minHeight: scrollY ? 0 : undefined,
...style
};
return <div className={mergeClasses(styles.root, className)} style={computedStyle}>
{children}
</div>;
};