-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37074 from burczu/feature/35712-redesign-of-membe…
…rs-list Feature/35712 redesign of members list
- Loading branch information
Showing
10 changed files
with
200 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import MultipleAvatars from '@components/MultipleAvatars'; | ||
import TextWithTooltip from '@components/TextWithTooltip'; | ||
import useStyleUtils from '@hooks/useStyleUtils'; | ||
import useTheme from '@hooks/useTheme'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import BaseListItem from './BaseListItem'; | ||
import type {TableListItemProps} from './types'; | ||
|
||
function TableListItem({ | ||
item, | ||
isFocused, | ||
showTooltip, | ||
isDisabled, | ||
canSelectMultiple, | ||
onSelectRow, | ||
onDismissError, | ||
shouldPreventDefaultFocusOnSelectRow, | ||
rightHandSideComponent, | ||
}: TableListItemProps) { | ||
const styles = useThemeStyles(); | ||
const theme = useTheme(); | ||
const StyleUtils = useStyleUtils(); | ||
|
||
const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor; | ||
const hoveredBackgroundColor = styles.sidebarLinkHover?.backgroundColor ? styles.sidebarLinkHover.backgroundColor : theme.sidebar; | ||
|
||
return ( | ||
<BaseListItem | ||
item={item} | ||
pressableStyle={[[styles.selectionListPressableItemWrapper, isFocused && styles.activeComponentBG]]} | ||
wrapperStyle={[styles.flexRow, styles.flex1, styles.justifyContentBetween, styles.userSelectNone, styles.alignItemsCenter, isFocused && styles.sidebarLinkActive]} | ||
selectMultipleStyle={[StyleUtils.getCheckboxContainerStyle(20), StyleUtils.getMultiselectListStyles(!!item.isSelected, !!item.isDisabled)]} | ||
isFocused={isFocused} | ||
isDisabled={isDisabled} | ||
showTooltip={showTooltip} | ||
canSelectMultiple={canSelectMultiple} | ||
onSelectRow={onSelectRow} | ||
onDismissError={onDismissError} | ||
shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow} | ||
rightHandSideComponent={rightHandSideComponent} | ||
errors={item.errors} | ||
pendingAction={item.pendingAction} | ||
keyForList={item.keyForList} | ||
> | ||
{(hovered) => ( | ||
<> | ||
{!!item.icons && ( | ||
<MultipleAvatars | ||
icons={item.icons ?? []} | ||
shouldShowTooltip={showTooltip} | ||
secondAvatarStyle={[ | ||
StyleUtils.getBackgroundAndBorderStyle(theme.sidebar), | ||
isFocused ? StyleUtils.getBackgroundAndBorderStyle(focusedBackgroundColor) : undefined, | ||
hovered && !isFocused ? StyleUtils.getBackgroundAndBorderStyle(hoveredBackgroundColor) : undefined, | ||
]} | ||
/> | ||
)} | ||
<View style={[styles.flex1, styles.flexColumn, styles.justifyContentCenter, styles.alignItemsStretch]}> | ||
<TextWithTooltip | ||
shouldShowTooltip={showTooltip} | ||
text={item.text} | ||
textStyles={[ | ||
styles.optionDisplayName, | ||
isFocused ? styles.sidebarLinkActiveText : styles.sidebarLinkText, | ||
styles.sidebarLinkTextBold, | ||
styles.pre, | ||
item.alternateText ? styles.mb1 : null, | ||
styles.justifyContentCenter, | ||
]} | ||
/> | ||
{!!item.alternateText && ( | ||
<TextWithTooltip | ||
shouldShowTooltip={showTooltip} | ||
text={item.alternateText} | ||
textStyles={[styles.textLabelSupporting, styles.lh16, styles.pre]} | ||
/> | ||
)} | ||
</View> | ||
{!!item.rightElement && item.rightElement} | ||
</> | ||
)} | ||
</BaseListItem> | ||
); | ||
} | ||
|
||
TableListItem.displayName = 'TableListItem'; | ||
|
||
export default TableListItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.