mirror of
https://github.com/better-auth/better-auth.git
synced 2026-06-01 11:56:43 -05:00
25 lines
513 B
TypeScript
25 lines
513 B
TypeScript
import { Slot } from "@radix-ui/react-slot";
|
|
import type { ReactNode } from "react";
|
|
|
|
export interface BaseLayoutProps {
|
|
children?: ReactNode;
|
|
}
|
|
|
|
export function replaceOrDefault(
|
|
obj:
|
|
| {
|
|
enabled?: boolean;
|
|
component?: ReactNode;
|
|
}
|
|
| undefined,
|
|
def: ReactNode,
|
|
customComponentProps?: object,
|
|
disabled?: ReactNode,
|
|
): ReactNode {
|
|
if (obj?.enabled === false) return disabled;
|
|
if (obj?.component !== undefined)
|
|
return <Slot {...customComponentProps}>{obj.component}</Slot>;
|
|
|
|
return def;
|
|
}
|