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

export default defineComponent({
	name: "GnLoader",
	props: {
		circle: { type: Boolean, default: false },
		label: { type: String, default: "Loading" }
	},
	setup(props, { attrs }) {
		return () => props.circle
			? h("div", { ...attrs, class: cx("circle-loader", attrs.class) }, [
				iconNode("ph-bold ph-spinner normalize"),
				props.label
			])
			: h("div", { ...attrs, class: cx("loader", attrs.class), role: "status", "aria-label": props.label });
	}
});
