style: update the tab style

This commit is contained in:
tiny-craft 2023-10-22 23:25:49 +08:00
parent f9fe74a6b4
commit acd3fa9304
2 changed files with 55 additions and 16 deletions

View File

@ -7,6 +7,9 @@ import { map, uniqBy } from 'lodash'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import Delete from '@/components/icons/Delete.vue' import Delete from '@/components/icons/Delete.vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { useThemeVars } from 'naive-ui'
const themeVars = useThemeVars()
const connectionStore = useConnectionStore() const connectionStore = useConnectionStore()
const i18n = useI18n() const i18n = useI18n()
@ -72,7 +75,8 @@ defineExpose({
:bordered="false" :bordered="false"
:title="$t('log.launch_log')" :title="$t('log.launch_log')"
class="content-container flex-box-v" class="content-container flex-box-v"
content-style="display: flex;flex-direction: column; overflow: hidden;"> content-style="display: flex;flex-direction: column; overflow: hidden; backgroundColor: gray"
:theme-overrides="{ borderRadius: '0px' }">
<n-form :disabled="data.loading" class="flex-item" inline> <n-form :disabled="data.loading" class="flex-item" inline>
<n-form-item :label="$t('log.filter_server')"> <n-form-item :label="$t('log.filter_server')">
<n-select <n-select
@ -158,5 +162,6 @@ defineExpose({
.content-container { .content-container {
padding: 5px; padding: 5px;
box-sizing: border-box; box-sizing: border-box;
border-left: 1px solid v-bind('themeVars.borderColor');
} }
</style> </style>

View File

@ -25,20 +25,20 @@ const activeTabStyle = computed(() => {
const { name } = tabStore.currentTab const { name } = tabStore.currentTab
const { markColor = '' } = connectionStore.serverProfile[name] || {} const { markColor = '' } = connectionStore.serverProfile[name] || {}
return { return {
backgroundColor: themeVars.value.bodyColor,
borderTopWidth: markColor ? '3px' : '1px', borderTopWidth: markColor ? '3px' : '1px',
borderTopColor: markColor || themeVars.value.borderColor, borderTopColor: markColor || themeVars.value.borderColor,
borderBottomColor: themeVars.value.bodyColor,
borderTopLeftRadius: themeVars.value.borderRadius,
borderTopRightRadius: themeVars.value.borderRadius,
} }
}) })
const inactiveTabStyle = computed(() => ({
borderWidth: '0 0 1px', const tabClass = (idx) => {
// borderBottomColor: themeVars.value.borderColor, if (tabStore.activatedIndex === idx) {
borderTopLeftRadius: themeVars.value.borderRadius, return ['value-tab', 'value-tab-active']
borderTopRightRadius: themeVars.value.borderRadius, } else if (tabStore.activatedIndex - 1 === idx) {
})) return ['value-tab', 'value-tab-inactive']
} else {
return ['value-tab', 'value-tab-inactive', 'value-tab-inactive2']
}
}
const tab = computed(() => const tab = computed(() =>
map(tabStore.tabs, (item) => ({ map(tabStore.tabs, (item) => ({
@ -52,6 +52,7 @@ const tab = computed(() =>
<n-tabs <n-tabs
v-model:value="tabStore.activatedIndex" v-model:value="tabStore.activatedIndex"
:closable="true" :closable="true"
:tabs-padding="2"
:tab-style="{ :tab-style="{
borderStyle: 'solid', borderStyle: 'solid',
borderWidth: '1px', borderWidth: '1px',
@ -60,7 +61,6 @@ const tab = computed(() =>
}" }"
:theme-overrides="{ :theme-overrides="{
tabFontWeightActive: 800, tabFontWeightActive: 800,
tabBorderRadius: 0,
tabGapSmallCard: 0, tabGapSmallCard: 0,
tabGapMediumCard: 0, tabGapMediumCard: 0,
tabGapLargeCard: 0, tabGapLargeCard: 0,
@ -76,10 +76,10 @@ const tab = computed(() =>
<n-tab <n-tab
v-for="(t, i) in tab" v-for="(t, i) in tab"
:key="i" :key="i"
:closable="tabStore.activatedIndex === i" :closable="true"
:name="i" :name="i"
:style="tabStore.activatedIndex === i ? activeTabStyle : inactiveTabStyle" :style="tabStore.activatedIndex === i ? activeTabStyle : undefined"
style="--wails-draggable: none" :class="tabClass(i)"
@dblclick.stop="() => {}"> @dblclick.stop="() => {}">
<n-space :size="5" :wrap-item="false" align="center" inline justify="center"> <n-space :size="5" :wrap-item="false" align="center" inline justify="center">
<n-icon :component="ToggleServer" size="18" /> <n-icon :component="ToggleServer" size="18" />
@ -89,4 +89,38 @@ const tab = computed(() =>
</n-tabs> </n-tabs>
</template> </template>
<style lang="scss" scoped></style> <style lang="scss">
.value-tab {
--wails-draggable: none;
position: relative;
}
.value-tab-active {
background-color: v-bind('themeVars.bodyColor') !important;
border-bottom-color: v-bind('themeVars.bodyColor') !important;
}
.value-tab-inactive {
border-color: #0000 !important;
&:hover {
background-color: v-bind('themeVars.borderColor') !important;
}
}
.value-tab-inactive2 {
&:after {
content: '';
position: absolute;
top: 25%;
height: 50%;
width: 1px;
background-color: v-bind('themeVars.borderColor');
right: -2px;
}
&:hover::after {
background-color: #0000;
}
}
</style>