How to use the react-styleguidist/lib/rsg-components/Props/util.getType function in react-styleguidist

To help you get started, we’ve selected a few react-styleguidist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amalto / platform6-ui-components / typescript / custom / PropsRenderer.tsx View on Github external
private renderTypeColumn = (prop): JSX.Element => {
        if (prop.flowType) {
            return {this.renderFlowType( getType( prop ) )}
        }
        return {this.renderType( getType (prop ) )}
    }
}
github amalto / platform6-ui-components / typescript / custom / PropsRenderer.tsx View on Github external
private renderUnion = ( prop ): JSX.Element => {
        if ( !Array.isArray( getType( prop ).value ) ) {
            return <span>{getType(prop).value}</span>
        }
    
        const values = getType( prop ).value.map( ( value, index ) =&gt; (
            {this.renderType( value )}
        ))
        return (
            <span>
                One of type:{' '}
                
                    {values}
                
            </span>
        )
    }
github amalto / platform6-ui-components / typescript / custom / PropsRenderer.tsx View on Github external
private renderTypeColumn = (prop): JSX.Element =&gt; {
        if (prop.flowType) {
            return {this.renderFlowType( getType( prop ) )}
        }
        return {this.renderType( getType (prop ) )}
    }
}
github amalto / platform6-ui-components / typescript / custom / PropsRenderer.tsx View on Github external
private renderExtra = ( prop ): JSX.Element | JSX.Element[] => {
        const type = getType( prop )
    
        if ( !type ) return null

        switch ( type.name ) {
            case 'enum':
                return this.renderEnum( prop )
            case 'union':
                return this.renderUnion( prop )
            case 'shape':
                return this.renderShape( prop.type.value )
            case 'arrayOf':
                if ( type.value.name === 'shape' ) {
                    return this.renderShape( prop.type.value.value )
                }
                return null
            case 'objectOf':