diff options
Diffstat (limited to 'src/utils/common.ts')
-rw-r--r-- | src/utils/common.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utils/common.ts b/src/utils/common.ts new file mode 100644 index 00000000..9e74ca33 --- /dev/null +++ b/src/utils/common.ts @@ -0,0 +1,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; + } +}; |