CountBadge.tsx 471 B

123456789101112131415161718192021
  1. import type { FC } from 'react';
  2. import React from 'react';
  3. type CountProps = {
  4. count?: number,
  5. offset?: number,
  6. }
  7. const CountBadge: FC<CountProps> = (props:CountProps) => {
  8. const { count, offset = 0 } = props;
  9. return (
  10. <span className="grw-count-badge px-2 badge rounded-pill bg-light text-dark">
  11. { count == null && <span className="text-muted">―</span> }
  12. { count != null && count + offset }
  13. </span>
  14. );
  15. };
  16. export default CountBadge;