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.rc.11 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.10 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.9 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.8 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.7 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.6 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.5 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.4 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.3 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.2 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.4.0.pre.alpha.PBNTR490multilevelselect3832 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.4.0.pre.alpha.PLAY1546highchartsbump3831 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.4.0.pre.alpha.dependabotnpmandyarntiptapextensionparagraph2723830 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.4.0.pre.alpha.dependabotnpmandyarntiptapextensionlink2723828 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.4.0.pre.alpha.pbntr523enablekitsforradiofix3826 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.4.0.pre.alpha.pbntr523enablekitsforradiofix3825 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.4.0.pre.alpha.PLAY1546highchartsbump3822 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.4.0.pre.alpha.PLAY1562highchartsbump3819 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-14.5.0.pre.rc.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx