@scalar/api-client
Version:
the open source API testing client
67 lines (66 loc) • 2.64 kB
JavaScript
import { defineComponent as v, createElementBlock as s, openBlock as c, normalizeClass as r, createElementVNode as n, createVNode as i, createCommentVNode as u, normalizeStyle as f, toDisplayString as x, createTextVNode as p, unref as o } from "vue";
import { ScalarIconButton as a } from "@scalar/components";
import { ScalarIconNotePencil as b, ScalarIconTrash as g } from "@scalar/icons";
import y from "./EnvironmentVariablesTable.vue.js";
const N = { class: "flex items-center gap-1.5" }, B = { class: "flex h-6 w-6 items-center justify-center p-1" }, T = { class: "px-1 py-0.5 text-sm font-medium" }, h = {
key: 0,
class: "bg-c-accent text-b-1 flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-medium",
title: "This is the active environment"
}, E = { class: "hidden flex-row items-center gap-1 group-hover:flex" }, V = /* @__PURE__ */ v({
__name: "Environment",
props: {
environment: {},
environmentName: {},
eventBus: {},
isActive: { type: Boolean, default: !1 },
collectionType: {}
},
emits: ["edit", "delete"],
setup(e, { emit: m }) {
const l = m;
return (k, t) => (c(), s("div", {
class: r(["group relative rounded-lg border transition-colors", e.isActive ? "border-c-accent bg-c-accent/5" : ""])
}, [
n("div", {
class: r(["flex justify-between rounded-t-lg px-1 py-1 text-sm", e.isActive ? "bg-c-accent/10" : "bg-b-2"])
}, [
n("div", N, [
n("div", B, [
n("span", {
class: "h-2.5 w-2.5 rounded-full",
style: f({ backgroundColor: e.environment.color })
}, null, 4)
]),
n("span", T, x(e.environmentName), 1),
e.isActive ? (c(), s("span", h, [...t[2] || (t[2] = [
n("span", { class: "size-1.5 rounded-full bg-current" }, null, -1),
p(" Active ", -1)
])])) : u("", !0)
]),
n("div", E, [
i(o(a), {
icon: o(b),
label: "Edit Environment",
size: "sm",
onClick: t[0] || (t[0] = (d) => l("edit"))
}, null, 8, ["icon"]),
i(o(a), {
icon: o(g),
label: "Delete Environment",
size: "sm",
onClick: t[1] || (t[1] = (d) => l("delete"))
}, null, 8, ["icon"])
])
], 2),
i(y, {
collectionType: e.collectionType,
environment: e.environment,
environmentName: e.environmentName,
eventBus: e.eventBus
}, null, 8, ["collectionType", "environment", "environmentName", "eventBus"])
], 2));
}
});
export {
V as default
};