Skip to content

Commit

Permalink
style: 调整Icon悬停样式
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Jul 11, 2023
1 parent 5312951 commit 64c7e48
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 107 deletions.
12 changes: 2 additions & 10 deletions src/components/Dialog/src/Dialog.vue
Expand Up @@ -80,11 +80,13 @@ const dialogStyle = computed(() => {
class="cursor-pointer is-hover !h-54px mr-10px"
:icon="isFullscreen ? 'radix-icons:exit-full-screen' : 'radix-icons:enter-full-screen'"
color="var(--el-color-info)"
hover-color="var(--el-color-primary)"
@click="toggleFull"
/>
<Icon
class="cursor-pointer is-hover !h-54px"
icon="ep:close"
hover-color="var(--el-color-primary)"
color="var(--el-color-info)"
@click="close"
/>
Expand Down Expand Up @@ -127,14 +129,4 @@ const dialogStyle = computed(() => {
top: 0;
}
}
.is-hover {
&:hover {
span,
i,
svg {
color: var(--el-color-primary) !important;
}
}
}
</style>
15 changes: 14 additions & 1 deletion src/components/Icon/src/Icon.vue
Expand Up @@ -15,7 +15,8 @@ const props = defineProps({
// icon color
color: propTypes.string,
// icon size
size: propTypes.number.def(16)
size: propTypes.number.def(16),
hoverColor: propTypes.string
})
const elRef = ref<ElRef>(null)
Expand Down Expand Up @@ -74,3 +75,15 @@ watch(
<span v-else ref="elRef" class="iconify" :data-icon="symbolId" :style="getIconifyStyle"></span>
</ElIcon>
</template>

<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-icon';
.@{prefix-cls} {
&:hover {
svg {
color: v-bind(hoverColor) !important;
}
}
}
</style>
1 change: 1 addition & 0 deletions src/components/Icon/src/types/index.ts
Expand Up @@ -2,4 +2,5 @@ export interface IconTypes {
size?: number
color?: string
icon: string
hoverColor?: string
}
50 changes: 31 additions & 19 deletions src/components/Table/src/Table.vue
Expand Up @@ -7,6 +7,7 @@ import type { TableProps, TableColumn, Pagination, TableSetProps } from './types
import { set } from 'lodash-es'
import { CSSProperties } from 'vue'
import { getSlot } from '@/utils/tsxHelper'
import { Icon } from '@/components/Icon'
export default defineComponent({
name: 'Table',
Expand Down Expand Up @@ -400,25 +401,36 @@ export default defineComponent({
})
}
return () => (
<div v-loading={unref(getProps).loading}>
<ElTable ref={elTableRef} data={unref(getProps).data} {...unref(getBindValue)}>
{{
default: () => renderTableColumn(),
empty: () => getSlot(slots, 'empty') || unref(getProps).emptyText,
append: () => getSlot(slots, 'append')
}}
</ElTable>
{unref(getProps).pagination ? (
<ElPagination
v-model:pageSize={pageSizeRef.value}
v-model:currentPage={currentPageRef.value}
class="mt-10px"
{...unref(pagination)}
></ElPagination>
) : undefined}
</div>
)
return () => {
const tableSlots = {}
if (getSlot(slots, 'empty')) {
tableSlots['empty'] = (...args: any[]) => getSlot(slots, 'empty', args)
}
if (getSlot(slots, 'append')) {
tableSlots['append'] = (...args: any[]) => getSlot(slots, 'append', args)
}
return (
<div v-loading={unref(getProps).loading}>
<div>
<Icon icon="ant-design:sync-outlined" class="cursor-pointer" />
</div>
<ElTable ref={elTableRef} data={unref(getProps).data} {...unref(getBindValue)}>
{{
default: () => renderTableColumn(),
...tableSlots
}}
</ElTable>
{unref(getProps).pagination ? (
<ElPagination
v-model:pageSize={pageSizeRef.value}
v-model:currentPage={currentPageRef.value}
class="mt-10px"
{...unref(pagination)}
></ElPagination>
) : undefined}
</div>
)
}
}
})
</script>
41 changes: 15 additions & 26 deletions src/components/TagsView/src/TagsView.vue
Expand Up @@ -35,6 +35,8 @@ const appStore = useAppStore()
const tagsViewIcon = computed(() => appStore.getTagsViewIcon)
const isDark = computed(() => appStore.getIsDark)
// 初始化tag
const initTags = () => {
affixTagArr.value = filterAffixTags(unref(routers))
Expand Down Expand Up @@ -270,7 +272,8 @@ watch(
>
<Icon
icon="ep:d-arrow-left"
:color="appStore.getIsDark ? 'var(--el-text-color-regular)' : '#333'"
color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
/>
</span>
<div class="overflow-hidden flex-1">
Expand Down Expand Up @@ -368,6 +371,7 @@ watch(
<Icon
:class="`${prefixCls}__item--close`"
color="#333"
hover-color="var(--el-color-white)"
icon="ant-design:close-outlined"
:size="12"
@click.prevent.stop="closeSelectedTag(item)"
Expand All @@ -386,7 +390,8 @@ watch(
>
<Icon
icon="ep:d-arrow-right"
:color="appStore.getIsDark ? 'var(--el-text-color-regular)' : '#333'"
color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
/>
</span>
<span
Expand All @@ -396,7 +401,8 @@ watch(
>
<Icon
icon="ant-design:reload-outlined"
:color="appStore.getIsDark ? 'var(--el-text-color-regular)' : '#333'"
color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
/>
</span>
<ContextMenu
Expand Down Expand Up @@ -459,7 +465,8 @@ watch(
>
<Icon
icon="ant-design:setting-outlined"
:color="appStore.getIsDark ? 'var(--el-text-color-regular)' : '#333'"
color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
/>
</span>
</ContextMenu>
Expand All @@ -476,7 +483,7 @@ watch(
&__tool {
position: relative;
&:after {
&:before {
position: absolute;
top: 1px;
left: 0;
Expand All @@ -487,27 +494,17 @@ watch(
}
&--first {
&:after {
display: none;
}
&:before {
position: absolute;
top: 1px;
left: 0;
width: 100%;
height: calc(~'100% - 1px');
border-left: none;
border-right: 1px solid var(--el-border-color);
content: '';
}
}
&:hover {
:deep(span),
:deep(i),
:deep(svg) {
color: var(--el-color-black) !important;
}
}
}
&__item {
Expand Down Expand Up @@ -546,7 +543,7 @@ watch(
background-color: var(--el-color-primary);
border: 1px solid var(--el-color-primary);
.@{prefix-cls}__item--close {
:deep(span) {
:deep(svg) {
color: var(--el-color-white) !important;
}
}
Expand All @@ -556,14 +553,6 @@ watch(
.dark {
.@{prefix-cls} {
&__tool {
&:hover {
:deep(span),
:deep(i),
:deep(svg) {
color: #fff !important;
}
}
&--first {
&:after {
display: none;
Expand All @@ -586,7 +575,7 @@ watch(
background-color: var(--el-color-primary);
border: 1px solid var(--el-color-primary);
.@{prefix-cls}__item--close {
:deep(span) {
:deep(svg) {
color: var(--el-color-white) !important;
}
}
Expand Down
89 changes: 46 additions & 43 deletions src/views/Login/Login.vue
Expand Up @@ -7,6 +7,7 @@ import { underlineToHump } from '@/utils'
import { useAppStore } from '@/store/modules/app'
import { useDesign } from '@/hooks/web/useDesign'
import { ref } from 'vue'
import { ElScrollbar } from 'element-plus'
const { getPrefixCls } = useDesign()
Expand All @@ -32,60 +33,62 @@ const toLogin = () => {
:class="prefixCls"
class="h-[100%] relative lt-xl:bg-[var(--login-bg-color)] lt-sm:px-10px lt-xl:px-10px lt-md:px-10px"
>
<div class="relative h-full flex mx-auto">
<div
:class="`${prefixCls}__left flex-1 bg-gray-500 bg-opacity-20 relative p-30px lt-xl:hidden`"
>
<div class="flex items-center relative text-white">
<img src="@/assets/imgs/logo.png" alt="" class="w-48px h-48px mr-10px" />
<span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
</div>
<div class="flex justify-center items-center h-[calc(100%-60px)]">
<TransitionGroup
appear
tag="div"
enter-active-class="animate__animated animate__bounceInLeft"
>
<img src="@/assets/svgs/login-box-bg.svg" key="1" alt="" class="w-350px" />
<div class="text-3xl text-white" key="2">{{ t('login.welcome') }}</div>
<div class="mt-5 font-normal text-white text-14px" key="3">
{{ t('login.message') }}
</div>
</TransitionGroup>
</div>
</div>
<div class="flex-1 p-30px lt-sm:p-10px dark:bg-[var(--login-bg-color)] relative">
<ElScrollbar class="h-full">
<div class="relative flex mx-auto">
<div
class="flex justify-between items-center text-white at-2xl:justify-end at-xl:justify-end"
:class="`${prefixCls}__left flex-1 bg-gray-500 bg-opacity-20 relative p-30px lt-xl:hidden`"
>
<div class="flex items-center at-2xl:hidden at-xl:hidden">
<div class="flex items-center relative text-white">
<img src="@/assets/imgs/logo.png" alt="" class="w-48px h-48px mr-10px" />
<span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
</div>

<div class="flex justify-end items-center space-x-10px">
<ThemeSwitch />
<LocaleDropdown class="lt-xl:text-white dark:text-white" />
<div class="flex justify-center items-center h-[calc(100%-60px)]">
<TransitionGroup
appear
tag="div"
enter-active-class="animate__animated animate__bounceInLeft"
>
<img src="@/assets/svgs/login-box-bg.svg" key="1" alt="" class="w-350px" />
<div class="text-3xl text-white" key="2">{{ t('login.welcome') }}</div>
<div class="mt-5 font-normal text-white text-14px" key="3">
{{ t('login.message') }}
</div>
</TransitionGroup>
</div>
</div>
<Transition appear enter-active-class="animate__animated animate__bounceInRight">
<div class="flex-1 p-30px lt-sm:p-10px dark:bg-[var(--login-bg-color)] relative">
<div
class="h-full flex items-center m-auto w-[100%] at-2xl:max-w-500px at-xl:max-w-500px at-md:max-w-500px at-lg:max-w-500px"
class="flex justify-between items-center text-white at-2xl:justify-end at-xl:justify-end"
>
<LoginForm
v-if="isLogin"
class="p-20px h-auto m-auto lt-xl:rounded-3xl lt-xl:light:bg-white"
@to-register="toRegister"
/>
<RegisterForm
v-else
class="p-20px h-auto m-auto lt-xl:rounded-3xl lt-xl:light:bg-white"
@to-login="toLogin"
/>
<div class="flex items-center at-2xl:hidden at-xl:hidden">
<img src="@/assets/imgs/logo.png" alt="" class="w-48px h-48px mr-10px" />
<span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
</div>

<div class="flex justify-end items-center space-x-10px">
<ThemeSwitch />
<LocaleDropdown class="lt-xl:text-white dark:text-white" />
</div>
</div>
</Transition>
<Transition appear enter-active-class="animate__animated animate__bounceInRight">
<div
class="h-full flex items-center m-auto w-[100%] at-2xl:max-w-500px at-xl:max-w-500px at-md:max-w-500px at-lg:max-w-500px"
>
<LoginForm
v-if="isLogin"
class="p-20px h-auto m-auto lt-xl:rounded-3xl lt-xl:light:bg-white"
@to-register="toRegister"
/>
<RegisterForm
v-else
class="p-20px h-auto m-auto lt-xl:rounded-3xl lt-xl:light:bg-white"
@to-login="toLogin"
/>
</div>
</Transition>
</div>
</div>
</div>
</ElScrollbar>
</div>
</template>

Expand Down

0 comments on commit 64c7e48

Please sign in to comment.