Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/flo-bit/tiny-docs. quick setup, simple, minimalistic docs for your github project flo-bit.dev/tiny-docs
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374---interface Props { href: string; src: string; alt: string; target?: string; props?: any; class?: string;}
const { href, src, class: className, target = "_blank", props } = Astro.props;
const url = href || src;
const split = url.split("github.com/");const repoName = split[1].split("/")[1];const owner = split[1].split("/")[0];const response = await fetch( `https://api.github.com/repos/${owner}/${repoName}`);const data = await response.json();
const description = data.description;const avatarUrl = data.owner?.avatar_url;---
<article class:list={[ "not-prose group max-w-lg my-6 relative isolate flex items-end justify-between rounded-2xl border border-base-400 dark:border-base-800 bg-base-200/50 dark:bg-base-900/50 p-4", className, ]} {...Astro.props}> <svg fill="currentColor" viewBox="0 0 24 24" aria-hidden="true" class="size-8 absolute top-4 right-4 text-base-500 dark:text-base-500 group-hover:text-base-700 dark:group-hover:text-base-300 transition-colors duration-200" > <path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path> </svg>
<div class="flex flex-col gap-4"> <div class="flex flex-col sm:flex-row items-start gap-2 text-2xl font-bold"> <img src={avatarUrl} alt={owner} class="size-8 rounded-full bg-base-300 dark:bg-base-800 border border-base-400 dark:border-base-700" /> <a href={href || src} class="flex items-center gap-1 flex-wrap" {...props} {target} > <span class="absolute inset-0"></span> <p> {owner} </p> / <p class="text-accent-600 dark:text-accent-400"> {repoName} </p> </a> </div> <p class="text-sm text-base-600 dark:text-base-400">{description}</p> </div> <!-- <p>{stars} stars</p> <p>{forks} forks</p> --></article>