Skip to content

Commit a0ee9cb

Browse files
committed
Refactor UI components and enhance logging structure
- Updated `globals.css` to ensure consistent scrollbar hiding across browsers. - Modified `layout.tsx` to wrap children with `TooltipProvider` for improved tooltip functionality. - Refactored log entry structure in `playground/index.tsx` to include new properties: `contextLines`, `message`, and `service`. - Enhanced `journey.tsx` and `stats.tsx` components to streamline milestone and stat card properties. - Adjusted `page-actions.tsx` to reorder props for better clarity. - Improved styling and structure in various UI components including `accordion.tsx`, `alert-dialog.tsx`, and `button.tsx` for better maintainability and consistency. - Updated `chart.tsx` to refine tooltip handling and improve type safety in chart configurations. - General cleanup and reorganization of component styles for better readability and performance.
1 parent c514f9f commit a0ee9cb

61 files changed

Lines changed: 607 additions & 423 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/docs/app/(home)/components/playground/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ export interface ContextLine {
5555
}
5656

5757
export interface LogEntry {
58-
timestamp: string
58+
contextLines: ContextLine[]
5959
durationMs: number
60+
message: string
6061
method: HttpMethod
6162
pathname: string
63+
service: string
6264
status: number
65+
timestamp: string
6366
type: LogType
64-
service: string
65-
message: string
66-
contextLines: ContextLine[]
6767
}
6868

6969
const SLOW_MS = 500
@@ -413,7 +413,7 @@ const ContextTree = ({ lines }: { lines: ContextLine[] }) => {
413413
return (
414414
<div
415415
className="whitespace-pre-wrap font-mono text-[10px] leading-snug sm:text-xs"
416-
key={`${line.key}-${line.value}-${i}`}
416+
key={`${line.key}-${line.value}-${line.key}`}
417417
>
418418
<span className="text-muted-foreground/80">{` ${branch} `}</span>
419419
<span className="text-cyan-400">{line.key}</span>
@@ -508,10 +508,10 @@ const Output = () => {
508508
return (
509509
<code className="flex animate-marquee-vertical flex-col will-change-transform">
510510
<div className="flex flex-col">
511-
{repeatedLogs.flatMap((logList, repeatIndex) =>
512-
logList.map((log, logIndex) => (
511+
{repeatedLogs.flatMap(logList =>
512+
logList.map(log => (
513513
<LogBlock
514-
key={`${repeatIndex}-${logIndex}-${log.method}-${log.pathname}-${log.status}-${log.type}-${log.timestamp}-${log.durationMs}`}
514+
key={`${log.method}-${log.pathname}-${log.status}-${log.type}-${log.timestamp}-${log.durationMs}`}
515515
log={log}
516516
/>
517517
))

apps/docs/app/(years)/2025/components/journey.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { cn } from '@/lib/utils'
55
import { Section } from './section'
66

77
interface Milestone {
8+
description: string
89
month: string
910
title: string
10-
description: string
1111
}
1212

1313
const milestones: Milestone[] = [

apps/docs/app/(years)/2025/components/stats.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import { Card } from '@/components/ui/card'
1414
import { Section } from './section'
1515

1616
interface StatCardProps {
17-
title: string
18-
value: string | number
17+
delay?: number
1918
description?: string
2019
icon?: ReactNode
21-
delay?: number
20+
title: string
21+
value: string | number
2222
}
2323

2424
const StatCard = ({

apps/docs/app/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@
179179
}
180180

181181
@utility hide-scrollbar {
182-
scrollbar-width: none;
183182
-ms-overflow-style: none;
183+
scrollbar-width: none;
184184
&::-webkit-scrollbar {
185185
display: none;
186186
}

apps/docs/app/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import './globals.css'
22
import { RootProvider } from 'fumadocs-ui/provider/next'
33
import type { ReactNode } from 'react'
44
import { Toaster } from '@/components/ui/sonner'
5+
import { TooltipProvider } from '@/components/ui/tooltip'
56
import { fonts } from '@/lib/fonts'
67
import { AnalyticsProvider } from '@/providers/analytics'
78

@@ -19,7 +20,7 @@ const Layout = ({ children }: LayoutProps) => (
1920
enableSystem: true
2021
}}
2122
>
22-
{children}
23+
<TooltipProvider>{children}</TooltipProvider>
2324
</RootProvider>
2425
<Toaster />
2526
</AnalyticsProvider>

apps/docs/components/page-actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import {
2222
import { Button } from './ui/button'
2323

2424
interface ViewOptionsProps {
25-
markdownUrl: string
2625
githubUrl: string
26+
markdownUrl: string
2727
}
2828

2929
export const ViewOptions = ({ markdownUrl, githubUrl }: ViewOptionsProps) => {

apps/docs/components/ui/accordion.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ function Accordion({
1313
return (
1414
<AccordionPrimitive.Root
1515
data-slot="accordion"
16-
className={cn("overflow-hidden rounded-2xl border flex w-full flex-col", className)}
16+
className={cn(
17+
"flex w-full flex-col overflow-hidden rounded-2xl border",
18+
className
19+
)}
1720
{...props}
1821
/>
1922
)
@@ -26,7 +29,7 @@ function AccordionItem({
2629
return (
2730
<AccordionPrimitive.Item
2831
data-slot="accordion-item"
29-
className={cn("data-open:bg-muted/50 not-last:border-b", className)}
32+
className={cn("not-last:border-b data-open:bg-muted/50", className)}
3033
{...props}
3134
/>
3235
)
@@ -42,7 +45,7 @@ function AccordionTrigger({
4245
<AccordionPrimitive.Trigger
4346
data-slot="accordion-trigger"
4447
className={cn(
45-
"**:data-[slot=accordion-trigger-icon]:text-muted-foreground gap-6 p-4 text-left text-sm font-medium hover:underline **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 group/accordion-trigger relative flex flex-1 items-start justify-between border border-transparent transition-all outline-none disabled:pointer-events-none disabled:opacity-50",
48+
"group/accordion-trigger relative flex flex-1 items-start justify-between gap-6 border border-transparent p-4 text-left text-sm font-medium transition-all outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",
4649
className
4750
)}
4851
{...props}
@@ -63,12 +66,12 @@ function AccordionContent({
6366
return (
6467
<AccordionPrimitive.Content
6568
data-slot="accordion-content"
66-
className="data-open:animate-accordion-down data-closed:animate-accordion-up px-4 text-sm overflow-hidden"
69+
className="overflow-hidden px-4 text-sm data-open:animate-accordion-down data-closed:animate-accordion-up"
6770
{...props}
6871
>
6972
<div
7073
className={cn(
71-
"pt-0 pb-4 [&_a]:hover:text-foreground h-(--radix-accordion-content-height) [&_a]:underline [&_a]:underline-offset-3 [&_p:not(:last-child)]:mb-4",
74+
"h-(--radix-accordion-content-height) pt-0 pb-4 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",
7275
className
7376
)}
7477
>

apps/docs/components/ui/alert-dialog.tsx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ function AlertDialogOverlay({
3535
return (
3636
<AlertDialogPrimitive.Overlay
3737
data-slot="alert-dialog-overlay"
38-
className={cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50", className)}
38+
className={cn(
39+
"fixed inset-0 z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
40+
className
41+
)}
3942
{...props}
4043
/>
4144
)
@@ -55,7 +58,7 @@ function AlertDialogContent({
5558
data-slot="alert-dialog-content"
5659
data-size={size}
5760
className={cn(
58-
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/5 gap-6 rounded-4xl p-6 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-md group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",
61+
"group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-4xl bg-background p-6 ring-1 ring-foreground/5 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
5962
className
6063
)}
6164
{...props}
@@ -71,7 +74,10 @@ function AlertDialogHeader({
7174
return (
7275
<div
7376
data-slot="alert-dialog-header"
74-
className={cn("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", className)}
77+
className={cn(
78+
"grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
79+
className
80+
)}
7581
{...props}
7682
/>
7783
)
@@ -100,7 +106,10 @@ function AlertDialogMedia({
100106
return (
101107
<div
102108
data-slot="alert-dialog-media"
103-
className={cn("bg-muted mb-2 inline-flex size-16 items-center justify-center rounded-full sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8", className)}
109+
className={cn(
110+
"mb-2 inline-flex size-16 items-center justify-center rounded-full bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
111+
className
112+
)}
104113
{...props}
105114
/>
106115
)
@@ -113,7 +122,10 @@ function AlertDialogTitle({
113122
return (
114123
<AlertDialogPrimitive.Title
115124
data-slot="alert-dialog-title"
116-
className={cn("text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", className)}
125+
className={cn(
126+
"text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
127+
className
128+
)}
117129
{...props}
118130
/>
119131
)
@@ -126,7 +138,10 @@ function AlertDialogDescription({
126138
return (
127139
<AlertDialogPrimitive.Description
128140
data-slot="alert-dialog-description"
129-
className={cn("text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3", className)}
141+
className={cn(
142+
"text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
143+
className
144+
)}
130145
{...props}
131146
/>
132147
)

apps/docs/components/ui/alert.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@ import { cva, type VariantProps } from "class-variance-authority"
33

44
import { cn } from "@/lib/utils"
55

6-
const alertVariants = cva("grid gap-0.5 rounded-lg border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 w-full relative group/alert", {
7-
variants: {
8-
variant: {
9-
default: "bg-card text-card-foreground",
10-
destructive: "text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
6+
const alertVariants = cva(
7+
"group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
8+
{
9+
variants: {
10+
variant: {
11+
default: "bg-card text-card-foreground",
12+
destructive:
13+
"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
14+
},
1115
},
12-
},
13-
defaultVariants: {
14-
variant: "default",
15-
},
16-
})
16+
defaultVariants: {
17+
variant: "default",
18+
},
19+
}
20+
)
1721

1822
function Alert({
1923
className,
@@ -35,7 +39,7 @@ function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
3539
<div
3640
data-slot="alert-title"
3741
className={cn(
38-
"font-medium group-has-[>svg]/alert:col-start-2 [&_a]:hover:text-foreground [&_a]:underline [&_a]:underline-offset-3",
42+
"font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",
3943
className
4044
)}
4145
{...props}
@@ -51,7 +55,7 @@ function AlertDescription({
5155
<div
5256
data-slot="alert-description"
5357
className={cn(
54-
"text-muted-foreground text-sm text-balance md:text-pretty [&_p:not(:last-child)]:mb-4 [&_a]:hover:text-foreground [&_a]:underline [&_a]:underline-offset-3",
58+
"text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",
5559
className
5660
)}
5761
{...props}

apps/docs/components/ui/avatar.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function Avatar({
1717
data-slot="avatar"
1818
data-size={size}
1919
className={cn(
20-
"size-8 rounded-full after:rounded-full data-[size=lg]:size-10 data-[size=sm]:size-6 after:border-border group/avatar relative flex shrink-0 select-none after:absolute after:inset-0 after:border after:mix-blend-darken dark:after:mix-blend-lighten",
20+
"group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",
2121
className
2222
)}
2323
{...props}
@@ -33,7 +33,7 @@ function AvatarImage({
3333
<AvatarPrimitive.Image
3434
data-slot="avatar-image"
3535
className={cn(
36-
"rounded-full aspect-square size-full object-cover",
36+
"aspect-square size-full rounded-full object-cover",
3737
className
3838
)}
3939
{...props}
@@ -49,7 +49,7 @@ function AvatarFallback({
4949
<AvatarPrimitive.Fallback
5050
data-slot="avatar-fallback"
5151
className={cn(
52-
"bg-muted text-muted-foreground rounded-full flex size-full items-center justify-center text-sm group-data-[size=sm]/avatar:text-xs",
52+
"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
5353
className
5454
)}
5555
{...props}
@@ -62,7 +62,7 @@ function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
6262
<span
6363
data-slot="avatar-badge"
6464
className={cn(
65-
"bg-primary text-primary-foreground ring-background absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-blend-color ring-2 select-none",
65+
"absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",
6666
"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
6767
"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
6868
"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
@@ -78,7 +78,7 @@ function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {
7878
<div
7979
data-slot="avatar-group"
8080
className={cn(
81-
"*:data-[slot=avatar]:ring-background group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2",
81+
"group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
8282
className
8383
)}
8484
{...props}
@@ -93,7 +93,10 @@ function AvatarGroupCount({
9393
return (
9494
<div
9595
data-slot="avatar-group-count"
96-
className={cn("bg-muted text-muted-foreground size-8 rounded-full text-sm group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3 ring-background relative flex shrink-0 items-center justify-center ring-2", className)}
96+
className={cn(
97+
"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
98+
className
99+
)}
97100
{...props}
98101
/>
99102
)

0 commit comments

Comments
 (0)