Skip to content

Commit 029f8f5

Browse files
committed
feat: upgraded shadcn/ui
1 parent e551f96 commit 029f8f5

File tree

9 files changed

+71
-141
lines changed

9 files changed

+71
-141
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ If you love this template and/or use it, please give it a star on GitHub. This w
3737

3838
## Motivation
3939

40-
As a developer who creates content, I want to have a digital garden where I can share my thoughts and ideas with the world. Now, there's not really a "perfect solution" for this currently. With included analytics, SEO, email subscribtions, modern tooling, simple design, etc. We either have to build one from scratch, use a design template and code the features, or use a CMS/no-code tool.
40+
As a developer who creates content, I want to have a digital garden where I can share my thoughts and ideas with the world. Now, there's not really a "perfect solution" for this currently. With included analytics, SEO, email subscriptions, modern tooling, simple design, etc. We either have to build one from scratch, use a design template and code the features, or use a CMS/no-code tool.
4141

4242
So I decided to build a solution that I would use myself. This is the result.
4343

app/globals.css

+23-26
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
@tailwind base;
2+
@tailwind components;
23

34
.footnotes {
4-
@apply mb-6 border-t border-gray-200 pt-2 text-sm text-muted-foreground dark:border-gray-700;
5+
@apply mb-6 border-t border-muted-foreground pt-2 text-sm text-muted-foreground;
56
}
67

7-
@tailwind components;
88
@tailwind utilities;
99

1010
@layer base {
1111
:root {
1212
--background: 0 0% 100%;
13-
--foreground: 222.2 47.4% 11.2%;
13+
--foreground: 222.2 84% 4.9%;
1414

1515
--muted: 210 40% 96.1%;
1616
--muted-foreground: 215.4 16.3% 46.9%;
1717

1818
--popover: 0 0% 100%;
19-
--popover-foreground: 222.2 47.4% 11.2%;
19+
--popover-foreground: 222.2 84% 4.9%;
2020

21-
--card: 0 0% 95%;
22-
--card-foreground: 222.2 47.4% 11.2%;
21+
--card: 0 0% 100%;
22+
--card-foreground: 222.2 84% 4.9%;
2323

2424
--border: 214.3 31.8% 91.4%;
2525
--input: 214.3 31.8% 91.4%;
@@ -33,7 +33,7 @@
3333
--accent: 210 40% 96.1%;
3434
--accent-foreground: 223 94% 66%;
3535

36-
--destructive: 0 100% 50%;
36+
--destructive: 0 84.2% 60.2%;
3737
--destructive-foreground: 210 40% 98%;
3838

3939
--ring: 215 20.2% 65.1%;
@@ -42,36 +42,34 @@
4242
}
4343

4444
.dark {
45-
--background: 224 71% 4%;
46-
--foreground: 213 31% 91%;
45+
--background: 222.2 84% 4.9%;
46+
--foreground: 210 40% 98%;
4747

48-
--muted: 223 47% 11%;
49-
--muted-foreground: 215.4 16.3% 56.9%;
48+
--muted: 217.2 32.6% 17.5%;
49+
--muted-foreground: 215 20.2% 65.1%;
5050

51-
--popover: 224 71% 4%;
52-
--popover-foreground: 215 20.2% 65.1%;
51+
--popover: 222.2 84% 4.9%;
52+
--popover-foreground: 210 40% 98%;
5353

54-
--card: 224 71% 4%;
55-
--card-foreground: 213 31% 91%;
54+
--card: 222.2 84% 4.9%;
55+
--card-foreground: 210 40% 98%;
5656

57-
--border: 216 34% 17%;
58-
--input: 216 34% 17%;
57+
--border: 217.2 32.6% 17.5%;
58+
--input: 217.2 32.6% 17.5%;
5959

6060
--primary: 210 40% 98%;
61-
--primary-foreground: 222.2 47.4% 1.2%;
61+
--primary-foreground: 222.2 47.4% 11.2%;
6262

63-
--secondary: 222.2 47.4% 11.2%;
63+
--secondary: 217.2 32.6% 17.5%;
6464
--secondary-foreground: 210 40% 98%;
6565

66-
--accent: 216 34% 17%;
66+
--accent: 217.2 32.6% 17.5%;
6767
--accent-foreground: 223 94% 66%;
6868

69-
--destructive: 0 63% 31%;
70-
--destructive-foreground: 210 40% 98%;
69+
--destructive: 0 62.8% 30.6%;
70+
--destructive-foreground: 0 85.7% 97.3%;
7171

72-
--ring: 216 34% 17%;
73-
74-
--radius: 0.5rem;
72+
--ring: 217.2 32.6% 17.5%;
7573
}
7674
}
7775

@@ -81,6 +79,5 @@
8179
}
8280
body {
8381
@apply bg-background text-foreground;
84-
font-feature-settings: "rlig" 1, "calt" 1;
8582
}
8683
}

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": "app/globals.css",
8+
"baseColor": "slate",
9+
"cssVariables": true
10+
},
11+
"aliases": {
12+
"components": "@/components",
13+
"utils": "@/lib/utils"
14+
}
15+
}

components/mobile-nav.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function MobileNav() {
2727
<span className="sr-only">Toggle Menu</span>
2828
</Button>
2929
</SheetTrigger>
30-
<SheetContent size="content" position="bottom" className="pr-0">
30+
<SheetContent side="bottom" className="pr-0">
3131
<MobileLink href="/" className="flex items-center" onOpenChange={setOpen} aria-label="Go to Home">
3232
<span className="font-bold">{siteMetadata.title.default}</span>
3333
</MobileLink>

components/ui/button.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const buttonVariants = cva(
2020
default: "h-10 py-2 px-4",
2121
sm: "h-9 px-3 rounded-md",
2222
lg: "h-11 px-8 rounded-md",
23+
icon: "h-10 w-10",
2324
},
2425
},
2526
defaultVariants: {

components/ui/sheet.tsx

+25-107
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,18 @@ const SheetTrigger = SheetPrimitive.Trigger;
1313

1414
const SheetClose = SheetPrimitive.Close;
1515

16-
const portalVariants = cva("fixed inset-0 z-50 flex", {
17-
variants: {
18-
position: {
19-
top: "items-start",
20-
bottom: "items-end",
21-
left: "justify-start",
22-
right: "justify-end",
23-
},
24-
},
25-
defaultVariants: { position: "right" },
26-
});
27-
28-
interface SheetPortalProps extends SheetPrimitive.DialogPortalProps, VariantProps<typeof portalVariants> {}
29-
30-
const SheetPortal = ({ position, className, children, ...props }: SheetPortalProps) => (
31-
<SheetPrimitive.Portal className={cn(className)} {...props}>
32-
<div className={portalVariants({ position })}>{children}</div>
33-
</SheetPrimitive.Portal>
16+
const SheetPortal = ({ className, ...props }: SheetPrimitive.DialogPortalProps) => (
17+
<SheetPrimitive.Portal className={cn(className)} {...props} />
3418
);
3519
SheetPortal.displayName = SheetPrimitive.Portal.displayName;
3620

3721
const SheetOverlay = React.forwardRef<
3822
React.ElementRef<typeof SheetPrimitive.Overlay>,
3923
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
40-
>(({ className, children, ...props }, ref) => (
24+
>(({ className, ...props }, ref) => (
4125
<SheetPrimitive.Overlay
4226
className={cn(
43-
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm transition-all duration-100 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in",
27+
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
4428
className
4529
)}
4630
{...props}
@@ -49,100 +33,34 @@ const SheetOverlay = React.forwardRef<
4933
));
5034
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
5135

52-
const sheetVariants = cva("fixed z-50 scale-100 gap-4 bg-background p-6 opacity-100 shadow-lg border", {
53-
variants: {
54-
position: {
55-
top: "animate-in slide-in-from-top w-full duration-300",
56-
bottom: "animate-in slide-in-from-bottom w-full duration-300",
57-
left: "animate-in slide-in-from-left h-full duration-300",
58-
right: "animate-in slide-in-from-right h-full duration-300",
59-
},
60-
size: {
61-
content: "",
62-
default: "",
63-
sm: "",
64-
lg: "",
65-
xl: "",
66-
full: "",
67-
},
68-
},
69-
compoundVariants: [
70-
{
71-
position: ["top", "bottom"],
72-
size: "content",
73-
class: "max-h-screen",
74-
},
75-
{
76-
position: ["top", "bottom"],
77-
size: "default",
78-
class: "h-1/3",
79-
},
80-
{
81-
position: ["top", "bottom"],
82-
size: "sm",
83-
class: "h-1/4",
84-
},
85-
{
86-
position: ["top", "bottom"],
87-
size: "lg",
88-
class: "h-1/2",
36+
const sheetVariants = cva(
37+
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
38+
{
39+
variants: {
40+
side: {
41+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
42+
bottom:
43+
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
44+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
45+
right:
46+
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
47+
},
8948
},
90-
{
91-
position: ["top", "bottom"],
92-
size: "xl",
93-
class: "h-5/6",
49+
defaultVariants: {
50+
side: "right",
9451
},
95-
{
96-
position: ["top", "bottom"],
97-
size: "full",
98-
class: "h-screen",
99-
},
100-
{
101-
position: ["right", "left"],
102-
size: "content",
103-
class: "max-w-screen",
104-
},
105-
{
106-
position: ["right", "left"],
107-
size: "default",
108-
class: "w-1/3",
109-
},
110-
{
111-
position: ["right", "left"],
112-
size: "sm",
113-
class: "w-1/4",
114-
},
115-
{
116-
position: ["right", "left"],
117-
size: "lg",
118-
class: "w-1/2",
119-
},
120-
{
121-
position: ["right", "left"],
122-
size: "xl",
123-
class: "w-5/6",
124-
},
125-
{
126-
position: ["right", "left"],
127-
size: "full",
128-
class: "w-screen",
129-
},
130-
],
131-
defaultVariants: {
132-
position: "right",
133-
size: "default",
134-
},
135-
});
52+
}
53+
);
13654

137-
export interface DialogContentProps
55+
interface SheetContentProps
13856
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
13957
VariantProps<typeof sheetVariants> {}
14058

141-
const SheetContent = React.forwardRef<React.ElementRef<typeof SheetPrimitive.Content>, DialogContentProps>(
142-
({ position, size, className, children, ...props }, ref) => (
143-
<SheetPortal position={position}>
59+
const SheetContent = React.forwardRef<React.ElementRef<typeof SheetPrimitive.Content>, SheetContentProps>(
60+
({ side = "right", className, children, ...props }, ref) => (
61+
<SheetPortal>
14462
<SheetOverlay />
145-
<SheetPrimitive.Content ref={ref} className={cn(sheetVariants({ position, size }), className)} {...props}>
63+
<SheetPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
14664
{children}
14765
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
14866
<X className="h-4 w-4" />

content/posts/test.mdx

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ If you love this template and/or use it, please give it a star on GitHub. This w
2323

2424
![GitHub Repo stars](https://img.shields.io/github/stars/thedevdavid/digital-garden?style=social)
2525

26-
**Note: This project is always evolving and it's far from being perfect or even done.** I'm always open to suggestions and contributions. Feel free to open an issue or a PR if you have any ideas or suggestions. You can also see the [roadmap](#features--roadmap) for planned features if you want to contribute.
26+
**Note: This project is always evolving and it's far from being perfect or even done.**[^1] I'm always open to suggestions and contributions. Feel free to open an issue or a PR if you have any ideas or suggestions. You can also see the [roadmap](#features--roadmap) for planned features if you want to contribute.
27+
[^1]: Big note.
2728

2829
```hello.js
2930
let hello = "hello darkness";
@@ -33,9 +34,7 @@ console.log(hello, "my old friend");
3334

3435
## Motivation
3536

36-
As a developer who creates content, I want to have a digital garden where I can share my thoughts and ideas with the world. Now, there's not really a "perfect solution" for this currently. With included analytics, SEO, email subscribtions, modern tooling, simple design, etc. We either have to build one from scratch, use a design template and code the features, or use a CMS/no-code tool.
37-
38-
So I decided to build a solution that I would use myself. This is the result.
37+
As a developer who creates content, I want to have a digital garden where I can share my thoughts and ideas with the world. Now, there's not really a "perfect solution" for this currently. With included analytics, SEO, email subscriptions, modern tooling, simple design, etc. We either have to build one from scratch, use a design template and code the features, or use a CMS/no-code tool.
3938

4039
## Getting Started
4140

lib/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ClassValue, clsx } from "clsx";
1+
import { clsx, type ClassValue } from "clsx";
22
import { twMerge } from "tailwind-merge";
33

44
export function cn(...inputs: ClassValue[]) {

tailwind.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { fontFamily } = require("tailwindcss/defaultTheme");
33
/** @type {import('tailwindcss').Config} */
44
module.exports = {
55
darkMode: ["class"],
6-
content: ["./pages/**/*.{ts,tsx}", "./components/**/*.{ts,tsx}", "./app/**/*.{ts,tsx}"],
6+
content: ["./pages/**/*.{ts,tsx}", "./components/**/*.{ts,tsx}", "./app/**/*.{ts,tsx}", "./src/**/*.{ts,tsx}"],
77
theme: {
88
container: {
99
center: true,

0 commit comments

Comments
 (0)