UNPKG

@wordpress/components

Version:
1 lines • 1.47 kB
{"version":3,"file":"component.mjs","names":[],"sources":["../../../src/card/card-body/component.tsx"],"sourcesContent":["import type { ForwardedRef } from 'react';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { Scrollable } from '../../scrollable';\nimport { View } from '../../view';\nimport { useCardBody } from './hook';\nimport type { BodyProps } from '../types';\n\nfunction UnconnectedCardBody(\n\tprops: WordPressComponentProps< BodyProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst { isScrollable, ...otherProps } = useCardBody( props );\n\n\tif ( isScrollable ) {\n\t\treturn <Scrollable { ...otherProps } ref={ forwardedRef } />;\n\t}\n\n\treturn <View { ...otherProps } ref={ forwardedRef } />;\n}\n\n/**\n * `CardBody` renders an optional content area for a `Card`.\n * Multiple `CardBody` components can be used within `Card` if needed.\n *\n * ```jsx\n * import { Card, CardBody } from `@wordpress/components`;\n *\n * <Card>\n * \t<CardBody>\n * \t\t...\n * \t</CardBody>\n * </Card>\n * ```\n */\nexport const CardBody = contextConnect( UnconnectedCardBody, 'CardBody' );\n\nexport default CardBody;\n"],"mappings":";;;;;;AAQA,SAAS,oBACR,OACA,cACC;CACD,MAAM,EAAE,cAAc,GAAG,eAAe,YAAa,KAAM;CAE3D,IAAK,cACJ,OAAO,oBAAC,YAAD;EAAY,GAAK;EAAa,KAAM;CAAgB,CAAA;CAG5D,OAAO,oBAAC,MAAD;EAAM,GAAK;EAAa,KAAM;CAAgB,CAAA;AACtD;;;;;;;;;;;;;;;AAgBA,MAAa,WAAW,eAAgB,qBAAqB,UAAW"}