diff --git a/assets/images/make-admin.svg b/assets/images/make-admin.svg new file mode 100644 index 000000000000..383708e0523c --- /dev/null +++ b/assets/images/make-admin.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/assets/images/remove-members.svg b/assets/images/remove-members.svg new file mode 100644 index 000000000000..e9d7e08f5e5e --- /dev/null +++ b/assets/images/remove-members.svg @@ -0,0 +1,8 @@ + + + + + + + diff --git a/src/CONST.ts b/src/CONST.ts index 7fa3d158e12e..6626b798d314 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1388,6 +1388,11 @@ const CONST = { }, ID_FAKE: '_FAKE_', EMPTY: 'EMPTY', + MEMBERS_BULK_ACTION_TYPES: { + REMOVE: 'remove', + MAKE_MEMBER: 'makeMember', + MAKE_ADMIN: 'makeAdmin', + }, }, CUSTOM_UNITS: { diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index 1777b239e714..a25c7ff7129c 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -315,7 +315,7 @@ function Button( large ? styles.buttonLarge : undefined, success ? styles.buttonSuccess : undefined, danger ? styles.buttonDanger : undefined, - isDisabled && (success || danger) ? styles.buttonOpacityDisabled : undefined, + isDisabled ? styles.buttonOpacityDisabled : undefined, isDisabled && !danger && !success ? styles.buttonDisabled : undefined, shouldRemoveRightBorderRadius ? styles.noRightBorderRadius : undefined, shouldRemoveLeftBorderRadius ? styles.noLeftBorderRadius : undefined, diff --git a/src/components/ButtonWithDropdownMenu.tsx b/src/components/ButtonWithDropdownMenu/index.tsx similarity index 66% rename from src/components/ButtonWithDropdownMenu.tsx rename to src/components/ButtonWithDropdownMenu/index.tsx index 9466da601825..61d3409c65ab 100644 --- a/src/components/ButtonWithDropdownMenu.tsx +++ b/src/components/ButtonWithDropdownMenu/index.tsx @@ -1,77 +1,26 @@ -import type {RefObject} from 'react'; import React, {useEffect, useRef, useState} from 'react'; -import type {GestureResponderEvent, StyleProp, ViewStyle} from 'react-native'; import {View} from 'react-native'; -import type {ValueOf} from 'type-fest'; +import Button from '@components/Button'; +import Icon from '@components/Icon'; +import * as Expensicons from '@components/Icon/Expensicons'; +import PopoverMenu from '@components/PopoverMenu'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; -import type {AnchorPosition} from '@styles/index'; +import variables from '@styles/variables'; import CONST from '@src/CONST'; -import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; -import type DeepValueOf from '@src/types/utils/DeepValueOf'; -import type IconAsset from '@src/types/utils/IconAsset'; -import Button from './Button'; -import Icon from './Icon'; -import * as Expensicons from './Icon/Expensicons'; -import PopoverMenu from './PopoverMenu'; +import type {AnchorPosition} from '@src/styles'; +import type {ButtonWithDropdownMenuProps} from './types'; -type PaymentType = DeepValueOf; - -type DropdownOption = { - value: PaymentType; - text: string; - icon: IconAsset; - iconWidth?: number; - iconHeight?: number; - iconDescription?: string; -}; - -type ButtonWithDropdownMenuProps = { - /** Text to display for the menu header */ - menuHeaderText?: string; - - /** Callback to execute when the main button is pressed */ - onPress: (event: GestureResponderEvent | KeyboardEvent | undefined, value: PaymentType) => void; - - /** Callback to execute when a dropdown option is selected */ - onOptionSelected?: (option: DropdownOption) => void; - - /** Call the onPress function on main button when Enter key is pressed */ - pressOnEnter?: boolean; - - /** Whether we should show a loading state for the main button */ - isLoading?: boolean; - - /** The size of button size */ - buttonSize: ValueOf; - - /** Should the confirmation button be disabled? */ - isDisabled?: boolean; - - /** Additional styles to add to the component */ - style?: StyleProp; - - /** Menu options to display */ - /** e.g. [{text: 'Pay with Expensify', icon: Wallet}] */ - options: DropdownOption[]; - - /** The anchor alignment of the popover menu */ - anchorAlignment?: AnchorAlignment; - - /* ref for the button */ - buttonRef: RefObject; - - /** The priority to assign the enter key event listener to buttons. 0 is the highest priority. */ - enterKeyEventListenerPriority?: number; -}; - -function ButtonWithDropdownMenu({ +function ButtonWithDropdownMenu({ + success = false, isLoading = false, isDisabled = false, pressOnEnter = false, + shouldAlwaysShowDropdownMenu = false, menuHeaderText = '', + customText, style, buttonSize = CONST.DROPDOWN_BUTTON_SIZE.MEDIUM, anchorAlignment = { @@ -83,7 +32,7 @@ function ButtonWithDropdownMenu({ options, onOptionSelected, enterKeyEventListenerPriority = 0, -}: ButtonWithDropdownMenuProps) { +}: ButtonWithDropdownMenuProps) { const theme = useTheme(); const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); @@ -118,27 +67,27 @@ function ButtonWithDropdownMenu({ return ( - {options.length > 1 ? ( + {shouldAlwaysShowDropdownMenu || options.length > 1 ? (