UNPKG

narraleaf-react

Version:

A React visual novel player framework

47 lines (46 loc) 1.82 kB
import React from "react"; export type PageProps = Readonly<{ children?: React.ReactNode; /** * The name of the page. It can be a dynamic string, null, or undefined. * * If name is null or undefined, this page becomes the default handler for its parent layout. * It will be rendered whenever the parent layout matches and no specific page name matches. * * @example * <Page name="home"> * // Can be navigated to by "/home" * <div>Home</div> * </Page> * * <Layout path="user"> * <Page name="profile"> * // Can be navigated to by "/user/profile" * <div>User Profile</div> * </Page> * * <Page name={null}> * // Default handler for "/user" - renders when no specific page matches * <div>User Default Page</div> * </Page> * </Layout> * * <Layout path="user"> * <Layout path=":id"> * <Page name="profile"> * // Can be navigated to by "/user/123/profile" * <div>User Profile</div> * </Page> * </Layout> * </Layout> * ``` */ name?: string | null; }>; type PageInjectContextType = { name: string | null | undefined; }; export declare const PageInjectContext: React.Context<PageInjectContextType | null>; export declare function usePageInject(): PageInjectContextType | null; export declare function Page({ children, name: nameProp }: PageProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined; export {};