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

Version Path
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.21.0.pre.alpha.lightbox.2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.21.0.pre.alpha.lightbox app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.20.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.19.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.19.0.pre.lightbox app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.18.2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.19.0.pre.popover.alpha1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.18.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.18.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.17.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.16.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.15.1 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.15.1.pre.alpha.rubocop.deps app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.15.0 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx
playbook_ui-10.14.1.pre.alpha2 app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx