Skip to content

Commit

Permalink
perf: 优化左侧菜单最左下角的展开、折叠按钮在亮白主题配色下的样式
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxian521 committed Jan 2, 2024
1 parent 7e58851 commit 9968787
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/layout/components/sidebar/leftCollapse.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref, computed } from "vue";
import { useGlobal } from "@pureadmin/utils";
import { useNav } from "@/layout/hooks/useNav";
import MenuFold from "@iconify-icons/ri/menu-fold-fill";
Expand All @@ -22,14 +23,14 @@ const iconClass = computed(() => {
"h-[16px]",
"inline-block",
"align-middle",
"text-primary",
"cursor-pointer",
"duration-[100ms]",
"hover:text-primary",
"dark:hover:!text-white"
"duration-[100ms]"
];
});
const { $storage } = useGlobal<GlobalPropertiesApi>();
const themeColor = computed(() => $storage.layout?.themeColor);
const emit = defineEmits<{
(e: "toggleClick"): void;
}>();
Expand All @@ -40,7 +41,7 @@ const toggleClick = () => {
</script>

<template>
<div class="container">
<div class="collapse-container">
<el-tooltip
placement="right"
:visible="visible"
Expand All @@ -49,7 +50,7 @@ const toggleClick = () => {
>
<IconifyIconOffline
:icon="MenuFold"
:class="iconClass"
:class="[iconClass, themeColor === 'light' ? '' : 'text-primary']"
:style="{ transform: props.isActive ? 'none' : 'rotateY(180deg)' }"
@click="toggleClick"
@mouseenter="visible = true"
Expand All @@ -60,7 +61,7 @@ const toggleClick = () => {
</template>

<style lang="scss" scoped>
.container {
.collapse-container {
position: absolute;
bottom: 0;
width: 100%;
Expand Down

1 comment on commit 9968787

@xiaoxian521
Copy link
Member Author

@xiaoxian521 xiaoxian521 commented on 9968787 Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 优化左侧菜单最左下角的展开、折叠按钮在亮白主题配色下的样式
    之前(与整体主题色不搭配):
image

之后(搭配整体主题色):
image

2.将较常用的container类名重命名collapse-container,避免用户在全局css定义container后影响此处
3. 去掉hover样式,因为已经有了tooltip,再加上hover样式显得多余,可能造成视觉过载

Please sign in to comment.