Sha256: 8f37686888dfadd8a1199f6251678111d85964215be62f818e42cfd73c8af9ad

Contents?: true

Size: 1.82 KB

Versions: 351

Compression:

Stored size: 1.82 KB

Contents

import React from 'react'
import { isEmpty } from 'lodash'

import Flex from '../../pb_flex/_flex'

import CurrentFilters, { FilterDescription } from './CurrentFilters'
import FilterBackground, { FilterBackgroundProps } from './FilterBackground'
import FiltersPopover from './FiltersPopover'
import ResultsCount from './ResultsCount'
import SortMenu, {
  SortingChangeCallback,
  SortOptions,
  SortValue,
} from './SortMenu'

export type FilterSingleProps = {
  children?: React.ReactChild[] | React.ReactChild,
  filters?: FilterDescription,
  onSortChange?: SortingChangeCallback,
  results?: number,
  sortOptions?: SortOptions,
  sortValue?: SortValue[],
} & FilterBackgroundProps

const FilterSingle = ({
  onSortChange,
  sortOptions,
  sortValue,
  filters,
  results,
  children,
  dark,
  maxHeight,
  minWidth,
  placement,
  ...bgProps
}: FilterSingleProps): React.ReactElement => {
  return (
    <FilterBackground
        dark={dark}
        {...bgProps}
    >
      <Flex
          orientation="row"
          paddingRight="lg"
          vertical="center"
      >
        { children && 
          <>
            <FiltersPopover
                dark={dark}
                maxHeight={maxHeight}
                minWidth={minWidth}
                placement={placement}
            >
            {children}
            </FiltersPopover>
            <CurrentFilters
                dark={dark}
                filters={filters}
            />
          </>
        }
        <ResultsCount
            dark={dark}
            results={results}
        />
        { !isEmpty(sortOptions) &&
            <SortMenu
                dark={dark}
                onChange={onSortChange}
                options={sortOptions}
                value={sortValue}
            />
        }
      </Flex>
    </FilterBackground>
  )
}

export default FilterSingle

Version data entries

351 entries across 351 versions & 1 rubygems

Version Path
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4073 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PBNTR600reactfilterdisplayzeroresults4068 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY15814066 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PBNTR568dropdowncleaning4044 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PBNTR568dropdowncleaning4041 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY15814040 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.13 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4037 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.20241007playbookwebsiteaddrdbms4036 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PBNTR606multilevelselectreset4035 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4032 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4028 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.12 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.11 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.10 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.9 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.8 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.7 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.6 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.5 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx