fix: improve tenant header branding and logo display
This commit is contained in:
7 files changed
+86
-22
No files matched your search
+38
-10
@@ -495,31 +495,50 @@
|
||||
.nova-tenancy-brand {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
max-width: 13.5rem;
|
||||
max-width: 14.5rem;
|
||||
align-items: center;
|
||||
gap: 0.65rem;
|
||||
gap: 0.75rem;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
color: var(--nt-text);
|
||||
color: rgba(var(--colors-primary-500, 14, 165, 233), 1);
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.nova-tenancy-brand__logo {
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
display: grid;
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
flex: none;
|
||||
border-radius: 0.5rem;
|
||||
object-fit: cover;
|
||||
place-items: center;
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(var(--colors-primary-500, 14, 165, 233), 0.24);
|
||||
border-radius: 0.65rem;
|
||||
color: rgba(var(--colors-primary-600, 2, 132, 199), 1);
|
||||
background: rgba(var(--colors-primary-500, 14, 165, 233), 0.12);
|
||||
box-shadow: 0 3px 12px rgba(var(--colors-gray-900, 15, 23, 42), 0.12);
|
||||
}
|
||||
|
||||
.nova-tenancy-brand__logo img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0.15rem;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.nova-tenancy-brand__initial {
|
||||
font-size: 1rem;
|
||||
font-weight: 800;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.nova-tenancy-brand__title {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 0.86rem;
|
||||
font-weight: 750;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 800;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.nova-tenancy-select:focus-visible,
|
||||
@@ -551,11 +570,20 @@
|
||||
.dark .nova-tenancy-search input,
|
||||
.dark .nova-tenancy-card__body h2,
|
||||
.dark .nova-tenancy-state h2,
|
||||
.dark .nova-tenancy-brand,
|
||||
.dark .nova-tenancy-pagination button {
|
||||
color: var(--nt-text);
|
||||
}
|
||||
|
||||
.dark .nova-tenancy-brand {
|
||||
color: rgba(var(--colors-primary-400, 56, 189, 248), 1);
|
||||
}
|
||||
|
||||
.dark .nova-tenancy-brand__logo {
|
||||
border-color: rgba(var(--colors-primary-400, 56, 189, 248), 0.32);
|
||||
color: rgba(var(--colors-primary-300, 125, 211, 252), 1);
|
||||
background: rgba(var(--colors-primary-500, 14, 165, 233), 0.2);
|
||||
}
|
||||
|
||||
.dark .nova-tenancy-count,
|
||||
.dark .nova-tenancy-state__icon--empty {
|
||||
color: rgba(var(--colors-primary-400, 56, 189, 248), 1);
|
||||
|
||||
@@ -5,13 +5,19 @@
|
||||
:title="title"
|
||||
@click.stop.prevent="visitBrandDestination"
|
||||
>
|
||||
<img
|
||||
v-if="showLogo"
|
||||
:key="logoUrl"
|
||||
:src="logoUrl"
|
||||
class="nova-tenancy-brand__logo"
|
||||
alt=""
|
||||
/>
|
||||
<span v-if="showLogo" class="nova-tenancy-brand__logo" aria-hidden="true">
|
||||
<img
|
||||
v-if="!logoFailed"
|
||||
:key="logoUrl"
|
||||
:src="logoUrl"
|
||||
alt=""
|
||||
@error="logoFailed = true"
|
||||
/>
|
||||
|
||||
<span v-else class="nova-tenancy-brand__initial">
|
||||
{{ initial }}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span v-if="showTitle" class="nova-tenancy-brand__title">
|
||||
{{ title }}
|
||||
@@ -21,12 +27,15 @@
|
||||
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { currentLogoUrl } from '../tenantState'
|
||||
import { currentLogoUrl, tenantInitial } from '../tenantState'
|
||||
|
||||
defineOptions({ inheritAttrs: false })
|
||||
|
||||
const configuration = Nova.config('novaTenancy') || {}
|
||||
const brand = ref(null)
|
||||
const current = ref(configuration.current || null)
|
||||
const revision = ref(Date.now())
|
||||
const logoFailed = ref(false)
|
||||
let parentLink = null
|
||||
|
||||
const showLogo = computed(() => configuration.branding?.show_logo !== false)
|
||||
@@ -34,6 +43,7 @@ const showTitle = computed(() => configuration.branding?.show_title !== false)
|
||||
const title = computed(
|
||||
() => current.value?.title || configuration.copy?.selectTenant || 'Select tenant'
|
||||
)
|
||||
const initial = computed(() => tenantInitial(title.value))
|
||||
const logoUrl = computed(() => {
|
||||
const apiBase = configuration.apiBase || '/nova-vendor/nova-tenancy'
|
||||
const key = current.value?.key ?? 'none'
|
||||
@@ -44,6 +54,7 @@ const logoUrl = computed(() => {
|
||||
const updateCurrent = payload => {
|
||||
current.value = payload?.current ?? payload ?? null
|
||||
revision.value = Date.now()
|
||||
logoFailed.value = false
|
||||
}
|
||||
|
||||
const refreshCurrent = async () => {
|
||||
|
||||
Reference in new issue
Block a user