import React from 'react';
import useFetch from 'fetch-suspense';
import { useTranslation } from 'react-i18next';
import { FaGithubAlt, FaInfoCircle } from 'react-icons/fa';
import { Card, Result } from '../core';
const Search: React.FC<{ query: string }> = ({ query }) => {
const { t } = useTranslation();
const searchQuery = `${query} in:name`;
const limit = 5;
const response = useFetch(
`https://api.github.com/search/repositories?q=${encodeURIComponent(
searchQuery
)}&per_page=${limit}`
) as {
items: Array<{
full_name: string;
description: string;
stargazers_count: number;
html_url: string;
id: string;
}>;
};
const repos = response.items || [];
return (
<>
{repos.length > 0 ? (
repos.map((repo) => (
}
key={repo.id}
/>
))
) : (
}
/>
)}
>
);
};
const GithubSearchCard: React.FC<{ query: string }> = ({ query }) => {
const { t } = useTranslation();
return (
);
};
export default GithubSearchCard;