Sha256: d56cf8b123484d9e8c58856f11d1c4c68dd3f73f052e3f505e0bc73574db897e

Contents?: true

Size: 1.42 KB

Versions: 353

Compression:

Stored size: 1.42 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,
  maxHeight?: string,
  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, maxHeight, 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"
        maxHeight={maxHeight}
        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

353 entries across 353 versions & 1 rubygems

Version Path
playbook_ui-14.5.0.pre.alpha.PLAY1510railsformloading3977 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1510railsformloading3976 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1510railsformloading3975 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.6.0.pre.rc.4 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.6.0.pre.rc.3 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.6.0.pre.rc.2 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3954 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3953 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3950 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.PBNTR374multilevelselectPOC3946 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3944 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.6.0.pre.rc.1 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.psych4support3941 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3940 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.javascriptassets3939 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.javascriptassets3932 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3931 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3930 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.javascriptassets3929 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
playbook_ui-14.5.0.pre.alpha.javascriptassets3928 app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx