fix: add aome spacing to the validator list

This commit is contained in:
Ivana Andersson 2023-09-27 17:51:21 +03:00
parent e2bccbb9d6
commit 9a930e3e39
1 changed files with 40 additions and 34 deletions

View File

@ -1,40 +1,46 @@
import { Stack, YStack } from "tamagui";
import ValidatorListItem from "./ValidatorListItem";
import InputSearch from "./SearchInput";
import { useState, useEffect } from "react";
import { Stack, YStack } from 'tamagui'
import ValidatorListItem from './ValidatorListItem'
import InputSearch from './SearchInput'
import { useState, useEffect } from 'react'
const ValidatorsList = () => {
const [searchValue, setSearchValue] = useState('');
const [searchValue, setSearchValue] = useState('')
const validators = [
{ name: 'Validator 1', avatarKey: '37880sfsef38fsb', selected: true, isAvatarChipIncluded: true, isVerified: true },
{
name: 'Validator 1',
avatarKey: '37880sfsef38fsb',
selected: true,
isAvatarChipIncluded: true,
isVerified: true,
},
{ name: 'Validator 2', avatarKey: 'hs880sfsef38fsb', isVerified: true },
{ name: 'Validator 3', avatarKey: '3nh880sfsef38fsb', isAvatarChipIncluded: true },
{ name: 'Validator 4', avatarKey: 'fh7880sfsef38fsb' },
{ name: 'Validator 5', avatarKey: 'j77880s..fsef38fsb', isVerified: true },
];
const [filteredValidators, setFilteredValidators] = useState(validators);
]
const [filteredValidators, setFilteredValidators] = useState(validators)
useEffect(() => {
if (searchValue) {
const filtered = validators.filter(validator =>
validator.name.toLowerCase().includes(searchValue.toLowerCase())
);
setFilteredValidators(filtered);
validator.name.toLowerCase().includes(searchValue.toLowerCase()),
)
setFilteredValidators(filtered)
} else {
setFilteredValidators(validators);
setFilteredValidators(validators)
}
}, [searchValue, validators]);
}, [searchValue, validators])
return (
<Stack>
<InputSearch value={searchValue} setValue={setSearchValue} />
<YStack space={'$1'}>
<YStack space={'$1'} mt={'16px'}>
{filteredValidators.map(validator => (
<ValidatorListItem {...validator} />
))}
</YStack>
</Stack>
);
)
}
export default ValidatorsList;
export default ValidatorsList