Sha256: 51adb1123da70b8f9ede458d754ce1f613dd09fdbe8a77db4c71e9e67a155cb2

Contents?: true

Size: 1.36 KB

Versions: 357

Compression:

Stored size: 1.36 KB

Contents

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

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

type FiltersPopoverProps = { 
  children?: React.ReactChild[] | React.ReactChild | (({closePopover}: {closePopover: () => void}) =>  ReactNode), 
  dark?: boolean,
  minWidth?: string,
  placement?: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end",
}
const FiltersPopover = ({ children, dark, minWidth, placement = "bottom-start" }: FiltersPopoverProps): React.ReactElement => {
  const [hide, updateHide] = useState(true)
  const toggle = () => updateHide(!hide)

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

  return (
    <PbReactPopover
        closeOnClick="outside"
        minWidth={minWidth}
        placement={placement}
        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

357 entries across 357 versions & 1 rubygems

Version Path
playbook_ui-13.18.0.pre.alpha.thor93bargraphoptions2219 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.thor93bargraphoptions2211 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.play1141iconkitusinglibrary2210 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.powercentrainplaybookpt22201 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.PLAY8672199 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.PBNTR191AdvancedTableFinalFixes2197 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.dependabotnpmandyarnreactrouterdom62212196 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.dependabotnpmandyarntypescripteslintparser56202194 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.useexactnodejsversionghactions2183 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.useexactnodejsversionghactions2181 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.useexactnodejsversionghactions2180 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.useexactnodejsversionghactions2179 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.PBNTR191AdvancedTableFinalFixes2178 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.PBNTR191AdvancedTableFinalFixes2176 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.dependabotnpmandyarnpowerhomeplaybookicons001alpha52175 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.dependabotnpmandyarnpowerhomeplaybookicons001alpha52174 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.PBNTR191AdvancedTableFinalFixes2173 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0.pre.alpha.PBNTR191AdvancedTableFinalFixes2159 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.17.0.pre.alpha.nodealphaupgrade2157 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-13.18.0 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx