PageShell.tsx 1.07 KB
import type { ReactNode } from 'react';
import { PageShell as SharedPageShell } from '@/components';
import { goTo } from './navigate';

interface PageShellProps {
  title: string;
  /** 一句说明这个页面能做什么;写业务动作,不写字段名。 */
  description?: ReactNode;
  /** 子页面用:返回目标路径(相对本子应用),老系统的每个详情页都有退回入口。 */
  back?: string;
  actions?: ReactNode;
  /** 列表页:整屏定高、表体内滚、分页贴底。 */
  fill?: boolean;
  children: ReactNode;
}

/**
 * points 的页面外壳:共享层的薄封装,只多了「返回目标是一个相对路径」这一件本子应用的事。
 * 布局、标题层级、间距全部由 @uj/biz 的 PageShell 承担 —— 三个子应用共用一份,
 * 这样 system / store 接过来的时候不会长出第二套字号。
 */
export function PageShell({ back, children, ...rest }: PageShellProps) {
  return (
    <SharedPageShell {...rest} onBack={back ? () => goTo(back) : undefined}>
      {children}
    </SharedPageShell>
  );
}