diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/common.ts | 15 | ||||
| -rw-r--r-- | src/utils/index.ts | 1 |
2 files changed, 16 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; + } +}; diff --git a/src/utils/index.ts b/src/utils/index.ts index a7e45979..95449c54 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,3 +1,4 @@ export * from './screenDimensions'; export * from './statusBarHeight'; export * from './moments'; +export * from './common'; |
