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.8.0.pre.alpha.PLAY645typescriptprogresstep298 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.8.0.pre.alpha.PLAY645typescriptprogresstep297 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.8.0.pre.alpha.rubyandnpmalpharelease296 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.8.0.pre.alpha.rubyandnpmalpharelease295 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.8.0.pre.alpha.rubyandnpmalpharelease294 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.8.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.7.1.pre.alpha.rubyandnpmalpharelease293 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.7.1.pre.alpha.rubyandnpmalpharelease292 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.7.1.pre.alpha.rubyandnpmalpharelease291 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.7.1.pre.alpha.alpharubyrelease281 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.7.1.pre.alpha.menu2 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.7.1.pre.alpha.menu1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.7.1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.7.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.6.0.pre.alpha.sectionseparator1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.6.0.pre.alpha.menuyml1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.6.0.pre.alpha.collapsible1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.6.0.pre.alpha.cssphone1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.6.0 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
playbook_ui-12.5.0.pre.alpha.filter1 app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx