Skip to content

Commit

Permalink
Merge pull request #41 from os-checker/ui/topbar
Browse files Browse the repository at this point in the history
feat(TopBar): 顶部栏 - 按钮 - 主页、问题文件树、使用说明、主题切换
  • Loading branch information
zjp-CN authored Aug 12, 2024
2 parents 8732066 + a9da39c commit 5c8052f
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 91 deletions.
4 changes: 2 additions & 2 deletions os-checks/app.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<NuxtLayout>
<NuxtPage />
</div>
</NuxtLayout>
</template>
29 changes: 0 additions & 29 deletions os-checks/assets/style.css
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
.container {
display: flex;
flex-wrap: wrap;
/* 允许子元素换行 */
justify-content: space-between;
}

.left-to-right,
.right-to-left {
display: flex;
flex-direction: row;
flex-wrap: wrap;
/* 允许子元素在必要时换行 */
}

.left-to-right {
justify-content: flex-start;
/* 子元素从左往右排列 */
}

.right-to-left {
justify-content: flex-end;
/* 子元素在容器内靠右对齐 */
margin-left: auto;
/* 将第二个 div 推到容器的右侧 */
gap: 0.5rem;
/* 容器内部的元素间隔为 0.5rem */
}

/* 媒体查询:对于较小的屏幕 */
/* @media (max-width: 600px) {} */

Expand Down
2 changes: 1 addition & 1 deletion os-checks/components/DarkMode.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<ClientOnly>
<span>
<Button @click="toggleDarkMode" severity="contrast" :icon="darkMode ? 'pi pi-sun' : 'pi pi-moon'" />
<Button title="主题切换" @click="toggleDarkMode" severity="contrast" :icon="darkMode ? 'pi pi-sun' : 'pi pi-moon'" />
</span>
</ClientOnly>
</template>
Expand Down
40 changes: 0 additions & 40 deletions os-checks/components/NavigationBreadcrumb.vue

This file was deleted.

59 changes: 59 additions & 0 deletions os-checks/components/TopBar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<template>
<div style="display: flex;">

<div class="topBarLeft">

<NuxtLink to="/">
<Button title="主页" icon="pi pi-home" />
</NuxtLink>

<NuxtLink to="/file-tree">
<Button title="问题文件树" icon="pi pi-sitemap" />
</NuxtLink>

</div>

<div class="topBarRight">

<Button title="使用说明" icon="pi pi-question" severity="info" as="a" target="_blank" rel="noopener"
href="https://github.com/os-checker/os-checker.github.io/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E" />

<DarkMode />

</div>

</div>
</template>

<style scoped>
.topBarLeft,
.topBarRight {
display: flex;
flex-direction: row;
align-items: center;
padding: 0.25rem 0.8rem;
/* 允许子元素换行 */
justify-content: space-between;
/* 允许项目换行 */
flex-wrap: wrap;
/* 指定项目之间的间隔 */
gap: 0.5rem;
/* 垂直居中所有子元素 */
height: 55px;
/* 容器的高度 */
--p-button-sm-padding-x: 0.8rem;
}
.topBarLeft {
justify-content: flex-start;
/* 子元素从左往右排列 */
}
.topBarRight {
display: flex;
/* 子元素在容器内靠右对齐 */
justify-content: flex-end;
/* 子元素在容器内靠右对齐 */
margin-left: auto;
}
</style>
7 changes: 7 additions & 0 deletions os-checks/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<div>
<TopBar />

<slot />
</div>
</template>
1 change: 0 additions & 1 deletion os-checks/pages/file-tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ const tabs = reactive<CheckerResult[]>([
<div class="fileViewPanel">

<div class="fileViewNavi">
<NavigationBreadcrumb />
<ScrollPanel class="fileViewMenu">
<PackageFileMenu style="padding-right: 0.8rem;" :nodes="nodes" :selectedKey="selectedKey"
@update:selectedKey="selectedKey = $event" />
Expand Down
36 changes: 18 additions & 18 deletions os-checks/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,20 @@ const selectedKey = ref();
scrollable scrollHeight="92vh" v-model:selectionKeys="selectedKey" selectionMode="single">

<template #header>
<div class="container">
<div class="left-to-right">
<div class="header">

<div>
<MultiSelect :modelValue="selectedColumns" @update:modelValue="onToggle" :options="dataColumns"
optionLabel="header" class="w-full sm:w-64" display="chip" />
</div>
<div class="right-to-left">

<span>
<NuxtLink to="/file-tree">
<Button title="文件树" icon="pi pi-sitemap" />
</NuxtLink>
</span>

<DarkMode />

<span style="display: inline-block;">
<IconField>
<InputIcon class="pi pi-search" />
<InputText v-model="filters['global']" placeholder="Global Search" />
</IconField>
</span>

<div>
<IconField>
<InputIcon class="pi pi-search" />
<InputText v-model="filters['global']" placeholder="Global Search" />
</IconField>
</div>

</div>
</template>

Expand Down Expand Up @@ -106,3 +97,12 @@ const selectedKey = ref();
</TreeTable>

</template>

<style scoped>
.header {
display: flex;
flex-wrap: wrap;
/* 允许子元素换行 */
justify-content: space-between;
}
</style>

0 comments on commit 5c8052f

Please sign in to comment.