Sha256: 6ad37942b97797395efcd541937b23ad9723cb6f4d700bfe3a08cf1cb113f44f

Contents?: true

Size: 1.03 KB

Versions: 105

Compression:

Stored size: 1.03 KB

Contents

/* @flow */

import React, { Node, useState } from 'react'

import CircleIconButton from '../../pb_circle_icon_button/_circle_icon_button'
import PbReactPopover from '../../pb_popover/_popover'

const FiltersPopoverProps = { children: Node }
const FiltersPopover = ({ children, dark, minWidth }: FiltersPopoverProps) => {
  const [hide, updateHide] = useState(true)
  const toggle = () => updateHide(!hide)

  const filterButton = (
    <CircleIconButton
        dark={dark}
        icon="filter"
        id="filter"
        onClick={toggle}
        text="filter"
        variant="secondary"
    />
  )

  return (
    <PbReactPopover
        closeOnClick="outside"
        minWidth={minWidth}
        placement="bottom"
        reference={filterButton}
        shouldClosePopover={updateHide}
        show={!hide}
    >
      <div className="pb-form">
        {typeof children === 'function'
          ? children({ closePopover: () => (updateHide(true)) })
          : children}
      </div>
    </PbReactPopover>
  )
}

export default FiltersPopover

Version data entries

105 entries across 105 versions & 1 rubygems

Version Path
playbook_ui-10.25.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.25.0.pre.alpha3 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.25.0.pre.treeshaking1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.24.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.24.0.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.23.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.23.0.pre.alpha2 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.23.0.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.22.1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.22.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.21.1.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.21.0.pre.alpha.lightbox.2 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.21.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.21.0.pre.alpha.lightbox app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-10.20.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx