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-11.6.0.pre.alpha.rubocopperf1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.6.1.pre.alpha.rubocop.pre.performance1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.5.0.pre.alpha.pre.rubocop app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.6.0.pre.alpha.momenttz1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.5.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.4.0.pre.alpha.rubytheme2 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.4.0.pre.alpha.rubytheme1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.4.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.3.0.pre.alpha2 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.3.0.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.3.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.2.7 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.2.6 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.2.5 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.2.4 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.2.4.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.2.3 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.2.2 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.2.1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx
playbook_ui-11.2.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx