feat: move is selected to children
This commit is contained in:
parent
7b50860749
commit
74068f3c82
|
@ -18,7 +18,6 @@ export const Default: Story = {
|
|||
args: {
|
||||
validatorAddress: '37880sfsef38fsb',
|
||||
name: 'Validator 1',
|
||||
selected: true,
|
||||
isAvatarChipIncluded: true,
|
||||
isVerified: true,
|
||||
},
|
||||
|
|
|
@ -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 = ({
|
|||
<YStack pl="8px">
|
||||
<XStack space={'$1'} alignItems="center">
|
||||
<Text size={13} weight={'semibold'}>
|
||||
{name}
|
||||
Validator {name}
|
||||
</Text>
|
||||
{isVerified && <VerifiedIcon size={20} />}
|
||||
{isAvatarChipIncluded && <ContactIcon size={20} />}
|
||||
|
@ -69,7 +68,7 @@ const ValidatorListItem = ({
|
|||
<Text size={13}>{getFormattedValidatorAddress(validatorAddress)}</Text>
|
||||
</YStack>
|
||||
</XStack>
|
||||
{isSelected && <Checkbox id="" variant="outline" size={20} selected={isSelected} />}
|
||||
{isSelected && <Checkbox id={name} variant="outline" size={20} selected={isSelected} />}
|
||||
</XStack>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue