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

export default defineComponent({
	name: "GnIconButton",
	props: {
		icon: { type: String, required: true },
		label: { type: String, required: true },
		type: { type: String, default: "button" },
		size: { type: String, default: null },
		withoutHover: { type: Boolean, default: false }
	},
	setup(props, { attrs }) {
		return () => h("button", {
			...attrs,
			type: props.type,
			"aria-label": props.label,
			class: cx("btn-icon", { "btn-icon-sm": props.size === "sm", "without-hover": props.withoutHover }, attrs.class)
		}, [iconNode(props.icon)]);
	}
});
