|
1
|
import React from "react" |
|
2
|
import clsx from "clsx" |
|
3
|
import { Badge, capitalize } from "docs-ui" |
|
4
|
|
|
5
|
export type MethodLabelProps = { |
|
6
|
method: string |
|
7
|
className?: string |
|
8
|
} |
|
9
|
|
|
10
|
const MethodLabel = ({ method, className }: MethodLabelProps) => { |
|
11
|
return ( |
|
12
|
<Badge |
|
13
|
variant={method === "get" ? "green" : method === "post" ? "blue" : "red"} |
|
14
|
className={clsx(className, "uppercase")} |
|
15
|
> |
|
16
|
{method === "delete" ? "Del" : capitalize(method)} |
|
17
|
</Badge> |
|
18
|
) |
|
19
|
} |
|
20
|
|
|
21
|
export default MethodLabel |