Skip to content

Commit 11eef13

Browse files
authored
Merge pull request #159 from os-checker/home-header-center
chore: make header center or right aligned
2 parents 90c8eb6 + 541d603 commit 11eef13

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

Diff for: os-checks/pages/index.vue

+28-22
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,12 @@
4949
<Column frozen sortable field="pkg" header="Package" style="min-width: 200px;" />
5050

5151
<Column v-if="C.display('last_commit_time')" sortable field="last_commit_time"
52-
:header="C.name('last_commit_time')" style="text-align: center;" />
52+
:header="C.name('last_commit_time')" :pt="ptColumnCenter" />
5353

54-
<Column v-if="C.display('version')" sortable field="version" :header="C.name('version')"
55-
style="text-align: center;" />
54+
<Column v-if="C.display('version')" sortable field="version" :header="C.name('version')" :pt="ptColumnCenter" />
5655

5756
<Column v-if="C.display('release_count')" sortable field="release_count" :header="C.name('release_count')"
58-
style="text-align: center;">
57+
:pt="ptColumnCenter">
5958
<template #body="{ data }">
6059
<NuxtLink :to="`https://crates.io/crates/${data.pkg}`" target="_blank" class="nav-link">
6160
{{ data.release_count }}
@@ -64,13 +63,13 @@
6463
</Column>
6564

6665
<Column v-if="C.display('last_release_time')" sortable field="last_release_time"
67-
:header="C.name('last_release_time')" style="text-align: center; min-width: 120px;" />
66+
:header="C.name('last_release_time')" style="min-width: 120px;" :pt="ptColumnCenter" />
6867

6968
<Column v-if="C.display('last_release_size')" sortable field="last_release_size"
70-
:header="C.name('last_release_size')" style="text-align: center" />
69+
:header="C.name('last_release_size')" :pt="ptColumnRight" />
7170

7271
<Column v-if="C.display('diag_total_count')" sortable field="diag_total_count"
73-
:header="C.name('diag_total_count')" style="text-align: center;">
72+
:header="C.name('diag_total_count')" :pt="ptColumnRight">
7473
<template #body="{ data }">
7574
<NuxtLink :to="`/${data.user}/${data.repo}`" target="_blank" class="nav-link">
7675
{{ data.diag_total_count }}
@@ -79,27 +78,25 @@
7978
</Column>
8079

8180
<Column v-if="C.display('testcases')" sortable field="testcases" :header="C.name('testcases')"
82-
style="text-align: center; font-weight: bold">
81+
style="font-weight: bold" :pt="ptColumnRight">
8382
<template #body="{ data }">
8483
<span :style="{ color: data.testcases_color }">
8584
{{ data.testcases }}
8685
</span>
8786
</template>
8887
</Column>
8988

90-
<Column v-if="C.display('lib')" sortable field="lib" :header="C.name('lib')" style="text-align: center;" />
91-
<Column v-if="C.display('bin')" sortable field="bin" :header="C.name('bin')" style="text-align: center;" />
89+
<Column v-if="C.display('lib')" sortable field="lib" :header="C.name('lib')" :pt="ptColumnCenter" />
90+
<Column v-if="C.display('bin')" sortable field="bin" :header="C.name('bin')" :pt="ptColumnCenter" />
9291
<Column v-if="C.display('dependencies')" sortable field="dependencies" :header="C.name('dependencies')"
93-
style="text-align: center;" />
92+
:pt="ptColumnRight" />
9493

95-
<Column v-if="C.display('tests')" sortable field="tests" :header="C.name('tests')" style="text-align: center;" />
96-
<Column v-if="C.display('examples')" sortable field="examples" :header="C.name('examples')"
97-
style="text-align: center;" />
98-
<Column v-if="C.display('benches')" sortable field="benches" :header="C.name('benches')"
99-
style="text-align: center;" />
94+
<Column v-if="C.display('tests')" sortable field="tests" :header="C.name('tests')" :pt="ptColumnRight" />
95+
<Column v-if="C.display('examples')" sortable field="examples" :header="C.name('examples')" :pt="ptColumnRight" />
96+
<Column v-if="C.display('benches')" sortable field="benches" :header="C.name('benches')" :pt="ptColumnRight" />
10097

10198
<Column v-if="C.display('documentation')" field="documentation" :header="C.name('documentation')"
102-
style="text-align: center;">
99+
:pt="ptColumnCenter">
103100
<template #body="{ data }">
104101
<NuxtLink v-if="data.documentation" :to="data.documentation" target="_blank" class="nav-link">
105102
link
@@ -108,8 +105,7 @@
108105
</template>
109106
</Column>
110107

111-
<Column v-if="C.display('latest_doc')" field="latest_doc" :header="C.name('latest_doc')"
112-
style="text-align: center;">
108+
<Column v-if="C.display('latest_doc')" field="latest_doc" :header="C.name('latest_doc')" :pt="ptColumnCenter">
113109
<template #body="{ data }">
114110
<NuxtLink v-if="data.latest_doc" :to="data.latest_doc" target="_blank" class="nav-link">
115111
link
@@ -118,7 +114,7 @@
118114
</template>
119115
</Column>
120116

121-
<Column v-if="C.display('homepage')" field="homepage" :header="C.name('homepage')" style="text-align: center;">
117+
<Column v-if="C.display('homepage')" field="homepage" :header="C.name('homepage')" :pt="ptColumnCenter">
122118
<template #body="{ data }">
123119
<NuxtLink v-if="data.homepage" :to="data.homepage" target="_blank" class="nav-link">
124120
link
@@ -148,8 +144,8 @@
148144
<Column v-if="C.display('description')" field="description" :header="C.name('description')"
149145
style="min-width: 280px;" />
150146

151-
<Column v-if="C.display('authors')" sortable field="authors" :header="C.name('authors')"
152-
style="min-width: 300px;">
147+
<Column v-if="C.display('authors')" sortable field="authors" :header="C.name('authors')" style="min-width: 300px;"
148+
:pt="ptColumnCenter">
153149
<template #body="{ data: { authors } }">
154150
<div v-for="tag of authors">
155151
<Tag severity="info" :value="tag" style="margin-bottom: 5px;"></Tag>
@@ -245,6 +241,16 @@ import type { DataTableSortMeta } from 'primevue/datatable';
245241
const { color, viewportHeight } = storeToRefs(useStyleStore());
246242
const tableHeight = computed(() => `${Math.round(viewportHeight.value * 0.8)}px`);
247243
244+
// styling
245+
const ptColumnCenter = ref({
246+
columnHeaderContent: { style: { "justify-content": "center" } },
247+
bodyCell: { style: { "text-align": "center" } }
248+
});
249+
const ptColumnRight = ref({
250+
columnHeaderContent: { style: { "justify-content": "right" } },
251+
bodyCell: { style: { "text-align": "right" } }
252+
});
253+
248254
const summaries = ref<PkgInfo[]>([]);
249255
250256
githubFetch<PkgInfo[]>({

0 commit comments

Comments
 (0)