The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(www): pricing table spacing and sticky offset (#49532)
Pamela Chia6d4263bf1a0b
diff --git a/apps/www/components/Pricing/PricingComparisonTable.tsx b/apps/www/components/Pricing/PricingComparisonTable.tsxindex 515f662f9ea..b8b42e4d436 100644--- a/apps/www/components/Pricing/PricingComparisonTable.tsx+++ b/apps/www/components/Pricing/PricingComparisonTable.tsx@@ -4,8 +4,9 @@ import { PricingTableRowDesktop, PricingTableRowMobile } from '~/components/Pricimport Solutions from '~/data/MainProducts'import { Organization } from '~/data/organizations'import { useSendTelemetryEvent } from '~/lib/telemetry'+import { useIsomorphicLayoutEffect } from 'common'import Link from 'next/link'-import { useState } from 'react'+import { useRef, useState } from 'react'import { plans } from 'shared-data/plans'import { pricing } from 'shared-data/pricing'import {@@ -120,6 +121,23 @@ const PricingComparisonTable = ({const sendTelemetryEvent = useSendTelemetryEvent()const orgSlug = organizations?.[0]?.slug+ const tableRef = useRef<HTMLTableElement>(null)+ const theadRef = useRef<HTMLTableSectionElement>(null)++ useIsomorphicLayoutEffect(() => {+ const table = tableRef.current+ const thead = theadRef.current+ if (!table || !thead) return++ const observer = new ResizeObserver(() => {+ const theadTop = parseFloat(getComputedStyle(thead).top) || 0+ const categoryTop = Math.floor(theadTop + thead.getBoundingClientRect().height)+ table.style.setProperty('--pricing-category-top', `${categoryTop}px`)+ })+ observer.observe(thead)+ return () => observer.disconnect()+ }, [])+return (<divid="compare-plans"@@ -372,9 +390,9 @@ const PricingComparisonTable = ({{/* <!-- lg+ --> */}<div className="hidden lg:block">- <table className="h-px w-full table-fixed">+ <table ref={tableRef} className="h-px w-full table-fixed"><caption className="sr-only">Pricing plan comparison</caption>- <thead className="bg-background sticky top-[62px] z-10">+ <thead ref={theadRef} className="bg-background sticky top-[62px] z-10"><tr><thclassName="text-foreground w-1/3 px-6 pt-2 pb-2 text-left text-sm font-normal"diff --git a/apps/www/components/Pricing/PricingTableRow.tsx b/apps/www/components/Pricing/PricingTableRow.tsxindex f9bd8626458..440d380edeb 100644--- a/apps/www/components/Pricing/PricingTableRow.tsx+++ b/apps/www/components/Pricing/PricingTableRow.tsx@@ -166,8 +166,10 @@ export const PricingTableRowDesktop = (props: any) => {style={{ borderTop: 'none' }}id={`${props.sectionId}-desktop`}>+ {/* 108px/84px are pre-hydration fallbacks only; after mount PricingComparisonTable+ measures the sticky thead into --pricing-category-top and that value wins */}<th- className="bg-background text-foreground sticky top-[108px] xl:top-[84px] z-10 py-3 pl-6 text-left text-sm font-medium"+ className="bg-background text-foreground sticky top-[var(--pricing-category-top,108px)] xl:top-[var(--pricing-category-top,84px)] z-10 py-3 pl-6 text-left text-sm font-medium"scope="colgroup"><div className="flex items-center gap-4">@@ -207,7 +209,7 @@ export const PricingTableRowDesktop = (props: any) => {<tdkey={i}className={[- `pl-6 pr-2 tier-${planName}`,+ `pl-6 pr-2 py-5 tier-${planName}`,typeof planValue === 'boolean' ? 'text-center' : '',].join(' ')}>@@ -218,7 +220,7 @@ export const PricingTableRowDesktop = (props: any) => {<IconPricingMinus plan={planValue} /></div>) : (- <div className="text-foreground text-xs flex flex-col justify-center">+ <div className="text-foreground text-xs flex flex-col justify-center gap-2"><span className="flex items-center gap-2">{tooltips?.[planName] && (<InfoTooltip