Sidebar methods and fix model hooks

This commit is contained in:
Gregory Schier
2024-02-09 16:09:24 -08:00
parent 812e5238ac
commit f8e8f5d3f2
7 changed files with 84 additions and 50 deletions

View File

@@ -0,0 +1,26 @@
import classNames from 'classnames';
interface Props {
children: string;
className?: string;
}
const methodMap: Record<string, string> = {
get: 'GET',
put: 'PUT',
post: 'POST',
patch: 'PATCH',
delete: 'DELETE',
options: 'OPTIONS',
head: 'HEAD',
grpc: 'gRPC',
};
export function HttpMethodTag({ children: method, className }: Props) {
const m = method.toLowerCase();
return (
<span className={classNames(className, 'text-2xs font-mono')}>
{methodMap[m] ?? m.slice(0, 3).toUpperCase()}
</span>
);
}