import * as React from 'react'; import * as _ from 'lodash'; import ComponentExampleTitle from '../ComponentExample/ComponentExampleTitle'; import { Accordion, Flex, Segment, Menu, Loader } from '@fluentui/react-northstar'; import ComponentExample from '../ComponentExample'; const ComponentPerfChart = React.lazy(async () => ({ default: (await import(/* webpackChunkName: "component-chart" */ './ComponentPerfChart')).ComponentPerfChart, })); const ComponentResourcesChart = React.lazy(async () => ({ default: (await import(/* webpackChunkName: "component-chart" */ './ComponentResourcesChart')) .ComponentResourcesChart, })); export interface ComponentPerfExampleProps { title: React.ReactNode; description?: React.ReactNode; examplePath: string; } const ComponentPerfExample: React.FC = props => { const { title, description, examplePath } = props; const [currentChart, setCurrentChart] = React.useState<'perf' | 'resources'>('perf'); // "components/Divider/Performance/Divider.perf" -> dividerPerfTsx const perfTestName = `${_.camelCase(_.last(examplePath.split('/')))}Tsx`; return ( <> setCurrentChart('perf'), }, { content: 'Resources', key: 'resources', active: currentChart === 'resources', onClick: () => setCurrentChart('resources'), }, ]} /> }> {currentChart === 'perf' ? ( ) : ( )} { return { fontSize: theme.siteVariables.fontSizes.smaller, }; }, }, content: { key: 'c', content: , // FIXME: defer rendering until opened }, }, ] as any[] } /> ); }; export default ComponentPerfExample;