Browse Source

feat(nc-gui): make logo animation size responsive to logo size

pull/4058/head
braks 2 years ago
parent
commit
5bb174ba4f
  1. 29
      packages/nc-gui/components/general/NocoIcon.vue
  2. 6
      packages/nc-gui/components/general/PoweredBy.vue

29
packages/nc-gui/components/general/NocoIcon.vue

@ -2,12 +2,11 @@
import { autoResetRef, useThrottleFn } from '#imports' import { autoResetRef, useThrottleFn } from '#imports'
interface Props { interface Props {
width?: number size?: number
height?: number
animate?: boolean animate?: boolean
} }
const { width = 90, height = 90, animate = false } = defineProps<Props>() const { size = 90, animate = false } = defineProps<Props>()
const ping = autoResetRef(false, 1000) const ping = autoResetRef(false, 1000)
@ -18,21 +17,35 @@ const onClick = useThrottleFn(() => {
<template> <template>
<div <div
:style="{ left: `calc(50% - ${width / 2}px)`, top: `-${height / 2}px` }" :style="{ left: `calc(50% - ${size / 2}px)`, top: `-${size / 2}px` }"
class="color-transition absolute rounded-lg pt-1 pl-1 -ml-1" class="color-transition absolute rounded-lg pt-1 pl-1 -ml-1"
@click="onClick" @click="onClick"
> >
<div class="relative"> <div class="relative">
<img class="hidden dark:block" :width="width" :height="height" alt="NocoDB" src="~/assets/img/icons/512x512-trans.png" /> <img class="hidden dark:block" :width="size" :height="size" alt="NocoDB" src="~/assets/img/icons/512x512-trans.png" />
<img class="dark:hidden" :width="width" :height="height" alt="NocoDB" src="~/assets/img/icons/512x512.png" /> <img class="dark:hidden" :width="size" :height="size" alt="NocoDB" src="~/assets/img/icons/512x512.png" />
<TransitionGroup name="layout" :duration="500"> <TransitionGroup name="layout" :duration="500">
<template v-if="animate || ping"> <template v-if="animate || ping">
<div <div
:class="ping ? 'bg-primary bg-opacity-100' : 'animated-bg-gradient'" :class="ping ? 'bg-primary bg-opacity-100' : 'animated-bg-gradient'"
class="rounded-full z-0 absolute bottom-[6.25px] right-[6.25px] h-4.25 w-4.25 transform scale-102" :style="{
bottom: `${6.25 / (90 / size)}px`,
right: `${6.25 / (90 / size)}px`,
width: `${1.1 / (90 / size)}rem`,
height: `${1.1 / (90 / size)}rem`,
}"
class="rounded-full z-0 absolute transform scale-102"
/>
<div
:style="{
bottom: `${0.225 / (90 / size)}rem`,
right: `${0.25 / (90 / size)}rem`,
width: `${1.375 / (90 / size)}rem`,
height: `${1.375 / (90 / size)}rem`,
}"
class="animate-ping bg-primary bg-opacity-50 rounded-full z-0 absolute"
/> />
<div class="animate-ping bg-primary bg-opacity-50 rounded-full z-0 absolute bottom-0.9 right-1 h-5.5 w-5.5" />
</template> </template>
</TransitionGroup> </TransitionGroup>
</div> </div>

6
packages/nc-gui/components/general/PoweredBy.vue

@ -1,5 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { openLink } from '#imports' import { openLink, useGlobal } from '#imports'
const { isLoading } = useGlobal()
</script> </script>
<template> <template>
@ -9,7 +11,7 @@ import { openLink } from '#imports'
@click="openLink('https://github.com/nocodb/nocodb')" @click="openLink('https://github.com/nocodb/nocodb')"
> >
<span class="relative rounded"> <span class="relative rounded">
<GeneralNocoIcon v-bind="$attrs" class="!relative !top-0" :width="32" :height="32" /> <GeneralNocoIcon v-bind="$attrs" :animate="isLoading" class="!relative !top-0" :size="32" />
</span> </span>
<span>Powered by NocoDB</span> <span>Powered by NocoDB</span>

Loading…
Cancel
Save