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