2023-02-20 10:51:18 +08:00
|
|
|
import type { IPreviewerProps } from 'dumi';
|
|
|
|
import { useTabMeta } from 'dumi';
|
2023-07-07 18:28:13 +08:00
|
|
|
import React from 'react';
|
2023-02-20 10:51:18 +08:00
|
|
|
import CodePreviewer from './CodePreviewer';
|
|
|
|
import DesignPreviewer from './DesignPreviewer';
|
|
|
|
|
2023-04-11 10:13:58 +08:00
|
|
|
export interface AntdPreviewerProps extends IPreviewerProps {
|
|
|
|
originDebug?: IPreviewerProps['debug'];
|
|
|
|
}
|
|
|
|
|
2023-07-07 18:28:13 +08:00
|
|
|
const Previewer: React.FC<AntdPreviewerProps> = (props) => {
|
2023-02-20 10:51:18 +08:00
|
|
|
const tab = useTabMeta();
|
|
|
|
|
|
|
|
if (tab?.frontmatter.title === 'Design') {
|
|
|
|
return <DesignPreviewer {...props} />;
|
2016-02-29 14:08:40 +08:00
|
|
|
}
|
2023-01-05 20:10:03 +08:00
|
|
|
|
2023-02-20 10:51:18 +08:00
|
|
|
return <CodePreviewer {...props} />;
|
2023-01-05 20:10:03 +08:00
|
|
|
};
|
2019-08-08 12:35:48 +08:00
|
|
|
|
2023-02-20 10:51:18 +08:00
|
|
|
export default Previewer;
|