Sha256: 4235f79809f0476c9cbee5cb18f6ef183a8307ab98967f239d51375a022bb726

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 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, ...bgProps }: FilterSingleProps) => (
  <FilterBackground
      dark={dark}
      {...bgProps}
  >
    <Flex
        orientation="row"
        vertical="center"
    >
      <If condition={children}>
        <FiltersPopover dark={dark}>
          {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

7 entries across 7 versions & 1 rubygems

Version Path
playbook_ui-7.10.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-7.9.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-7.8.4 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-7.8.3 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-7.8.2 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-7.8.1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-7.8.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx