Sha256: 4bbe98a5d34357415f91d962a9cf395281bd2aa89c8eaf85d3f00d17420e0467

Contents?: true

Size: 1.65 KB

Versions: 105

Compression:

Stored size: 1.65 KB

Contents

/* @flow */

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?: 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

105 entries across 105 versions & 1 rubygems

Version Path
playbook_ui-10.9.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.8.1.pre.alpha.flexdeps app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.9.0.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.8.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.7.1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.7.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.6.2.pre.alpha.dep app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.6.1.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.6.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.5.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.4.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.3.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.2.1.alpha.sisensefix app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.2.1 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.2.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.1.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.0.3.pre.alpha.walkthrough2 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.0.3.pre.alpha.walkthrough app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.0.1.alpha.railscusticon app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx
playbook_ui-10.0.2.pre.alpha.pre.iconfix app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx