mirror of
https://github.com/better-auth/better-auth.git
synced 2026-07-30 17:12:35 -05:00
Co-authored-by: KinfeMichael Tariku <65047246+Kinfe123@users.noreply.github.com> Co-authored-by: Kinfe123 <kinfishtech@gmail.com>
25 lines
513 B
TypeScript
25 lines
513 B
TypeScript
import type { ReactNode } from "react";
|
|
import { Slot } from "@radix-ui/react-slot";
|
|
|
|
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;
|
|
}
|