narraleaf-react
Version:
A React visual novel player framework
49 lines (48 loc) • 1.42 kB
TypeScript
import React from "react";
import { LayoutRouter } from "./router";
type LayoutContextType = {
router: LayoutRouter;
path: string | null;
consumedBy?: string;
};
type LayoutContextProviderProps = {
children: React.ReactNode;
path: string | null;
consumedBy?: string;
};
export declare function LayoutRouterProvider({ children, path, consumedBy }: LayoutContextProviderProps): React.JSX.Element;
export declare function useLayout(): Omit<LayoutContextType, "path"> & {
path: string;
};
export type LayoutProps = {
children: React.ReactNode;
/**
* The relative path of the layout. It can be a path or a path pattern.
*
* @example
* ```typescript
* // Can be navigated to by "/home"
* <Layout name="home">
* <div>Home</div>
* </Layout>
*
* <Layout name="user">
* // equivalent to "/user/:id"
* // Can be navigated to by "/user/123"
* <Layout name=":id">
* <div>User</div>
* </Layout>
* </Layout>
* ```
*/
name: string;
/**
* When true, exit animations will be propagated to nested AnimatePresence components.
*/
propagate?: boolean;
};
export declare function Layout({ children, name, propagate }: LayoutProps): React.JSX.Element;
export declare function RootLayout({ children }: {
children: React.ReactNode;
}): React.JSX.Element;
export {};