Skip to content

Instantly share code, notes, and snippets.

@leifermendez
Created March 25, 2025 16:28
Show Gist options
  • Save leifermendez/c5ee72736ad861138c0c90b34222e17e to your computer and use it in GitHub Desktop.
Save leifermendez/c5ee72736ad861138c0c90b34222e17e to your computer and use it in GitHub Desktop.
brand.vue
<script>
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
const {
LOGO_THUMBNAIL: logoThumbnail,
BRAND_NAME: brandName,
WIDGET_BRAND_URL: widgetBrandURL,
} = window.globalConfig || {};
export default {
mixins: [globalConfigMixin],
props: {
disableBranding: {
type: Boolean,
default: false,
},
},
data() {
return {
globalConfig: {
brandName,
logoThumbnail,
widgetBrandURL,
},
};
},
computed: {
brandRedirectURL() {
try {
const referrerHost = this.$store.getters['appConfig/getReferrerHost'];
const baseURL = `${this.globalConfig.widgetBrandURL}?utm_source=${
referrerHost ? 'widget_branding' : 'survey_branding'
}`;
if (referrerHost) {
return `${baseURL}&utm_referrer=${referrerHost}`;
}
return baseURL;
} catch (e) {
// Suppressing the error as getter is not defined in some cases
}
return '';
},
},
};
</script>
<template>
<div
v-if="globalConfig.brandName && !disableBranding"
class="px-0 py-3 flex justify-center"
>
<a
href="https://www.labs.racksmafia.com/"
rel="noreferrer noopener nofollow"
target="_blank"
class="branding--link text-n-slate-11 hover:text-n-slate-12 cursor-pointer text-xs inline-flex grayscale-[1] hover:grayscale-0 hover:opacity-100 opacity-90 no-underline justify-center items-center leading-3"
>
<img
class="ltr:mr-1 rtl:ml-1 max-w-3 max-h-3"
:alt="globalConfig.brandName"
:src="globalConfig.logoThumbnail"
/>
<span>
RacksLabs
</span>
</a>
</div>
<div v-else class="p-3" />
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment