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.6.0.pre.rc.22 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.21 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4175 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.20 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4162 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PBNTR614advancedtablepoc4155 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.19 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.18 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.play1549upgradereactmodal4130 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1601updatereactzoompanpinch4128 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1601updatereactzoompanpinch4123 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.17 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.play1586datearea4115 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.16 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4098 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4097 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4094 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.15 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4077 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.6.0.pre.rc.14 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx