Sha256: ec7d1f0f79318d8517e1e00266b4b468b4ba777efb1be3fe530f7098533ec213

Contents?: true

Size: 1.77 KB

Versions: 359

Compression:

Stored size: 1.77 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,
  minWidth,
  placement,
  ...bgProps
}: FilterSingleProps): React.ReactElement => {
  return (
    <FilterBackground
        dark={dark}
        {...bgProps}
    >
      <Flex
          orientation="row"
          paddingRight="lg"
          vertical="center"
      >
        { children && 
          <>
            <FiltersPopover
                dark={dark}
                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

359 entries across 359 versions & 1 rubygems

Version Path
playbook_ui-13.17.0.pre.alpha.nodealphaupgrade2157 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.18.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.play1141iconkitusinglibrary2130 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.PLAY12002127 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.powercentrainplaybookpt22125 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.play1141iconkitusinglibrary2107 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.PBNTR181stripedtable2103 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.play1141iconkitusinglibrary2100 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.PBNTR184betaflaginmenuyml2085 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.PBNTR178AdvancedTableDocs2072 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.17.0 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.play1141iconkitusinglibrary2060 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.play1141iconkitusinglibrary2038 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.play1141iconkitusinglibrary2037 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.nodejsupgrade2036 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2035 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2034 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2023 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2010 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
playbook_ui-13.16.0.pre.alpha.PLAY11642006 app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx