Sha256: b11e49abc1d8a7821e414dba7f5bc4a6a4886a76e90f080b28fc77bfc8128e9f

Contents?: true

Size: 1.41 KB

Versions: 142

Compression:

Stored size: 1.41 KB

Contents

/* @flow */

import React from 'react'
import { isEmpty, map, omitBy } from 'lodash'
import { Caption, Title } from '../../'

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

export type CurrentFiltersProps = {
  filters: FilterDescription,
}

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

const CurrentFilters = ({ filters }: CurrentFiltersProps) => {
  const displayableFilters = omitBy(filters, hiddenFilters)

  return (
    <div className="maskContainer">
      <If condition={!isEmpty(filters)}>
        <div className="filters">
          <div className="left_gradient" />
          {map(displayableFilters, (value, name) => (
            <div
                className="filter"
                key={`filter-${name}`}
            >
              <Choose>
                <When condition={value === true}>
                  <Title
                      size={4}
                      tag="h4"
                      text={name}
                  />
                </When>
                <Otherwise>
                  <Caption text={name} />
                  <Title
                      size={4}
                      tag="h4"
                      text={value}
                  />
                </Otherwise>
              </Choose>
            </div>
          ))}
          <div className="right_gradient" />
        </div>
      </If>
    </div>
  )
}

export default CurrentFilters

Version data entries

142 entries across 142 versions & 1 rubygems

Version Path
playbook_ui-7.7.0.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.7.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.6.2.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.6.2 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.6.1.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.6.1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.6.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.5.1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.5.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.2 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.0.pre.alpha6 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.0.pre.alpha5 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.0.pre.test4 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.0.pre.test3 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.0.pre.test2 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.0.pre.alpha4 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.0.pre.alpha2 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-7.4.0.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx