Files
WRNexusJS/packages/ui/components/ApiEndpointCard.wrn
T

35 lines
1.1 KiB
Plaintext

component ApiEndpointCard {
props {
class = ""
method = "GET"
path = "/api/example"
description = ""
}
view {
<article
class="rounded-2xl border border-slate-200 bg-white p-5 dark:border-slate-800 dark:bg-slate-900 {class}"
>
<div class="flex flex-wrap items-center gap-3" >
<span
class="rounded-lg px-2.5 py-1 font-mono text-xs font-bold {method === 'GET' ? 'bg-emerald-100 text-emerald-700' : method === 'POST' ? 'bg-blue-100 text-blue-700' : method === 'DELETE' ? 'bg-red-100 text-red-700' : 'bg-amber-100 text-amber-700'}"
>
{method}
</span>
<code class="text-sm font-semibold">
{path}
</code>
</div>
<p
data-show="description"
class="mt-3 text-sm text-slate-500"
>
{description}
</p>
<div class="mt-4">
<slot />
</div>
</article>
}
}