import { KnobInspector, unstable_KnobContext } from '@fluentui/docs-components'; import { Flex, Header, Segment } from '@fluentui/react-northstar'; import * as _ from 'lodash'; import * as React from 'react'; import ComponentPlaygroundSnippet from './ComponentPlaygroundSnippet'; type ComponentPlaygroundTemplateProps = { element?: React.ReactElement; component?: React.FunctionComponent; fluid?: boolean; }; const NoopKnobProvider: React.FunctionComponent = props => { const knobContext = React.useContext(unstable_KnobContext); const noopContext = { ...knobContext, registerKnob: _.noop, unregisterKnob: _.noop }; return {props.children}; }; const ComponentPlaygroundTemplate: React.FunctionComponent = props => ( {props.element || React.createElement(props.component)} {/* ComponentPlaygroundSnippet will evaluate passed component again and if it contains knobs it will execute them again and will fail because hooks with that name have been already registered. */}
Props
{props.children}
); export default ComponentPlaygroundTemplate;