From 74068f3c8251a91066143977c216d1e8b5d193bf Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Thu, 19 Oct 2023 10:30:21 +0300 Subject: [PATCH] feat: move is selected to children --- .../ValidatorsTabs/ValidatorListItem.stories.tsx | 1 - .../RightSideBar/ValidatorsTabs/ValidatorListItem.tsx | 9 ++++----- .../RightSideBar/ValidatorsTabs/ValidatorsList.tsx | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/components/General/RightSideBar/ValidatorsTabs/ValidatorListItem.stories.tsx b/src/components/General/RightSideBar/ValidatorsTabs/ValidatorListItem.stories.tsx index 1be19805..87c7ce19 100644 --- a/src/components/General/RightSideBar/ValidatorsTabs/ValidatorListItem.stories.tsx +++ b/src/components/General/RightSideBar/ValidatorsTabs/ValidatorListItem.stories.tsx @@ -18,7 +18,6 @@ export const Default: Story = { args: { validatorAddress: '37880sfsef38fsb', name: 'Validator 1', - selected: true, isAvatarChipIncluded: true, isVerified: true, }, diff --git a/src/components/General/RightSideBar/ValidatorsTabs/ValidatorListItem.tsx b/src/components/General/RightSideBar/ValidatorsTabs/ValidatorListItem.tsx index 6a3a6b67..95a9ee82 100644 --- a/src/components/General/RightSideBar/ValidatorsTabs/ValidatorListItem.tsx +++ b/src/components/General/RightSideBar/ValidatorsTabs/ValidatorListItem.tsx @@ -10,18 +10,17 @@ type ValidatorListItemProps = { validatorAddress: string isAvatarChipIncluded?: boolean isVerified?: boolean - selected?: boolean + isSelected?: boolean } const ValidatorListItem = ({ name, validatorAddress, - selected, isAvatarChipIncluded, isVerified, }: ValidatorListItemProps) => { const [isHovered, setIsHovered] = useState(false) - const [isSelected, setIsSelected] = useState(selected) + const [isSelected, setIsSelected] = useState(false) const handleMouseEnter = () => setIsHovered(true) const handleMouseLeave = () => setIsHovered(false) @@ -61,7 +60,7 @@ const ValidatorListItem = ({ - {name} + Validator {name} {isVerified && } {isAvatarChipIncluded && } @@ -69,7 +68,7 @@ const ValidatorListItem = ({ {getFormattedValidatorAddress(validatorAddress)} - {isSelected && } + {isSelected && } ) } diff --git a/src/components/General/RightSideBar/ValidatorsTabs/ValidatorsList.tsx b/src/components/General/RightSideBar/ValidatorsTabs/ValidatorsList.tsx index d47e527a..4d8e6a0a 100644 --- a/src/components/General/RightSideBar/ValidatorsTabs/ValidatorsList.tsx +++ b/src/components/General/RightSideBar/ValidatorsTabs/ValidatorsList.tsx @@ -1,18 +1,17 @@ import { YStack } from 'tamagui' import { useState, useEffect } from 'react' import { useDispatch } from 'react-redux' +import { Text } from '@status-im/components' import { setCountOfValidators } from '../../../../redux/RightSidebar/slice' import ValidatorListItem from './ValidatorListItem' import InputSearch from './SearchInput' -import { Text } from '@status-im/components' type Validator = { name: string validatorAddress: string isAvatarChipIncluded?: boolean isVerified?: boolean - selected?: boolean } const ValidatorsList = () => { @@ -26,7 +25,6 @@ const ValidatorsList = () => { { name: '1', validatorAddress: 'zQ3asdf9d4Gs0', - selected: true, isAvatarChipIncluded: true, isVerified: true, },