Skip to content

Commit 48da01b

Browse files
committed
feat(dashboard): default DataList.Row to vertical center alignment
- Set DataList.Row align default to center (items-center) - Use align="start" on monitors, goals, and anomalies for multi-line rows - Remove redundant align props from funnels and flags - Document default in design-system.mdc
1 parent 881c9b8 commit 48da01b

File tree

7 files changed

+40
-31
lines changed

7 files changed

+40
-31
lines changed

.cursor/rules/design-system.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This file is **intentionally small**. It grows as we lock patterns. **Interactio
2828

2929
All list views use the `DataList` compound component (`components/data-list.tsx`). Wrap in `<DataList className="rounded bg-card">` — no border on root.
3030

31-
- **Row defaults:** `align="start"` for wrapping text, `align="center"` for single-line rows (e.g. flags). `w-full` is built-in — don't repeat it.
31+
- **Row defaults:** `DataList.Row` defaults to `align="center"` (vertical center). Use `align="start"` when multi-line text should stay top-aligned (monitors, goals, anomalies). `w-full` is built-in — don't repeat it.
3232
- **Cell defaults:** `shrink-0` and `min-w-0` are built-in — don't repeat them. `text-start` is the browser default — don't add it.
3333
- **Inactive/paused state:** `opacity-50` on the Row, not a badge.
3434
- **`pt-0.5`** on non-text cells (icons, stats, actions) to align with text baseline in `items-start` rows. Omit in `items-center` rows.

apps/dashboard/app/(main)/websites/[id]/anomalies/_components/anomaly-item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function AnomalyItem({ anomaly }: AnomalyItemProps) {
8686
anomaly.type === "spike" ? "text-destructive" : "text-blue-500";
8787

8888
return (
89-
<DataList.Row>
89+
<DataList.Row align="start">
9090
<DataList.Cell className="pt-0.5">
9191
<div
9292
className={cn(

apps/dashboard/app/(main)/websites/[id]/flags/_components/flags-list.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ function FlagRow({
297297

298298
return (
299299
<DataList.Row
300-
align="center"
301300
asChild
302301
className={cn("min-w-full", flag.status === "archived" && "opacity-50")}
303302
>

apps/dashboard/app/(main)/websites/[id]/funnels/_components/funnel-item.tsx

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -144,33 +144,39 @@ export function FunnelItem({
144144
tabIndex={0}
145145
type="button"
146146
>
147-
<DataList.Cell className="w-8 pt-0.5">
148-
<CaretRightIcon
147+
<DataList.Cell>
148+
<div
149149
className={cn(
150-
"size-4 text-muted-foreground transition-transform duration-200",
151-
isExpanded && "rotate-90"
150+
"flex size-8 shrink-0 items-center justify-center rounded border transition-colors",
151+
isExpanded
152+
? "border-border bg-accent/40 text-foreground"
153+
: "border-transparent bg-muted text-muted-foreground"
152154
)}
153-
weight="fill"
154-
/>
155+
>
156+
<CaretRightIcon
157+
className={cn(
158+
"size-4 transition-transform duration-200",
159+
isExpanded && "rotate-90"
160+
)}
161+
weight="fill"
162+
/>
163+
</div>
155164
</DataList.Cell>
156165

157-
<DataList.Cell className="w-40 min-w-0 lg:w-52">
158-
<p className="wrap-break-word text-pretty font-medium text-foreground text-sm">
159-
{funnel.name}
160-
</p>
161-
</DataList.Cell>
162-
163-
<DataList.Cell grow>
164-
{funnel.description ? (
165-
<p className="wrap-break-word text-pretty text-muted-foreground text-xs">
166-
{funnel.description}
166+
<DataList.Cell className="min-w-0" grow>
167+
<div className="w-full text-start">
168+
<p className="wrap-break-word text-pretty font-medium text-foreground text-sm">
169+
{funnel.name}
167170
</p>
168-
) : (
169-
<p className="text-muted-foreground text-xs"></p>
170-
)}
171+
{funnel.description ? (
172+
<p className="wrap-break-word mt-1 text-pretty text-muted-foreground text-xs">
173+
{funnel.description}
174+
</p>
175+
) : null}
176+
</div>
171177
</DataList.Cell>
172178

173-
<DataList.Cell className="hidden items-start gap-3 pt-0.5 lg:flex">
179+
<DataList.Cell className="hidden items-center gap-3 lg:flex">
174180
{isLoadingAnalytics ? (
175181
<>
176182
<Skeleton className="h-5 w-32 rounded lg:w-44" />
@@ -204,7 +210,7 @@ export function FunnelItem({
204210
)}
205211
</DataList.Cell>
206212

207-
<DataList.Cell className="w-14 pt-0.5 text-right lg:hidden">
213+
<DataList.Cell className="w-14 text-right lg:hidden">
208214
{isLoadingAnalytics ? (
209215
<Skeleton className="ms-auto h-4 w-12 rounded" />
210216
) : (
@@ -214,7 +220,7 @@ export function FunnelItem({
214220
)}
215221
</DataList.Cell>
216222

217-
<DataList.Cell action className="pt-0.5">
223+
<DataList.Cell action>
218224
<DropdownMenu>
219225
<DropdownMenuTrigger asChild>
220226
<Button
@@ -264,10 +270,10 @@ export function FunnelItem({
264270

265271
export function FunnelItemSkeleton() {
266272
return (
267-
<div className="flex h-15 items-center gap-4 border-border/80 border-b px-4 last:border-b-0">
268-
<Skeleton className="size-4 shrink-0 rounded" />
273+
<div className="flex h-15 items-center gap-4 border-border/80 border-b px-4 py-3 last:border-b-0">
274+
<Skeleton className="size-8 shrink-0 rounded" />
269275
<div className="min-w-0 flex-1 space-y-1.5">
270-
<Skeleton className="h-4 w-36" />
276+
<Skeleton className="h-4 w-36 max-w-full" />
271277
<Skeleton className="h-3 w-48 max-w-full" />
272278
</div>
273279
<div className="hidden shrink-0 items-center gap-3 lg:flex">

apps/dashboard/app/(main)/websites/[id]/goals/_components/goal-item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function GoalItem({
8787
const TypeIcon = config.icon;
8888

8989
return (
90-
<DataList.Row className={cn(!goal.isActive && "opacity-50")}>
90+
<DataList.Row align="start" className={cn(!goal.isActive && "opacity-50")}>
9191
<DataList.Cell className="pt-0.5">
9292
<div
9393
className={cn(

apps/dashboard/components/data-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ interface DataListRowProps {
6060
}
6161

6262
function DataListRow({
63-
align = "start",
63+
align = "center",
6464
asChild = false,
6565
children,
6666
className,

apps/dashboard/components/monitors/monitor-row.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,11 @@ export function MonitorRow({
309309
};
310310

311311
return (
312-
<DataList.Row asChild className={cn(!isActive && "opacity-50")}>
312+
<DataList.Row
313+
align="start"
314+
asChild
315+
className={cn(!isActive && "opacity-50")}
316+
>
313317
<Link href={`/monitors/${schedule.id}`} onClick={handleClick}>
314318
<DataList.Cell className="pt-0.5">
315319
<div

0 commit comments

Comments
 (0)