import React, { useCallback, useState } from 'react';
import { View, Text } from 'react-native';
import { Image } from 'expo-image';
import Svg, { Path } from 'react-native-svg';
import type { NFDProfile } from '../types/algorand';
import { formatAddress } from '../utils/format';
import { SearchSheet } from '../ui/SearchSheet';
function VerifiedIcon({ size = 12, color = '#60a5fa' }: { size?: number; color?: string }) {
return (
);
}
interface NFDSearchProps {
data: NFDProfile[];
onSelect?: (profile: NFDProfile) => void;
placeholder?: string;
className?: string;
}
export function NFDSearch({
data,
onSelect,
placeholder = 'Search NFD profiles...',
className,
}: NFDSearchProps) {
const [selected, setSelected] = useState(null);
const handleSelect = useCallback(
(profile: NFDProfile) => {
setSelected(profile);
onSelect?.(profile);
},
[onSelect],
);
const renderItem = useCallback(
(profile: NFDProfile) => (
{profile.avatar ? (
) : (
NFD
)}
{profile.name}
{profile.verified && }
{formatAddress(profile.address)}
),
[],
);
return (
{selected && (
Selected NFD
{renderItem(selected)}
)}
);
}