aboutsummaryrefslogtreecommitdiff
path: root/src/utils/common.ts
blob: 9e74ca33b2bcdf69d4431619b3d3af75975d710b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import {TOGGLE_BUTTON_TYPE} from '../constants';

export const getToggleButtonText: (
  button_type: string,
  state: boolean,
) => string | null = (button_type, state) => {
  switch (button_type) {
    case TOGGLE_BUTTON_TYPE.FOLLOW_UNFOLLOW:
      return state ? 'Unfollow' : 'Follow';
    case TOGGLE_BUTTON_TYPE.BLOCK_UNBLOCK:
      return state ? 'Unblock' : 'Block';
    default:
      return null;
  }
};