The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
show blur to indicate scrollable
Steven Tey02f89d483102
diff --git a/apps/web/ui/partners/bounties/bounty-social-metrics-rewards-table.tsx b/apps/web/ui/partners/bounties/bounty-social-metrics-rewards-table.tsxindex efbf4200c5..b8e6889aa2 100644--- a/apps/web/ui/partners/bounties/bounty-social-metrics-rewards-table.tsx+++ b/apps/web/ui/partners/bounties/bounty-social-metrics-rewards-table.tsx@@ -9,10 +9,10 @@ import {} from "@/lib/bounty/social-metrics-milestones";import { resolveBountyDetails } from "@/lib/bounty/utils";import { BountySubmissionProps, PartnerBountyProps } from "@/lib/types";-import { StatusBadge, Table, useTable } from "@dub/ui";+import { StatusBadge, Table, useScrollProgress, useTable } from "@dub/ui";import { capitalize, currencyFormatter } from "@dub/utils";import { ColumnDef } from "@tanstack/react-table";-import { useMemo } from "react";+import { useMemo, useRef } from "react";const milestoneStatusBadges = {approved: {@@ -98,6 +98,9 @@ export function BountySocialMetricsRewardsTable({[metric, submission],);+ const scrollRef = useRef<HTMLDivElement>(null);+ const { scrollProgress, updateScrollProgress } = useScrollProgress(scrollRef);+const table = useTable({data: milestones,columns,@@ -118,8 +121,16 @@ export function BountySocialMetricsRewardsTable({<h2 className="text-content-emphasis text-base font-semibold">{titleText}</h2>- <div className="mt-3">- <Table {...table} />+ <div className="relative mt-3">+ <Table+ {...table}+ scrollWrapperRef={scrollRef}+ onScroll={updateScrollProgress}+ />+ <div+ className="pointer-events-none absolute inset-x-px bottom-px z-10 h-16 rounded-b-[11px] bg-gradient-to-t from-white to-transparent"+ style={{ opacity: 1 - Math.pow(scrollProgress, 2) }}+ /></div></div>);diff --git a/packages/ui/src/table/table.tsx b/packages/ui/src/table/table.tsxindex ce18d38c90..8e91b29238 100644--- a/packages/ui/src/table/table.tsx+++ b/packages/ui/src/table/table.tsx@@ -443,6 +443,8 @@ export function Table<T>({className,containerClassName,scrollWrapperClassName,+ scrollWrapperRef,+ onScroll,emptyWrapperClassName,thClassName,tdClassName,@@ -467,7 +469,6 @@ export function Table<T>({columnsAfterSelect.add(visibleColumns[i].id);}}- const scrollWrapperRef = useRef<HTMLDivElement>(null);const utilityColumnWidths = new Map(visibleColumns.map((column) => [column.id, column.getSize()]),);@@ -495,6 +496,7 @@ export function Table<T>({)}<divref={scrollWrapperRef}+ onScroll={onScroll}className={cn("relative min-h-[400px] overflow-x-auto rounded-[inherit]",scrollWrapperClassName,diff --git a/packages/ui/src/table/types.ts b/packages/ui/src/table/types.tsindex 2d72b4ca62..ab9351c060 100644--- a/packages/ui/src/table/types.ts+++ b/packages/ui/src/table/types.ts@@ -15,7 +15,9 @@ import {MouseEvent,PropsWithChildren,ReactNode,+ Ref,SetStateAction,+ UIEventHandler,} from "react";type BaseTableProps<T> = {@@ -64,6 +66,8 @@ type BaseTableProps<T> = {className?: string;containerClassName?: string;scrollWrapperClassName?: string;+ scrollWrapperRef?: Ref<HTMLDivElement>;+ onScroll?: UIEventHandler<HTMLDivElement>;emptyWrapperClassName?: string;thClassName?: string | ((columnId: string) => string);tdClassName?: string | ((columnId: string, row: Row<T>) => string);