Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

VisitorsCountLabel.tsx 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import React from 'react';
  2. import { useSelector } from 'react-redux';
  3. import { IReduxState } from '../../../app/types';
  4. import { IconUsers } from '../../../base/icons/svg';
  5. // eslint-disable-next-line lines-around-comment
  6. // @ts-ignore
  7. import Label from '../../../base/label/components/native/Label';
  8. import BaseTheme from '../../../base/ui/components/BaseTheme.native';
  9. import { getVisitorsShortText, iAmVisitor } from '../../functions';
  10. const styles = {
  11. raisedHandsCountLabel: {
  12. alignItems: 'center',
  13. backgroundColor: BaseTheme.palette.warning02,
  14. borderRadius: BaseTheme.shape.borderRadius,
  15. flexDirection: 'row',
  16. marginLeft: BaseTheme.spacing[0],
  17. marginBottom: BaseTheme.spacing[0]
  18. },
  19. raisedHandsCountLabelText: {
  20. color: BaseTheme.palette.uiBackground,
  21. paddingLeft: BaseTheme.spacing[2]
  22. }
  23. };
  24. const VisitorsCountLabel = () => {
  25. const visitorsMode = useSelector((state: IReduxState) => iAmVisitor(state));
  26. const visitorsCount = useSelector((state: IReduxState) =>
  27. state['features/visitors'].count || 0);
  28. return visitorsMode && (
  29. <Label
  30. icon = { IconUsers }
  31. iconColor = { BaseTheme.palette.uiBackground }
  32. style = { styles.raisedHandsCountLabel }
  33. text = { `${getVisitorsShortText(visitorsCount)}` }
  34. textStyle = { styles.raisedHandsCountLabelText } />
  35. );
  36. };
  37. export default VisitorsCountLabel;