import * as React from 'react'; import * as FUI from '@fluentui/react-northstar'; import { ComponentInfo } from '../componentInfo/types'; type ComponentAnatomySlotProps = { name: string; }; export const ComponentAnatomy: React.FunctionComponent<{ componentInfo: ComponentInfo }> & { Slot: React.FunctionComponent; } = ({ componentInfo }) => { const shorthandProps = componentInfo.props.filter(propDef => propDef.types.some(type => { return type.name === 'ShorthandValue' || type.name === 'ShorthandCollection'; }), ); if (shorthandProps.length === 0) { return null; } return (
Slots {shorthandProps.map(propDef => ( ))}
); }; const ComponentAnatomySlot: React.FunctionComponent = ({ name }) => (
{name} +
); ComponentAnatomy.Slot = ComponentAnatomySlot;