Sha256: 8954065759585ecff5603b24cbedd67214ff0cd50f263a23e192441c8972c223
Contents?: true
Size: 1.3 KB
Versions: 252
Compression:
Stored size: 1.3 KB
Contents
import React from 'react' import Caption from '../../pb_caption/_caption' import TitleCount from '../../pb_title_count/_title_count' const resultsText = (results: number): string => results == 1 ? 'Result' : 'Results' type ResultsCountProps = { dark?: boolean, results?: number | null, title?: boolean, } const ResultsCount = ({ dark, results, title }: ResultsCountProps): React.ReactElement => { const resultTitle = () => { if (results == null) return null return ( <TitleCount align="center" count={results} dark={dark} title={`${resultsText(results)}:`} /> ) } const justResults = () => { if (results == null) return null return ( <Caption className="filter-results" dark={dark} size="xs" text={`${results} ${resultsText(results)}`} /> ) } const displayResultsCount = () => { if (results != null && results >=0 && title) { return ( <> {resultTitle()} </> ) } else if (results !=null && results >=0 ) { return ( <> {justResults()} </> ) } else { return ( <div /> ) } } return ( <> {displayResultsCount()} </> ) } export default ResultsCount
Version data entries
252 entries across 252 versions & 1 rubygems