Skip to content

Commit 11987f8

Browse files
authored
Update to shadcn/[email protected]
2 parents 4f6d67f + 1d44fbd commit 11987f8

File tree

7 files changed

+108
-83
lines changed

7 files changed

+108
-83
lines changed

README.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Turborepo starter with shadcn/ui
1+
# Turborepo starter with shadcn/ui#
2+
3+
![Static Badge](https://img.shields.io/badge/shadcn%2Fui-0.2.1-blue?link=https%3A%2F%2Fgithub.com%2Fshadcn%2Fui%2Freleases%2Ftag%2Fshadcn-ui%25400.2.1)
24

35
This is Turborepo starter with shadcn/ui pre-configured.
46

@@ -23,10 +25,13 @@ pnpm install
2325
### Add ui components
2426

2527
Use the pre-made script:
26-
27-
```sh
28-
pnpm ui:add <component-name>
29-
```
28+
29+
```sh
30+
pnpm ui:add <component-name>
31+
```
32+
33+
> **Warning**
34+
> With the new version of `shadcn/ui` the path of the installed component cannot be changed. You need to move the file manually to the component folder (from `components/ui`).
3035
3136
> This works just like the add command in the `shadcn/ui` CLI.
3237

packages/ui/components.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "default",
4+
"rsc": true,
5+
"tailwind": {
6+
"config": "tailwind.config.js",
7+
"css": "styles/globals.css",
8+
"baseColor": "slate",
9+
"cssVariables": true
10+
},
11+
"aliases": {
12+
"components": "@/components",
13+
"utils": "@/lib/utils"
14+
}
15+
}

packages/ui/components/button.tsx

+32-24
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,56 @@
1-
import * as React from 'react';
2-
import { Slot } from '@radix-ui/react-slot';
3-
import { cva, type VariantProps } from 'class-variance-authority';
1+
import * as React from "react"
2+
import { Slot } from "@radix-ui/react-slot"
3+
import { cva, type VariantProps } from "class-variance-authority"
44

5-
import { cn } from '@/lib/utils';
5+
import { cn } from "@/lib/utils"
66

77
const buttonVariants = cva(
8-
'inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background',
8+
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
99
{
1010
variants: {
1111
variant: {
12-
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
13-
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
14-
outline: 'border border-input hover:bg-accent hover:text-accent-foreground',
15-
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
16-
ghost: 'hover:bg-accent hover:text-accent-foreground',
17-
link: 'underline-offset-4 hover:underline text-primary',
12+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
13+
destructive:
14+
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
15+
outline:
16+
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
17+
secondary:
18+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
19+
ghost: "hover:bg-accent hover:text-accent-foreground",
20+
link: "text-primary underline-offset-4 hover:underline",
1821
},
1922
size: {
20-
default: 'h-10 py-2 px-4',
21-
sm: 'h-9 px-3 rounded-md',
22-
lg: 'h-11 px-8 rounded-md',
23+
default: "h-10 px-4 py-2",
24+
sm: "h-9 rounded-md px-3",
25+
lg: "h-11 rounded-md px-8",
26+
icon: "h-10 w-10",
2327
},
2428
},
2529
defaultVariants: {
26-
variant: 'default',
27-
size: 'default',
30+
variant: "default",
31+
size: "default",
2832
},
2933
}
30-
);
34+
)
3135

3236
export interface ButtonProps
3337
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
3438
VariantProps<typeof buttonVariants> {
35-
asChild?: boolean;
39+
asChild?: boolean
3640
}
3741

3842
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
3943
({ className, variant, size, asChild = false, ...props }, ref) => {
40-
const Comp = asChild ? Slot : 'button';
44+
const Comp = asChild ? Slot : "button"
4145
return (
42-
<Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />
43-
);
46+
<Comp
47+
className={cn(buttonVariants({ variant, size, className }))}
48+
ref={ref}
49+
{...props}
50+
/>
51+
)
4452
}
45-
);
46-
Button.displayName = 'Button';
53+
)
54+
Button.displayName = "Button"
4755

48-
export { Button, buttonVariants };
56+
export { Button, buttonVariants }

packages/ui/lib/utils.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { ClassValue, clsx } from 'clsx';
2-
import { twMerge } from 'tailwind-merge';
3-
1+
import { type ClassValue, clsx } from "clsx"
2+
import { twMerge } from "tailwind-merge"
3+
44
export function cn(...inputs: ClassValue[]) {
5-
return twMerge(clsx(inputs));
5+
return twMerge(clsx(inputs))
66
}

packages/ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": "MIT",
77
"scripts": {
88
"lint": "eslint \"**/*.ts*\"",
9-
"ui:add": "pnpm dlx shadcn-ui add"
9+
"ui:add": "pnpm dlx shadcn-ui@0.2.1 add"
1010
},
1111
"devDependencies": {
1212
"@types/react": "^18.2.0",

packages/ui/styles/globals.css

+45-48
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,78 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4-
4+
55
@layer base {
66
:root {
77
--background: 0 0% 100%;
8-
--foreground: 222.2 47.4% 11.2%;
9-
8+
--foreground: 222.2 84% 4.9%;
9+
1010
--muted: 210 40% 96.1%;
1111
--muted-foreground: 215.4 16.3% 46.9%;
12-
12+
1313
--popover: 0 0% 100%;
14-
--popover-foreground: 222.2 47.4% 11.2%;
15-
14+
--popover-foreground: 222.2 84% 4.9%;
15+
1616
--card: 0 0% 100%;
17-
--card-foreground: 222.2 47.4% 11.2%;
18-
17+
--card-foreground: 222.2 84% 4.9%;
18+
1919
--border: 214.3 31.8% 91.4%;
2020
--input: 214.3 31.8% 91.4%;
21-
21+
2222
--primary: 222.2 47.4% 11.2%;
2323
--primary-foreground: 210 40% 98%;
24-
24+
2525
--secondary: 210 40% 96.1%;
2626
--secondary-foreground: 222.2 47.4% 11.2%;
27-
27+
2828
--accent: 210 40% 96.1%;
29-
--accent-foreground: 222.2 47.4% 11.2%;
30-
31-
--destructive: 0 100% 50%;
29+
--accent-foreground: ;
30+
31+
--destructive: 0 84.2% 60.2%;
3232
--destructive-foreground: 210 40% 98%;
33-
33+
3434
--ring: 215 20.2% 65.1%;
35-
35+
3636
--radius: 0.5rem;
3737
}
38-
38+
3939
.dark {
40-
--background: 224 71% 4%;
41-
--foreground: 213 31% 91%;
42-
43-
--muted: 223 47% 11%;
44-
--muted-foreground: 215.4 16.3% 56.9%;
45-
46-
--popover: 224 71% 4%;
47-
--popover-foreground: 215 20.2% 65.1%;
48-
49-
--card: 224 71% 4%;
50-
--card-foreground: 213 31% 91%;
51-
52-
--border: 216 34% 17%;
53-
--input: 216 34% 17%;
54-
40+
--background: 222.2 84% 4.9%;
41+
--foreground: 210 40% 98%;
42+
43+
--muted: 217.2 32.6% 17.5%;
44+
--muted-foreground: 215 20.2% 65.1%;
45+
46+
--popover: 222.2 84% 4.9%;
47+
--popover-foreground: 210 40% 98%;
48+
49+
--card: 222.2 84% 4.9%;
50+
--card-foreground: 210 40% 98%;
51+
52+
--border: 217.2 32.6% 17.5%;
53+
--input: 217.2 32.6% 17.5%;
54+
5555
--primary: 210 40% 98%;
56-
--primary-foreground: 222.2 47.4% 1.2%;
57-
58-
--secondary: 222.2 47.4% 11.2%;
56+
--primary-foreground: 222.2 47.4% 11.2%;
57+
58+
--secondary: 217.2 32.6% 17.5%;
5959
--secondary-foreground: 210 40% 98%;
60-
61-
--accent: 216 34% 17%;
62-
--accent-foreground: 210 40% 98%;
63-
64-
--destructive: 0 63% 31%;
65-
--destructive-foreground: 210 40% 98%;
66-
67-
--ring: 216 34% 17%;
68-
69-
--radius: 0.5rem;
60+
61+
--accent: 217.2 32.6% 17.5%;
62+
--accent-foreground: ;
63+
64+
--destructive: 0 62.8% 30.6%;
65+
--destructive-foreground: 0 85.7% 97.3%;
66+
67+
--ring: 217.2 32.6% 17.5%;
7068
}
7169
}
72-
70+
7371
@layer base {
7472
* {
7573
@apply border-border;
7674
}
7775
body {
7876
@apply bg-background text-foreground;
79-
font-feature-settings: 'rlig' 1, 'calt' 1;
8077
}
81-
}
78+
}

pnpm-lock.yaml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)