refactor: load the theme and plugin logos using the avatar component (#657)

#### What type of PR is this?

/kind improvement
/milestone 2.0

#### What this PR does / why we need it:

插件和主题管理的 Logo 改为使用 `Avatar` 组件。

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:检查主题和插件相关的管理页面是否正常加载 Logo。

#### Does this PR introduce a user-facing change?

```release-note
插件和主题管理的 Logo 改为使用 `Avatar` 组件。
```
pull/660/head^2
Ryan Wang 2022-10-24 11:20:12 +08:00 committed by GitHub
parent 85c3096c29
commit f77ec61465
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 20 deletions

View File

@ -11,6 +11,7 @@ import {
IconMore, IconMore,
VButton, VButton,
Dialog, Dialog,
VAvatar,
} from "@halo-dev/components"; } from "@halo-dev/components";
import ThemeUploadModal from "./components/ThemeUploadModal.vue"; import ThemeUploadModal from "./components/ThemeUploadModal.vue";
@ -56,17 +57,13 @@ const onUpgradeModalClose = () => {
<template> <template>
<div class="bg-white px-4 py-4 sm:px-6"> <div class="bg-white px-4 py-4 sm:px-6">
<div class="group flex items-center justify-between"> <div class="group flex items-center justify-between">
<div class="flex flex-row gap-3"> <div class="flex flex-row items-center gap-3">
<div <VAvatar
class="h-12 w-12 overflow-hidden rounded border bg-white hover:shadow-sm"
>
<img
:key="selectedTheme?.metadata.name" :key="selectedTheme?.metadata.name"
:alt="selectedTheme?.spec.displayName" :alt="selectedTheme?.spec.displayName"
:src="selectedTheme?.spec.logo" :src="selectedTheme?.spec.logo"
class="h-full w-full" size="lg"
/> />
</div>
<div> <div>
<h3 class="text-lg font-medium leading-6 text-gray-900"> <h3 class="text-lg font-medium leading-6 text-gray-900">
{{ selectedTheme?.spec.displayName }} {{ selectedTheme?.spec.displayName }}

View File

@ -7,6 +7,7 @@ import {
VStatusDot, VStatusDot,
VEntity, VEntity,
VEntityField, VEntityField,
VAvatar,
} from "@halo-dev/components"; } from "@halo-dev/components";
import { toRefs } from "vue"; import { toRefs } from "vue";
import { usePluginLifeCycle } from "../composables/use-plugin"; import { usePluginLifeCycle } from "../composables/use-plugin";
@ -34,13 +35,11 @@ const { isStarted, changeStatus, uninstall } = usePluginLifeCycle(plugin);
<template #start> <template #start>
<VEntityField> <VEntityField>
<template #description> <template #description>
<div class="h-12 w-12 rounded border bg-white p-1 hover:shadow-sm"> <VAvatar
<img :alt="plugin?.spec.displayName"
:alt="plugin?.metadata.name"
:src="plugin?.spec.logo" :src="plugin?.spec.logo"
class="h-full w-full" size="md"
/> ></VAvatar>
</div>
</template> </template>
</VEntityField> </VEntityField>
<VEntityField <VEntityField

View File

@ -11,7 +11,13 @@ import cloneDeep from "lodash.clonedeep";
import { useSettingForm } from "@/composables/use-setting-form"; import { useSettingForm } from "@/composables/use-setting-form";
// components // components
import { VButton, VCard, VPageHeader, VTabbar } from "@halo-dev/components"; import {
VButton,
VCard,
VPageHeader,
VTabbar,
VAvatar,
} from "@halo-dev/components";
import BasicLayout from "@/layouts/BasicLayout.vue"; import BasicLayout from "@/layouts/BasicLayout.vue";
// types // types
@ -141,7 +147,13 @@ watch([() => route.name, () => route.params], () => {
<BasicLayout> <BasicLayout>
<VPageHeader :title="plugin?.spec?.displayName"> <VPageHeader :title="plugin?.spec?.displayName">
<template #icon> <template #icon>
<img :src="plugin?.spec?.logo" class="mr-2 h-8 w-8" /> <VAvatar
v-if="plugin"
:src="plugin.spec.logo"
:alt="plugin.spec.displayName"
class="mr-2"
size="sm"
/>
</template> </template>
<template #actions> <template #actions>
<VButton class="opacity-0" type="secondary">安装</VButton> <VButton class="opacity-0" type="secondary">安装</VButton>