import { jsx as _jsx } from "react/jsx-runtime";
import { useContext, useEffect, useRef } from "react";
import { LayoutContext } from "./layoutContext";
import { Slot } from "@radix-ui/react-slot";
import { cn } from "..";
export const Footer = (props)=>{
    const ref = useRef(null);
    const { asChild, className, ...rest } = props;
    const { setFooterHeight, isTopLevel } = useContext(LayoutContext);
    if (!isTopLevel) {
        throw new Error("Footer component must be in top layout component.");
    }
    useEffect(()=>{
        const boundingClientRect = ref.current?.getBoundingClientRect();
        if (boundingClientRect && boundingClientRect.height) {
            // console.log(boundingClientRect);
            setFooterHeight(boundingClientRect.height);
        }
    }, []);
    const Comp = asChild ? Slot : "div";
    return /*#__PURE__*/ _jsx(Comp, {
        ...rest,
        className: cn("orderly-fixed orderly-bottom-0 orderly-left-0 orderly-right-0", className),
        ref: ref
    });
};
Footer.displayName = "Footer";

//# sourceMappingURL=footer.js.map