diff --git a/app/components/AppHeader.vue b/app/components/AppHeader.vue index 08a8001..c283703 100644 --- a/app/components/AppHeader.vue +++ b/app/components/AppHeader.vue @@ -3,29 +3,67 @@ const { t } = useT() diff --git a/app/components/AppShell.vue b/app/components/AppShell.vue new file mode 100644 index 0000000..94ccb76 --- /dev/null +++ b/app/components/AppShell.vue @@ -0,0 +1,43 @@ + + + diff --git a/app/components/CharCells.vue b/app/components/CharCells.vue index d0f791b..0ad3d5a 100644 --- a/app/components/CharCells.vue +++ b/app/components/CharCells.vue @@ -30,15 +30,7 @@ const segments = computed(() => segmentsOf(signature.value)) /** One run means one form everywhere, which color cannot usefully encode. */ const colorOf = (group: number) => - segments.value.length === 1 ? 'var(--c-rule)' : `var(--c-g${group + 1})` - -const LANG = { - cn: 'zh-CN', - hk: 'zh-HK', - tw: 'zh-TW', - jp: 'ja', - kr: 'ko', -} as const + segments.value.length === 1 ? 'var(--c-rule)' : groupColor(group) const cells = computed(() => regions.value.map((region) => { @@ -49,7 +41,7 @@ const cells = computed(() => region, char, font: fontRegionOf(props.row, index), - lang: LANG[region], + lang: COLUMN_LANG[region], codePoint: `U+${char.codePointAt(0)!.toString(16).toUpperCase()}`, // Only Japan has a second historical form to show old: region === 'jp' && showOld.value ? props.row.old?.char : undefined, @@ -65,8 +57,6 @@ const cells = computed(() => :key="cell.region" class="min-w-0 flex flex-col items-center gap-0.5" > - () +const headerViewport = ref() + +/** + * Narrow screens scroll instead of crushing the regional forms together. The + * fixed allowance covers the overprint thumbnail, stroke count, gaps and row + * padding; every visible region then keeps a comfortable character column. + */ +const tableMinWidth = computed( + () => `${visibleRegions.value.length * 4.5 + 10}rem`, +) + +/** Keep the sticky header aligned with the horizontally moving data rows. */ +function syncHeader(event: Event) { + if (headerViewport.value) + headerViewport.value.scrollLeft = ( + event.currentTarget as HTMLElement + ).scrollLeft +} function turnTo(page: number) { chars.page.value = Math.min(Math.max(1, page), chars.pageCount.value) @@ -15,24 +33,31 @@ function turnTo(page: number) { + + diff --git a/app/components/DataSources.vue b/app/components/DataSources.vue index 797a278..ae5a745 100644 --- a/app/components/DataSources.vue +++ b/app/components/DataSources.vue @@ -14,12 +14,12 @@ const localize = ( + + diff --git a/app/components/FilterBar.vue b/app/components/FilterBar.vue index bd9eb99..07d3c25 100644 --- a/app/components/FilterBar.vue +++ b/app/components/FilterBar.vue @@ -161,56 +161,58 @@ function toggleRegion(region: string) { + + diff --git a/app/components/HeroOverprint.vue b/app/components/HeroOverprint.vue index c9d157e..2ed74d5 100644 --- a/app/components/HeroOverprint.vue +++ b/app/components/HeroOverprint.vue @@ -33,7 +33,7 @@ const groupCount = computed( ) const colorOf = (group: number) => - groupCount.value === 1 ? 'var(--c-ink)' : `var(--c-g${group + 1})` + groupCount.value === 1 ? 'var(--c-ink)' : groupColor(group) const label = computed(() => list( @@ -99,7 +99,7 @@ function toggle() {