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

export default defineComponent({
	name: "GnToolbar",
	props: {
		title: { type: String, default: "" },
		meta: { type: String, default: "" }
	},
	setup(props, { attrs, slots }) {
		return () => h("div", { ...attrs, class: cx("toolbar", attrs.class) }, [
			h("div", { class: "toolbar-group" }, [
				h("div", {}, [
					(props.title || slots.title) && h("h3", { class: "toolbar-title" }, slots.title?.() || props.title),
					(props.meta || slots.meta) && h("span", { class: "toolbar-meta" }, slots.meta?.() || props.meta)
				])
			]),
			(slots.default || slots.actions) && h("div", { class: "toolbar-group" }, slots.actions?.() || slots.default?.())
		]);
	}
});
