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

Version Path
playbook_ui-11.2.7 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.2.6 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.2.5 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.2.4 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.2.4.pre.alpha1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.2.3 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.2.2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.2.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.2.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.1.2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.1.2.pre.alpha1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.1.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.1.1.pre.alpha1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.1.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.0.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.0.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.0.0.pre.alpha.2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-11.0.0.pre.alpha.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.26.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.27.0.pre.lazysizes1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx