import { defineComponent, h } from "vue";
import { cx, normalizeVariant } from "../utils.js";

export default defineComponent({
	name: "GnBadge",
	props: {
		variant: { type: String, default: "primary" },
		outline: { type: Boolean, default: false }
	},
	setup(props, { attrs, slots }) {
		return () => {
			const variant = normalizeVariant(props.variant);

			return h("span", {
				...attrs,
				class: cx(
					"badge",
					props.outline && variant === "primary" ? "badge-primary-outline" : `badge-${variant}`,
					attrs.class
				)
			}, slots.default?.());
		};
	}
});
