mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-12 07:14:14 +00:00
dont distribute info section cols
This commit is contained in:
@@ -4,18 +4,29 @@ import { cn } from "@app/lib/cn";
|
|||||||
|
|
||||||
export function InfoSections({
|
export function InfoSections({
|
||||||
children,
|
children,
|
||||||
cols
|
cols,
|
||||||
|
columnSizing = "content"
|
||||||
}: {
|
}: {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
cols?: number;
|
cols?: number;
|
||||||
|
/** content (default): fixed gap, columns hug content, left-aligned; fill: equal-width columns across the row */
|
||||||
|
columnSizing?: "fill" | "content";
|
||||||
}) {
|
}) {
|
||||||
|
const n = cols || 1;
|
||||||
|
const track =
|
||||||
|
columnSizing === "fill" ? "minmax(0, 1fr)" : "minmax(0, max-content)";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`grid grid-cols-2 md:grid-cols-(--columns) md:gap-4 gap-2 md:items-start`}
|
className={cn(
|
||||||
|
"grid grid-cols-2 md:grid-cols-(--columns) md:gap-16 gap-2 md:items-start",
|
||||||
|
columnSizing === "content" &&
|
||||||
|
"md:justify-items-start md:justify-start"
|
||||||
|
)}
|
||||||
style={{
|
style={{
|
||||||
// @ts-expect-error dynamic props don't work with tailwind, but we can set the
|
// @ts-expect-error dynamic props don't work with tailwind, but we can set the
|
||||||
// value of a CSS variable at runtime and tailwind will just reuse that value
|
// value of a CSS variable at runtime and tailwind will just reuse that value
|
||||||
"--columns": `repeat(${cols || 1}, minmax(0, 1fr))`
|
"--columns": `repeat(${n}, ${track})`
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
Reference in New Issue
Block a user