import { useParams } from 'solid-app-router'; import { createSignal, For, onMount, Show } from 'solid-js'; import marked from 'marked'; import Navbar from '../../components/Navbar'; import { convertCase } from '../../config/case'; import projects from '../../config/projects'; import { GithubRepository } from '../../types/github'; import { Project } from '../../types/project'; import 'solid-styled-jsx'; import css from '../../styles/repo.sass'; import Icons from '../../components/Icons'; async function fetchData(repo: string): Promise { const findData = projects.find(i => convertCase(i.title) === repo); if (!findData.repository) { return { ...findData, details: 'Oops, sorry. Nothing to see here yet.' }; } const repoPath = findData.repository.replace('https://github.com/', ''); const github = await (await fetch(`https://api.github.com/repos/${repoPath}`)).json() as GithubRepository; const details = await (await fetch(`https://raw.githubusercontent.com/${repoPath}/${github.default_branch}/README.md`)).text(); return { ...findData, github, details, }; } function ProjectRepo() { const params = useParams<{repo: string}>(); const [data, setData] = createSignal(); const [requestOk, setRequestOk] = createSignal(false); onMount(async () => { const p = await fetchData(params.repo); setData(p); setRequestOk(true); }); return (
Please wait...
}>

{data().title}

{data().description}

{item =>
}
); } export default ProjectRepo;