Sha256: 647b3b72e44a6f4fe18e1bb7533227d202315ea5d00408b3ae02e8fc4ce19921
Contents?: true
Size: 1.93 KB
Versions: 165
Compression:
Stored size: 1.93 KB
Contents
/* @flow */ 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 | 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
165 entries across 165 versions & 1 rubygems