Sha256: 68ac581387694cd64eb5aecb2f1e2c1abbc695b0d250064c6a4cb22c1cea9497

Contents?: true

Size: 1.02 KB

Versions: 76

Compression:

Stored size: 1.02 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 '../_collapsible.jsx'

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

76 entries across 76 versions & 1 rubygems

Version Path
playbook_ui-8.2.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.1.3 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.4.0.alpha.dependencies.2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.4.0.alpha.dependencies.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.2.0.pre.alpha4 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.2.0.pre.alpha3 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.2.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.1.2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.1.0.pre.alpha1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.2.0.pre.alpha2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.1.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.2.0.pre.alpha1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-8.1.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-7.4.0.pre.alpha5 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-7.4.0.pre.alpha2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx