2024-06-29 18:18:29 +00:00
|
|
|
/*
|
|
|
|
* Vencord, a Discord client mod
|
|
|
|
* Copyright (c) 2024 Vendicated and contributors
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
|
|
|
|
2025-01-04 06:24:50 +00:00
|
|
|
import { CSSProperties, JSX } from "react";
|
2024-06-29 18:18:29 +00:00
|
|
|
|
|
|
|
interface Props {
|
|
|
|
columns: number;
|
|
|
|
gap?: string;
|
|
|
|
inline?: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function Grid(props: Props & JSX.IntrinsicElements["div"]) {
|
|
|
|
const style: CSSProperties = {
|
|
|
|
display: props.inline ? "inline-grid" : "grid",
|
|
|
|
gridTemplateColumns: `repeat(${props.columns}, 1fr)`,
|
|
|
|
gap: props.gap,
|
|
|
|
...props.style
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div {...props} style={style}>
|
|
|
|
{props.children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|