Sha256: 9acdbe2ede6e11f438485a123af1acb212fc755b60404512b085c17773a8468e

Contents?: true

Size: 1.84 KB

Versions: 89

Compression:

Stored size: 1.84 KB

Contents

/* @flow */

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

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

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

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

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

  return (
    <div className="maskContainer">
      <If condition={isEmpty(filters)}>
        <div className="filters">
          <Body
              color="light"
              paddingLeft="xs"
              size={4}
              tag="h4"
              text="No Filter Selected"
          />
        </div>
      </If>
      <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
                      dark={dark}
                      size={4}
                      tag="h4"
                      text={name}
                  />
                </When>
                <Otherwise>
                  <Caption
                      dark={dark}
                      text={name}
                  />
                  <Title
                      dark={dark}
                      size={4}
                      tag="h4"
                      text={value}
                  />
                </Otherwise>
              </Choose>
            </div>
          ))}
          <div className="right_gradient" />
        </div>
      </If>
    </div>
  )
}

export default CurrentFilters

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
playbook_ui-9.9.0.alpha.inline1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.9.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.8.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.7.0.pre.alphawidth1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.7.0.pre.alpha.a11y.btn app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.7.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.6.1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.6.1.pre.deps1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.6.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.5.0.alpha.rs.downgrade app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.5.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.4.0.alpha.sisense app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.4.0.alpha.user.kit.bug app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.4.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.3.1.pre.alpha2 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.4.0.pre.alpha2 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.4.0.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.3.1.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.3.0.alpha.inline3 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx
playbook_ui-9.3.0.pre.alpha.password.strength.2 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx