diff --git a/components/layout/layout.tsx b/components/layout/layout.tsx index 4e8a7a324c..ef9bd507a8 100644 --- a/components/layout/layout.tsx +++ b/components/layout/layout.tsx @@ -7,6 +7,7 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; export interface GeneratorProps { suffixCls: string; tagName: 'header' | 'footer' | 'main' | 'section'; + displayName: string; } export interface BasicProps extends React.HTMLAttributes { prefixCls?: string; @@ -30,9 +31,11 @@ interface BasicPropsWithTagName extends BasicProps { tagName: 'header' | 'footer' | 'main' | 'section'; } -function generator({ suffixCls, tagName }: GeneratorProps) { +function generator({ suffixCls, tagName, displayName }: GeneratorProps) { return (BasicComponent: any) => { return class Adapter extends React.Component { + static displayName: string = displayName; + static Header: any; static Footer: any; @@ -108,21 +111,25 @@ const Layout: React.ComponentClass & { } = generator({ suffixCls: 'layout', tagName: 'section', + displayName: 'Layout', })(BasicLayout); const Header = generator({ suffixCls: 'layout-header', tagName: 'header', + displayName: 'Header', })(Basic); const Footer = generator({ suffixCls: 'layout-footer', tagName: 'footer', + displayName: 'Footer', })(Basic); const Content = generator({ suffixCls: 'layout-content', tagName: 'main', + displayName: 'Content', })(Basic); Layout.Header = Header;