From 3362da273a4ffcc7d6362278bcb9fd919deda2b9 Mon Sep 17 00:00:00 2001 From: Ashm Walia <40498934+ashmgarv@users.noreply.github.com> Date: Tue, 10 Nov 2020 16:28:15 -0800 Subject: [TMA - 388] Block Users (Frontend) (#115) * initial * Final * sc * sc * sall change * Remove follow button when blocked * Small change * small changes again --- src/utils/common.ts | 15 +++++++++++++++ src/utils/index.ts | 1 + 2 files changed, 16 insertions(+) create mode 100644 src/utils/common.ts (limited to 'src/utils') 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'; -- cgit v1.2.3-70-g09d2