38 lines
899 B
TypeScript
38 lines
899 B
TypeScript
import type { HTMLAttributes, ReactNode } from "react";
|
|
import { cn } from "./cn.js";
|
|
|
|
export type GlassTone = "default" | "strong" | "soft";
|
|
export type GlassRadius = "card" | "panel" | "modal";
|
|
export type GlassPadding = "none" | "sm" | "md" | "lg";
|
|
|
|
export interface GlassSurfaceProps extends HTMLAttributes<HTMLDivElement> {
|
|
children: ReactNode;
|
|
tone?: GlassTone;
|
|
radius?: GlassRadius;
|
|
padding?: GlassPadding;
|
|
materialRim?: boolean;
|
|
}
|
|
|
|
export function GlassSurface({
|
|
children,
|
|
className,
|
|
tone = "default",
|
|
radius = "card",
|
|
padding = "none",
|
|
materialRim = true,
|
|
...props
|
|
}: GlassSurfaceProps) {
|
|
return (
|
|
<div
|
|
className={cn("nodedc-glass", materialRim && "nodedc-material-rim", className)}
|
|
data-tone={tone}
|
|
data-radius={radius}
|
|
data-padding={padding === "none" ? undefined : padding}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|
|
|