Sha256: 1dec11eacdc95e92c0890ccaf31f9912891a008a5239dd0397e9bbb6a99b4bac
Contents?: true
Size: 1.18 KB
Versions: 691
Compression:
Stored size: 1.18 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 = () => { return ( <TitleCount align="center" count={results} dark={dark} title={`${resultsText(results)}:`} /> ) } const justResults = () => { return ( <Caption className="filter-results" dark={dark} size="xs" text={`${results} ${resultsText(results)}`} /> ) } const displayResultsCount = () => { if (results && title) { return ( <> {resultTitle()} </> ) } else if (results) { return ( <> {justResults()} </> ) } else { return ( <div /> ) } } return ( <> {displayResultsCount()} </> ) } export default ResultsCount
Version data entries
691 entries across 691 versions & 1 rubygems