-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58e1061
commit f62a88b
Showing
8 changed files
with
39 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
const { type = "default", text, link } = Astro.props; | ||
const badgeText = text ? text : type; | ||
const coloursMap = { | ||
experimental: 'bg-surface-accent-light text-content-accent border-outline-opaque', | ||
GET: 'border-green-400 bg-green-100 text-content-primary', | ||
POST: 'border-cyan-400 bg-cyan-100 text-content-primary', | ||
PUT: 'border-orange-400 bg-orange-100 text-content-primary', | ||
DELETE: 'border-red-400 bg-rose-100 text-content-primary', | ||
default: 'text-content-primary border-outline-opaque bg-surface-tertiary' | ||
} | ||
const badgeClass =`${coloursMap[type]} type-caption-2 px-2 py-0.5 rounded-full border self-center` | ||
--- | ||
{link ? | ||
<a class={badgeClass} href={link}>{badgeText}</a> : | ||
<span class={badgeClass}>{badgeText}</span> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,12 @@ | ||
--- | ||
import Badge from './Badge.astro'; | ||
const { method, path } = Astro.props; | ||
const valueColorMap = { | ||
GET: 'emerald', | ||
POST: 'sky', | ||
PUT: 'amber', | ||
DELETE: 'rose', | ||
}; | ||
const color = valueColorMap[method] || 'emerald'; | ||
const colorStyles = { | ||
emerald: 'ring-emerald-300 dark:ring-emerald-400/30 bg-emerald-400/10 text-emerald-500 dark:text-emerald-400', | ||
sky: 'ring-sky-300 bg-sky-400/10 text-sky-500 dark:ring-sky-400/30 dark:bg-sky-400/10 dark:text-sky-400', | ||
amber: 'ring-amber-300 bg-amber-400/10 text-amber-500 dark:ring-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400', | ||
rose: 'ring-rose-200 bg-rose-50 text-red-500 dark:ring-rose-500/20 dark:bg-rose-400/10 dark:text-rose-400', | ||
} | ||
--- | ||
|
||
<div> | ||
<div class="flex items-center gap-x-3"> | ||
<span class=`${colorStyles[color]} text-[0.625rem] leading-6 rounded-lg px-1.5 ring-1 ring-inset`>{ method }</span> | ||
<span class="h-0.5 w-0.5 rounded-full bg-zinc-300 dark:bg-zinc-600"/> | ||
<Badge type={method} /> | ||
<span class="text-xs text-zinc-400">{ path }</span> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters