Sha256: b80a57c8542f3deca987314199bb9a80841e316cea7b61df361170c15184f532

Contents?: true

Size: 760 Bytes

Versions: 142

Compression:

Stored size: 760 Bytes

Contents

/* @flow */

import React from 'react'
import { Caption, TitleCount } from '../../'

const resultsText = (results: number): string => results == 1 ? 'Result' : 'Results'

type ResultsCountProps = {
  results?: ?number,
  title?: boolean,
}
const ResultsCount = ({ results, title }: ResultsCountProps) => (
  <Choose>
    <When condition={results && title}>
      <TitleCount
          align="center"
          count={results}
          title={`${resultsText(results)}:`}
      />
    </When>
    <When condition={results}>
      <Caption
          className="filter-results"
          size="xs"
          text={`${results} ${resultsText(results)}`}
      />
    </When>
    <Otherwise>
      <div />
    </Otherwise>
  </Choose>
)

export default ResultsCount

Version data entries

142 entries across 142 versions & 1 rubygems

Version Path
playbook_ui-7.7.0.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.7.0 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.6.2.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.6.2 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.6.1.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.6.1 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.6.0 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.5.1 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.5.0 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.2 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.1 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.0.pre.alpha6 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.0.pre.alpha5 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.0 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.0.pre.test4 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.0.pre.test3 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.0.pre.test2 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.0.pre.alpha4 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.0.pre.alpha2 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx
playbook_ui-7.4.0.pre.alpha1 app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx