Sha256: 9ee6062b4c318c94b3fbe03bd45041591d4ab2012d2e379f025841ac73aa9fe1

Contents?: true

Size: 1.83 KB

Versions: 80

Compression:

Stored size: 1.83 KB

Contents

import React from 'react'
import { isEmpty, map, omitBy } from 'lodash'

import Body from '../../pb_body/_body'
import Caption from '../../pb_caption/_caption'
import Title from '../../pb_title/_title'

export type FilterDescription = {
  [key: string]: string | null | boolean,
}

export type CurrentFiltersProps = {
  dark: boolean,
  filters: FilterDescription,
}

const hiddenFilters = (value: any) => isEmpty(value) && value !== true

const CurrentFilters = ({ dark, filters }: CurrentFiltersProps): React.ReactElement => {
  const displayableFilters = omitBy(filters, hiddenFilters)

  return (
    <div className="maskContainer">
      { isEmpty(filters) &&
      <div className="filters">
        <Body
            color="light"
            paddingLeft="xs"
            size={4}
            tag="h4"
            text="No Filter Selected"
        />
      </div>
      }
      { !isEmpty(filters) &&
        <div className="filters">
          <div className="left_gradient" />
            {map(displayableFilters, (value, name) => (
              <div
                  className="filter"
                  key={`filter-${name}`}
              >
                { value === true ? 
                <Title
                    dark={dark}
                    size={4}
                    tag="h4"
                    text={name}
                /> : 
                <div>
                  <Caption
                      dark={dark}
                      text={name}
                  />
                  <Title
                      dark={dark}
                      size={4}
                      tag="h4"
                      text={value}
                  />
                </div>    
                }
              </div>
            ))}
          <div className="right_gradient" />
        </div>
      }
    </div>
  )
}

export default CurrentFilters

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
playbook_ui-12.22.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown696 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.22.0.pre.alpha.play698responsivespacingglobalprop690 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.22.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.21.0.pre.alpha.PLAY807RTEcustomtoolbar680 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.21.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.20.0.pre.alpha.movemarkdown668 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.20.0.pre.alpha.title2667 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.20.0.pre.alpha.title2665 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.20.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.19.0.pre.alpha.PLAY699zindexresponsive650 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.19.0.pre.alpha.movemarkdown639 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.19.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown638 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.19.0.pre.alpha.movemarkdown637 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.18.0.pre.alpha.PLAY785typeaheadts632 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.19.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.18.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown629 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.18.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown628 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.18.0.pre.alpha.play786multilevelselectimprovements627 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.18.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown626 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.18.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown617 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx