Commit 0543e0dd57
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/ScrapeTable.vue +13 −2
| @@ -36,7 +36,18 @@ const sources = computed(() => { | |||
| 36 | count[source] = (count[source] || 0) + 1 | 36 | count[source] = (count[source] || 0) + 1 |
| 37 | } | 37 | } |
| 38 | } | 38 | } |
| 39 | return Object.keys(count).sort((a, b) => count[b] - count[a]) | 39 | return Object.keys(count).sort((a, b) => count[b] - count[a] || a.localeCompare(b)) |
| 40 | }) | ||
| 41 | |||
| 42 | const HEADER_MIN_PX = 48 | ||
| 43 | const HEADER_MAX_PX = 140 | ||
| 44 | const HEADER_PER_CHAR_PX = 7.2 | ||
| 45 | const HEADER_PADDING_PX = 20 | ||
| 46 | |||
| 47 | const headerHeight = computed(() => { | ||
| 48 | const longest = sources.value.reduce((n, s) => Math.max(n, s.length), 0) | ||
| 49 | const raw = Math.round(longest * HEADER_PER_CHAR_PX) + HEADER_PADDING_PX | ||
| 50 | return Math.min(HEADER_MAX_PX, Math.max(HEADER_MIN_PX, raw)) | ||
| 40 | }) | 51 | }) |
| 41 | 52 | ||
| 42 | // Drag to scroll + scroll indicator | 53 | // Drag to scroll + scroll indicator |
| @@ -85,7 +96,7 @@ onMounted(() => { | |||
| 85 | </script> | 96 | </script> |
| 86 | 97 | ||
| 87 | <template> | 98 | <template> |
| 88 | <div class="scrape-table-outer"> | 99 | <div class="scrape-table-outer" :style="{ '--scrape-header-height': `${headerHeight}px` }"> |
| 89 | <div | 100 | <div |
| 90 | ref="wrapRef" | 101 | ref="wrapRef" |
| 91 | class="scrape-table-wrap" | 102 | class="scrape-table-wrap" |
docs/.vitepress/theme/styles/style.scss +2 −2
| @@ -1486,7 +1486,7 @@ table tr:nth-child(odd) { | |||
| 1486 | left: 0; | 1486 | left: 0; |
| 1487 | z-index: 2; | 1487 | z-index: 2; |
| 1488 | padding: 0 12px !important; | 1488 | padding: 0 12px !important; |
| 1489 | height: 140px; | 1489 | height: var(--scrape-header-height, 140px); |
| 1490 | background-color: var(--vp-c-bg-soft) !important; | 1490 | background-color: var(--vp-c-bg-soft) !important; |
| 1491 | border-left: 1px solid var(--vp-c-divider) !important; | 1491 | border-left: 1px solid var(--vp-c-divider) !important; |
| 1492 | color: var(--vp-c-text-1) !important; | 1492 | color: var(--vp-c-text-1) !important; |
| @@ -1498,7 +1498,7 @@ table tr:nth-child(odd) { | |||
| 1498 | 1498 | ||
| 1499 | .source-header { | 1499 | .source-header { |
| 1500 | vertical-align: bottom; | 1500 | vertical-align: bottom; |
| 1501 | height: 140px; | 1501 | height: var(--scrape-header-height, 140px); |
| 1502 | text-align: center; | 1502 | text-align: center; |
| 1503 | background: var(--vp-c-bg) !important; | 1503 | background: var(--vp-c-bg) !important; |
| 1504 | 1504 | ||