Files
supabase/apps/www/components/Regions/RegionsList.tsx
Danny White 7e44d321b3 feat(www): adopt shared inline code defaults (#51983)
## Problem

WWW has duplicate inline-code styles. Changelog code stays at a fixed
size even when the surrounding text is larger.

## Solution

Import the shared styles from #51980 and remove duplicate Markdown
styling. Code uses the default foreground colour and follows the
surrounding weight, and scales from 12.5px beside 14px text to 14px
beside 16px text, with a `0.75rem` minimum (normally 12px). Region
labels keep their own styles.

## Review instructions

1. Open the [branch configuration blog
post](https://zone-www-dot-com-git-dnywh-depr-707-code-www-supabase.vercel.app/blog/how-a-new-branch-gets-its-config-migrations-and-functions).
The filename “`config.toml`” should be 14px beside 16px prose.
2. Open the
[changelog](https://zone-www-dot-com-git-dnywh-depr-707-code-www-supabase.vercel.app/changelog).
Check code in headings, paragraphs and tables at narrow and desktop
widths, in both themes.
3. Check that code blocks and region labels keep their existing
appearance.

| Before | After |
| --- | --- |
| <img width="1306" height="494" alt="CleanShot 2026-10-19 at 14 34
58@2x"
src="https://github.com/user-attachments/assets/349f5eb5-7a4a-44ae-ba3a-ae75f083dea2"
/> | <img width="1244" height="448" alt="CleanShot 2026-10-19 at 14 35
33@2x"
src="https://github.com/user-attachments/assets/61753f8a-f6e3-4482-b19a-ac9d39609545"
/> |
| <img width="1308" height="246" alt="CleanShot 2026-10-20 at 15 59
46@2x"
src="https://github.com/user-attachments/assets/db7cca69-7009-44d1-bae3-a5424e367e36"
/> | <img width="1312" height="266" alt="CleanShot 2026-10-20 at 15 58
58@2x"
src="https://github.com/user-attachments/assets/720c6370-5ce2-4be3-8346-0852f7803c26"
/> |
2026-10-22 00:48:57 +00:00

79 lines
2.9 KiB
TypeScript

'use client'
import { Badge, cn } from 'ui'
import { GROUPED_REGIONS } from './Regions.constants'
interface Props {
selectedRegionCode: string | null
hoveredRegionCode?: string
onRegionHover: (code?: string) => void
onRegionSelect: (code: string) => void
}
export const RegionsList = ({
selectedRegionCode,
hoveredRegionCode,
onRegionHover,
onRegionSelect,
}: Props) => (
<div className="grid grid-cols-1 gap-8 md:grid-cols-3 lg:gap-12">
{GROUPED_REGIONS.map(({ group, regions }) => (
<div key={group} className="flex flex-col gap-3">
<h3 className="font-mono text-xs uppercase tracking-widest text-foreground-muted">
{group}
</h3>
<ul className="flex flex-col divide-y divide-border-muted border-t border-border-muted">
{regions.map((region) => {
const isSelected = region.code === selectedRegionCode
return (
<li key={region.code}>
<button
type="button"
tabIndex={0}
aria-pressed={isSelected}
onClick={() => onRegionSelect(region.code)}
onMouseEnter={() => onRegionHover(region.code)}
onMouseLeave={() => onRegionHover(undefined)}
onFocus={() => onRegionHover(region.code)}
onBlur={() => onRegionHover(undefined)}
className={cn(
// Bleeds the hover background 8px each side so row content stays aligned with the heading
'-mx-2 flex w-[calc(100%+1rem)] items-center gap-3 rounded-sm px-2 py-2.5 text-left transition-colors',
'hover:bg-surface-100 focus-visible:ring-2 focus-visible:ring-foreground-lighter focus-visible:outline-none',
isSelected && 'bg-surface-100',
!isSelected && region.code === hoveredRegionCode && 'bg-surface-100'
)}
>
{/* Flags are SVGs, which next/image can't serve while dangerouslyAllowSVG is off */}
<img
alt=""
className="w-4 shrink-0 rounded-xs"
src={`/images/regions/${region.code}.svg`}
/>
<span
className={cn(
'text-xs',
isSelected ? 'text-foreground' : 'text-foreground-light'
)}
>
{region.displayName}
</span>
{region.jurisdiction && <Badge>{region.jurisdiction}</Badge>}
<code
data-code-style="plain"
className="ml-auto shrink-0 font-mono text-xs text-foreground-lighter"
>
{region.code}
</code>
</button>
</li>
)
})}
</ul>
</div>
))}
</div>
)