Sha256: b4284fe22a767b8f541fe71348ef8dba2f199eebdda16bf009c02f5827381424

Contents?: true

Size: 1.88 KB

Versions: 92

Compression:

Stored size: 1.88 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,
  popoverProps,
  ...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}
                popoverProps={popoverProps}
            >
            {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

92 entries across 92 versions & 1 rubygems

Version Path
playbook_ui-14.9.0.pre.rc.8 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4617 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.9.0.pre.rc.7 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.9.0.pre.rc.6 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.9.0.pre.rc.5 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.8.0.pre.alpha.pbntr661createstickyleftprop4612 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4606 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.9.0.pre.rc.4 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.9.0.pre.rc.3 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.9.0.pre.rc.2 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4567 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4565 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4563 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4559 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.9.0.pre.rc.1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.8.0.pre.alpha.PLAY16254545 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4543 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4539 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.9.0.pre.rc.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.7.0.pre.alpha.dependabotnpmandyarnfloatinguireact026284532 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx