import React, { ComponentType } from "react"; import { Separator } from "@sparkle/components/Separator"; import { classNames } from "@sparkle/lib/utils"; import { Button, ButtonProps } from "./Button"; import { Icon } from "./Icon"; interface PageProps { children: React.ReactNode; variant?: "modal" | "normal"; } export function Page({ children, variant = "normal" }: PageProps) { const mainVariantClasses = variant === "normal" ? "s-h-full s-py-16" : "s-h-full s-py-4 s-px-2"; const divVariantClassNames = variant === "normal" ? "s-gap-6 s-px-6" : "s-gap-4"; return (
{children}
); } interface PageHeaderProps { title: React.ReactNode; description?: React.ReactNode; icon?: ComponentType<{ className?: string }>; } Page.Header = function ({ title, description, icon }: PageHeaderProps) { return ( {title} {description && {description}} ); }; interface PageSectionHeaderProps { title: string; description?: string; action?: ButtonProps; } Page.SectionHeader = function ({ title, description, action, }: PageSectionHeaderProps) { return ( {title} {description} {action && (
)}
); }; Page.Separator = function () { return ; }; interface PagePProps { children: React.ReactNode; size?: "sm" | "md" | "lg"; variant?: "primary" | "secondary"; } const PsizeClasses = { xs: "s-copy-xs", sm: "s-copy-sm", md: "s-copy-base", lg: "s-copy-lg", }; Page.P = function ({ children, variant, size = "sm" }: PagePProps) { return (

{children}

); }; interface PageHProps { variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; children: React.ReactNode; } Page.H = function ({ children, variant = "h3" }: PageHProps) { const Component = variant; const hSizes = { h1: "s-heading-4xl", h2: "s-heading-3xl", h3: "s-heading-2xl", h4: "s-heading-xl", h5: "s-heading-lg", h6: "s-heading-base", }; return ( {children} ); }; interface PageLayoutProps { children: React.ReactNode; direction?: "horizontal" | "vertical" | "fluid"; sizing?: "shrink" | "grow"; align?: "stretch" | "left" | "center" | "right"; gap?: "xs" | "sm" | "md" | "lg" | "xl" | "none"; } const gapSizes = { xs: "s-gap-1", sm: "s-gap-2", md: "s-gap-3", lg: "s-gap-5", xl: "s-gap-8", none: "", }; Page.Layout = function ({ children, direction = "vertical", sizing, align = "stretch", gap = "lg", }: PageLayoutProps) { switch (direction) { case "horizontal": return ( ); case "vertical": return ( ); case "fluid": return ( ); default: return null; } }; interface PageDivProps { children: React.ReactNode; sizing?: "shrink" | "grow"; align?: "stretch" | "left" | "center" | "right"; gap?: "xs" | "sm" | "md" | "lg" | "xl" | "none"; } Page.Horizontal = function ({ children, sizing, align = "left", gap = "lg", }: PageDivProps) { return (
{children}
); }; Page.Vertical = function ({ children, sizing, align = "left", gap = "md", }: PageDivProps) { return (
{children}
); }; Page.Fluid = function ({ children, sizing, align = "stretch", gap = "xs", }: PageDivProps) { return (
{children}
); };