Skip to content

Commit 2facc5e

Browse files
tnyleataylorotwell
andauthored
ShadCN component Updates. (#33)
* Adding component updates recommended by ShadCN * reverting font to original --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 8da6676 commit 2facc5e

23 files changed

+2171
-1494
lines changed

resources/css/app.css

Lines changed: 68 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
--color-chart-4: var(--chart-4);
4949
--color-chart-5: var(--chart-5);
5050

51-
--color-sidebar: var(--sidebar-background);
51+
--color-sidebar: var(--sidebar);
5252
--color-sidebar-foreground: var(--sidebar-foreground);
5353
--color-sidebar-primary: var(--sidebar-primary);
5454
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
@@ -67,6 +67,7 @@
6767
color utility to any element that depends on these defaults.
6868
*/
6969
@layer base {
70+
7071
*,
7172
::after,
7273
::before,
@@ -77,74 +78,74 @@
7778
}
7879

7980
:root {
80-
--background: hsl(0, 0%, 100%);
81-
--foreground: hsl(0, 0%, 3.9%);
82-
--card: hsl(0, 0%, 100%);
83-
--card-foreground: hsl(0, 0%, 3.9%);
84-
--popover: hsl(0, 0%, 100%);
85-
--popover-foreground: hsl(0, 0%, 3.9%);
86-
--primary: hsl(0, 0%, 9%);
87-
--primary-foreground: hsl(0, 0%, 98%);
88-
--secondary: hsl(0, 0%, 96.1%);
89-
--secondary-foreground: hsl(0, 0%, 9%);
90-
--muted: hsl(0, 0%, 96.1%);
91-
--muted-foreground: hsl(0, 0%, 45.1%);
92-
--accent: hsl(0, 0%, 96.1%);
93-
--accent-foreground: hsl(0, 0%, 9%);
94-
--destructive: hsl(0, 84.2%, 60.2%);
95-
--destructive-foreground: hsl(0, 0%, 98%);
96-
--border: hsl(0, 0%, 92.8%);
97-
--input: hsl(0, 0%, 89.8%);
98-
--ring: hsl(0, 0%, 3.9%);
99-
--chart-1: hsl(12, 76%, 61%);
100-
--chart-2: hsl(173, 58%, 39%);
101-
--chart-3: hsl(197, 37%, 24%);
102-
--chart-4: hsl(43, 74%, 66%);
103-
--chart-5: hsl(27, 87%, 67%);
104-
--radius: 0.5rem;
105-
--sidebar-background: hsl(0, 0%, 98%);
106-
--sidebar-foreground: hsl(240, 5.3%, 30%);
107-
--sidebar-primary: hsl(0, 0%, 10%);
108-
--sidebar-primary-foreground: hsl(0, 0%, 98%);
109-
--sidebar-accent: hsl(0, 0%, 94%);
110-
--sidebar-accent-foreground: hsl(0, 0%, 30%);
111-
--sidebar-border: hsl(0, 0%, 91%);
112-
--sidebar-ring: hsl(217.2, 91.2%, 59.8%);
81+
--background: oklch(1 0 0);
82+
--foreground: oklch(0.145 0 0);
83+
--card: oklch(1 0 0);
84+
--card-foreground: oklch(0.145 0 0);
85+
--popover: oklch(1 0 0);
86+
--popover-foreground: oklch(0.145 0 0);
87+
--primary: oklch(0.205 0 0);
88+
--primary-foreground: oklch(0.985 0 0);
89+
--secondary: oklch(0.97 0 0);
90+
--secondary-foreground: oklch(0.205 0 0);
91+
--muted: oklch(0.97 0 0);
92+
--muted-foreground: oklch(0.556 0 0);
93+
--accent: oklch(0.97 0 0);
94+
--accent-foreground: oklch(0.205 0 0);
95+
--destructive: oklch(0.577 0.245 27.325);
96+
--destructive-foreground: oklch(0.577 0.245 27.325);
97+
--border: oklch(0.922 0 0);
98+
--input: oklch(0.922 0 0);
99+
--ring: oklch(0.87 0 0);
100+
--chart-1: oklch(0.646 0.222 41.116);
101+
--chart-2: oklch(0.6 0.118 184.704);
102+
--chart-3: oklch(0.398 0.07 227.392);
103+
--chart-4: oklch(0.828 0.189 84.429);
104+
--chart-5: oklch(0.769 0.188 70.08);
105+
--radius: 0.625rem;
106+
--sidebar: oklch(0.985 0 0);
107+
--sidebar-foreground: oklch(0.145 0 0);
108+
--sidebar-primary: oklch(0.205 0 0);
109+
--sidebar-primary-foreground: oklch(0.985 0 0);
110+
--sidebar-accent: oklch(0.97 0 0);
111+
--sidebar-accent-foreground: oklch(0.205 0 0);
112+
--sidebar-border: oklch(0.922 0 0);
113+
--sidebar-ring: oklch(0.87 0 0);
113114
}
114115

115116
.dark {
116-
--background: hsl(0, 0%, 3.9%);
117-
--foreground: hsl(0, 0%, 98%);
118-
--card: hsl(0, 0%, 3.9%);
119-
--card-foreground: hsl(0, 0%, 98%);
120-
--popover: hsl(0, 0%, 3.9%);
121-
--popover-foreground: hsl(0, 0%, 98%);
122-
--primary: hsl(0, 0%, 98%);
123-
--primary-foreground: hsl(0, 0%, 9%);
124-
--secondary: hsl(0, 0%, 14.9%);
125-
--secondary-foreground: hsl(0, 0%, 98%);
126-
--muted: hsl(0, 0%, 6.9%);
127-
--muted-foreground: hsl(0, 0%, 63.9%);
128-
--accent: hsl(0, 0%, 14.9%);
129-
--accent-foreground: hsl(0, 0%, 98%);
130-
--destructive: hsl(0, 84%, 60%);
131-
--destructive-foreground: hsl(0, 0%, 98%);
132-
--border: hsl(0, 0%, 14.9%);
133-
--input: hsl(0, 0%, 14.9%);
134-
--ring: hsl(0, 0%, 83.1%);
135-
--chart-1: hsl(220, 70%, 50%);
136-
--chart-2: hsl(160, 60%, 45%);
137-
--chart-3: hsl(30, 80%, 55%);
138-
--chart-4: hsl(280, 65%, 60%);
139-
--chart-5: hsl(340, 75%, 55%);
140-
--sidebar-background: hsl(0, 0%, 7%);
141-
--sidebar-foreground: hsl(0, 0%, 80%);
142-
--sidebar-primary: hsl(360, 100%, 100%);
143-
--sidebar-primary-foreground: hsl(0, 0%, 100%);
144-
--sidebar-accent: hsl(0, 0%, 15.9%);
145-
--sidebar-accent-foreground: hsl(240, 4.8%, 95.9%);
146-
--sidebar-border: hsl(0, 0%, 15.9%);
147-
--sidebar-ring: hsl(217.2, 91.2%, 59.8%);
117+
--background: oklch(0.145 0 0);
118+
--foreground: oklch(0.985 0 0);
119+
--card: oklch(0.145 0 0);
120+
--card-foreground: oklch(0.985 0 0);
121+
--popover: oklch(0.145 0 0);
122+
--popover-foreground: oklch(0.985 0 0);
123+
--primary: oklch(0.985 0 0);
124+
--primary-foreground: oklch(0.205 0 0);
125+
--secondary: oklch(0.269 0 0);
126+
--secondary-foreground: oklch(0.985 0 0);
127+
--muted: oklch(0.269 0 0);
128+
--muted-foreground: oklch(0.708 0 0);
129+
--accent: oklch(0.269 0 0);
130+
--accent-foreground: oklch(0.985 0 0);
131+
--destructive: oklch(0.396 0.141 25.723);
132+
--destructive-foreground: oklch(0.637 0.237 25.331);
133+
--border: oklch(0.269 0 0);
134+
--input: oklch(0.269 0 0);
135+
--ring: oklch(0.439 0 0);
136+
--chart-1: oklch(0.488 0.243 264.376);
137+
--chart-2: oklch(0.696 0.17 162.48);
138+
--chart-3: oklch(0.769 0.188 70.08);
139+
--chart-4: oklch(0.627 0.265 303.9);
140+
--chart-5: oklch(0.645 0.246 16.439);
141+
--sidebar: oklch(0.205 0 0);
142+
--sidebar-foreground: oklch(0.985 0 0);
143+
--sidebar-primary: oklch(0.985 0 0);
144+
--sidebar-primary-foreground: oklch(0.985 0 0);
145+
--sidebar-accent: oklch(0.269 0 0);
146+
--sidebar-accent-foreground: oklch(0.985 0 0);
147+
--sidebar-border: oklch(0.269 0 0);
148+
--sidebar-ring: oklch(0.439 0 0);
148149
}
149150

150151
@layer base {
@@ -155,4 +156,4 @@
155156
body {
156157
@apply bg-background text-foreground;
157158
}
158-
}
159+
}

resources/js/components/ui/alert.tsx

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,66 @@
1-
import { cva, type VariantProps } from 'class-variance-authority';
2-
import * as React from 'react';
1+
import * as React from "react"
2+
import { cva, type VariantProps } from "class-variance-authority"
33

4-
import { cn } from '@/lib/utils';
4+
import { cn } from "@/lib/utils"
55

66
const alertVariants = cva(
7-
'relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground',
8-
{
9-
variants: {
10-
variant: {
11-
default: 'bg-background text-foreground',
12-
destructive: 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive',
13-
},
14-
},
15-
defaultVariants: {
16-
variant: 'default',
17-
},
7+
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
8+
{
9+
variants: {
10+
variant: {
11+
default: "bg-background text-foreground",
12+
destructive:
13+
"text-destructive-foreground [&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/80",
14+
},
1815
},
19-
);
16+
defaultVariants: {
17+
variant: "default",
18+
},
19+
}
20+
)
2021

21-
const Alert = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>>(
22-
({ className, variant, ...props }, ref) => <div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />,
23-
);
24-
Alert.displayName = 'Alert';
22+
function Alert({
23+
className,
24+
variant,
25+
...props
26+
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
27+
return (
28+
<div
29+
data-slot="alert"
30+
role="alert"
31+
className={cn(alertVariants({ variant }), className)}
32+
{...props}
33+
/>
34+
)
35+
}
2536

26-
const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(({ className, ...props }, ref) => (
27-
<h5 ref={ref} className={cn('mb-1 font-medium leading-none tracking-tight', className)} {...props} />
28-
));
29-
AlertTitle.displayName = 'AlertTitle';
37+
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
38+
return (
39+
<div
40+
data-slot="alert-title"
41+
className={cn(
42+
"col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
43+
className
44+
)}
45+
{...props}
46+
/>
47+
)
48+
}
3049

31-
const AlertDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(({ className, ...props }, ref) => (
32-
<div ref={ref} className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} />
33-
));
34-
AlertDescription.displayName = 'AlertDescription';
50+
function AlertDescription({
51+
className,
52+
...props
53+
}: React.ComponentProps<"div">) {
54+
return (
55+
<div
56+
data-slot="alert-description"
57+
className={cn(
58+
"text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
59+
className
60+
)}
61+
{...props}
62+
/>
63+
)
64+
}
3565

36-
export { Alert, AlertDescription, AlertTitle };
66+
export { Alert, AlertTitle, AlertDescription }

resources/js/components/ui/avatar.tsx

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,51 @@
1-
import * as AvatarPrimitive from '@radix-ui/react-avatar';
2-
import * as React from 'react';
1+
import * as React from "react"
2+
import * as AvatarPrimitive from "@radix-ui/react-avatar"
33

4-
import { cn } from '@/lib/utils';
4+
import { cn } from "@/lib/utils"
55

6-
const Avatar = React.forwardRef<React.ElementRef<typeof AvatarPrimitive.Root>, React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>>(
7-
({ className, ...props }, ref) => (
8-
<AvatarPrimitive.Root ref={ref} className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)} {...props} />
9-
),
10-
);
11-
Avatar.displayName = AvatarPrimitive.Root.displayName;
6+
function Avatar({
7+
className,
8+
...props
9+
}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
10+
return (
11+
<AvatarPrimitive.Root
12+
data-slot="avatar"
13+
className={cn(
14+
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
15+
className
16+
)}
17+
{...props}
18+
/>
19+
)
20+
}
1221

13-
const AvatarImage = React.forwardRef<React.ElementRef<typeof AvatarPrimitive.Image>, React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>>(
14-
({ className, ...props }, ref) => <AvatarPrimitive.Image ref={ref} className={cn('aspect-square h-full w-full', className)} {...props} />,
15-
);
16-
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
22+
function AvatarImage({
23+
className,
24+
...props
25+
}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
26+
return (
27+
<AvatarPrimitive.Image
28+
data-slot="avatar-image"
29+
className={cn("aspect-square size-full", className)}
30+
{...props}
31+
/>
32+
)
33+
}
1734

18-
const AvatarFallback = React.forwardRef<
19-
React.ElementRef<typeof AvatarPrimitive.Fallback>,
20-
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
21-
>(({ className, ...props }, ref) => (
35+
function AvatarFallback({
36+
className,
37+
...props
38+
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
39+
return (
2240
<AvatarPrimitive.Fallback
23-
ref={ref}
24-
className={cn('flex h-full w-full items-center justify-center rounded-full bg-sidebar-primary text-sidebar-primary-foreground', className)}
25-
{...props}
41+
data-slot="avatar-fallback"
42+
className={cn(
43+
"bg-muted flex size-full items-center justify-center rounded-full",
44+
className
45+
)}
46+
{...props}
2647
/>
27-
));
28-
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
48+
)
49+
}
2950

30-
export { Avatar, AvatarFallback, AvatarImage };
51+
export { Avatar, AvatarImage, AvatarFallback }

0 commit comments

Comments
 (0)