UNPKG

@shopware-ag/meteor-component-library

Version:

The meteor component library is a Vue component library developed by Shopware. It is based on the [Meteor Design System](https://shopware.design/).

74 lines (73 loc) 2.61 kB
import '../mt-promo-badge.css'; import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, createVNode, withCtx, createTextVNode, toDisplayString } from "vue"; import { useI18n } from "vue-i18n"; import MtBadge from "./MtBadge.js"; import { _ as _export_sfc } from "../_plugin-vue_export-helper-cc2b3d55.mjs"; import "../mt-icon.vue_vue_type_style_index_0_lang-2cc5f73e.mjs"; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "mt-promo-badge", props: { variant: { default: "new" }, size: { default: "s" } }, setup(__props) { const props = __props; const { t } = useI18n({ messages: { en: { "mt-promo-badge": { new: "New", beta: "Beta", shopwareAi: "Shopware AI" } }, de: { "mt-promo-badge": { new: "Neu", beta: "Beta", shopwareAi: "Shopware AI" } } } }); const size = computed(() => { const n = String(props.size ?? "s").toLowerCase(); return n === "s" ? "s" : n === "m" ? "m" : n === "l" ? "l" : "s"; }); const badgeVariant = computed( () => props.variant === "shopware-ai" ? "neutral" : props.variant === "beta" ? "info" : "positive" ); const promoText = computed( () => props.variant === "shopware-ai" ? t("mt-promo-badge.shopwareAi") : props.variant === "new" ? t("mt-promo-badge.new") : t("mt-promo-badge.beta") ); const badgeIcon = computed( () => props.variant === "beta" ? "solid-code" : props.variant === "shopware-ai" ? "solid-sparkles" : "solid-party-horn" ); const iconColor = computed( () => props.variant === "shopware-ai" ? "var(--color-icon-brand-default)" : "var(--color-icon-primary-default)" ); return (_ctx, _cache) => { return openBlock(), createElementBlock("span", { class: "mt-promo-badge", style: normalizeStyle({ "--mt-promo-badge-icon-color": iconColor.value }) }, [ createVNode(MtBadge, { variant: badgeVariant.value, size: size.value, icon: badgeIcon.value }, { default: withCtx(() => [ createTextVNode(toDisplayString(promoText.value), 1) ]), _: 1 }, 8, ["variant", "size", "icon"]) ], 4); }; } }); const mtPromoBadge_vue_vue_type_style_index_0_scoped_d58d896b_lang = ""; const mtPromoBadge = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d58d896b"]]); export { mtPromoBadge as default }; //# sourceMappingURL=MtPromoBadge.js.map