All files / components / layout / Layout.tsx

100.00% Branches 0/0
9.52% Lines 2/21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
x2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
x2













































import LayoutManager from "@islands/LayoutManager.tsx";
import { JSX } from "preact";

interface LayoutProps {
  children: JSX.Element | JSX.Element[] | string;
  title?: string;
  showSidebar?: boolean;
  /** 是否显示返回顶部按钮,默认 true */
  showBackToTop?: boolean;
  /** 返回顶部按钮样式变体 */
  backToTopVariant?:
    | "default"
    | "primary"
    | "secondary"
    | "success"
    | "warning"
    | "danger";
  /** 返回顶部按钮显示阈值,默认 300px */
  backToTopThreshold?: number;
  /** 强制显示返回顶部按钮(用于调试),默认 false */
  backToTopForceVisible?: boolean;
}

const Layout = ({
  children,
  title,
  showSidebar = true,
  showBackToTop = true,
  backToTopVariant = "primary",
  backToTopThreshold = 300,
  backToTopForceVisible = false,
}: LayoutProps) => {
  return (
    <LayoutManager
      title={title}
      showSidebar={showSidebar}
      showBackToTop={showBackToTop}
      backToTopVariant={backToTopVariant}
      backToTopThreshold={backToTopThreshold}
      backToTopForceVisible={backToTopForceVisible}
    >
      {children}
    </LayoutManager>
  );
};

export default Layout;