import { Card } from '@automattic/components'; import clsx from 'clsx'; import { filter, findLast } from 'lodash'; import PropTypes from 'prop-types'; import DocsSelectorsParamType from './param-type'; export default function DocsSelectorsResult( { url, name, description, tags, expanded } ) { const paramTags = filter( tags, { title: 'param' } ); const returnTag = findLast( tags, { title: 'return' } ); const classes = clsx( 'docs-selectors__result', { 'is-expanded': expanded, } ); return (

{ url && { name } } { ! url && name }

{ description || No description available }

{ paramTags.length > 0 && (
Arguments { paramTags.map( ( tag ) => (
{ tag.name }

{ tag.description }

) ) }
) } { returnTag && (
Returns

{ returnTag.description }

) }
); } DocsSelectorsResult.propTypes = { url: PropTypes.string, name: PropTypes.string, description: PropTypes.string, tags: PropTypes.array, expanded: PropTypes.bool, };