Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | 10x 10x 12x 12x 5x 5x | import React from "react"; import classNames from "classnames"; import { InferProps, StyledProps } from "../_type"; import { createRocket } from "../_util/create-rocket"; import { Icon } from "../icon"; import { Justify } from "../justify"; import { useConfig } from "../_util/config-context"; export interface LayoutContentHeaderProps extends StyledProps { /** * 是否展示返回按钮 * * @default false */ showBackButton?: boolean; /** * 返回按钮点击回调 */ onBackButtonClick?: (event: React.MouseEvent) => void; /** * 标题 */ title?: React.ReactNode; /** * 小标题(说明文字) */ subtitle?: React.ReactNode; /** * 标题后区域内容 */ children?: React.ReactNode; /** * 操作区内容 */ operation?: React.ReactNode; } export function LayoutContentHeader({ showBackButton, onBackButtonClick = () => null, title, subtitle, children, operation, className, style, }: LayoutContentHeaderProps) { const { classPrefix } = useConfig(); return ( <div className={classNames(`${classPrefix}-layout__content-header`, className)} style={style} > <div className={`${classPrefix}-layout__header-title`}> <Justify left={ <> {showBackButton && ( <a className={`${classPrefix}-content__header-back`} onClick={onBackButtonClick} > <Icon type="btnback" /> </a> )} <h2 className={`${classPrefix}-h2`}>{title}</h2> {children} {subtitle && ( <span className={`${classPrefix}-layout__header-text`}> {subtitle} </span> )} </> } right={operation} /> </div> </div> ); } export interface LayoutContentBodyProps extends StyledProps { /** * 是否为全屏 * * @default false */ full?: boolean; /** * 内容 */ children?: React.ReactNode; } export function LayoutContentBody({ full, children, className, style, }: LayoutContentBodyProps) { const { classPrefix } = useConfig(); return ( <div className={classNames(`${classPrefix}-layout__content-body`, className)} style={style} > <div className={classNames(`${classPrefix}-layout__content-body-inner`, { [`${classPrefix}-layout__content-body-inner--full`]: full, })} > {children} </div> </div> ); } const LayoutContentFooter = createRocket( "LayoutContentFooter", "div.@{prefix}-layout__content-footer" ); export const LayoutContent = Object.assign( createRocket( "LayoutContent", "main.@{prefix}-layout__content", "div.@{prefix}-layout__content-inner" ), { Header: LayoutContentHeader, Body: LayoutContentBody, Footer: LayoutContentFooter, } ); export interface LayoutContentProps extends InferProps<typeof LayoutContent> {} |