Sha256: 5be706f5534dff89609e2b71f2039bdac90dd6f07824e34473974695da29379d
Contents?: true
Size: 1 KB
Versions: 41
Compression:
Stored size: 1 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' 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
41 entries across 41 versions & 1 rubygems