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