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-9.9.0.alpha.inline1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.9.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.8.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.7.0.pre.alphawidth1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.7.0.pre.alpha.a11y.btn app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.7.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.6.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.6.1.pre.deps1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.6.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.5.0.alpha.rs.downgrade app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.5.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.4.0.alpha.sisense app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.4.0.alpha.user.kit.bug app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.4.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.3.1.pre.alpha2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.4.0.pre.alpha2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.4.0.pre.alpha1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.3.1.pre.alpha1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.3.0.alpha.inline3 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-9.3.0.pre.alpha.password.strength.2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx