Sha256: ac3c0c060b89c30564d419cef1336c4dcdb6dfb82620ffbad878ce3d8ee65cd1

Contents?: true

Size: 1.64 KB

Versions: 96

Compression:

Stored size: 1.64 KB

Contents

/* @flow */

import React from 'react'
import { isEmpty } from 'lodash'
import { Flex } from '../../'

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?: Node,
  filters?: FilterDescription,
  onSortChange?: SortingChangeCallback,
  results?: number,
  sortOptions?: SortOptions,
  sortValue?: SortValue,
} & FilterBackgroundProps

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

export default FilterSingle

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
playbook_ui-9.19.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.19.0.pre.alphafonts app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.18.0.flow.bin.alpha app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.18.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.17.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.17.0.pre.decouple.website2 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.16.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.15.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.15.0.pre.decouple.website1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.14.1.alpha.radio.alignment app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.14.1.alpha.highcharts9 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.14.1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.13.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.12.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.12.0.pre.text.addon app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.11.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.10.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.10.0.pre.date.time.stacked.1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.10.0.pre.alpha2 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-9.10.0.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx