Sha256: bd3725baca5eb30c70c433746af911959f08e4ceb6b72cb0cc95c41913284a1b
Contents?: true
Size: 1.01 KB
Versions: 53
Compression:
Stored size: 1.01 KB
Contents
/* @flow */ import classnames from 'classnames' import React, { useContext } from 'react' import AnimateHeight from 'react-animate-height' import { buildCss } from '../../utilities/props' import { globalProps } from '../../utilities/globalProps.js' import CollapsibleContext from '../context' type CollapsibleContentProps = { children: array<React.ReactNode> | React.ReactNode | string, className?: string, padding?: string, } const CollapsibleContent = ({ children, className, padding = 'md', ...props }: CollapsibleContentProps) => { const context = useContext(CollapsibleContext) const contentCSS = buildCss('pb_collapsible_content_kit') const contentSpacing = globalProps(props, { padding }) return ( <div className={classnames(contentCSS, className, contentSpacing)}> <AnimateHeight duration={300} height={context.collapsed ? 0 : 'auto'} id="bottom-section" > {children} </AnimateHeight> </div> ) } export default CollapsibleContent
Version data entries
53 entries across 53 versions & 1 rubygems