/* ============================================================================ * Copyright (c) Cloud Annotations * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * ========================================================================== */ import React from "react"; const methodStyle = { borderRadius: "var(--ifm-global-radius)", }; function colorForMethod(method: string) { switch (method.toLowerCase()) { case "get": return "primary"; case "put": return "warning"; case "patch": return "warning"; case "post": return "success"; case "delete": return "danger"; default: return undefined; } } interface Props { method: string; path: string; } function MethodEndpoint({ method, path }: Props) { return (
{method.toUpperCase()}
{" "}
{path.replace(/{([a-z0-9-_]+)}/gi, ":$1")}
);
}
export default MethodEndpoint;