Skip to content

Commit 1a5a98c

Browse files
feat: initialize shadCN setup
1 parent 6d486b7 commit 1a5a98c

37 files changed

+3165
-77
lines changed

.prettierrc

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
"semi": false,
44
"singleQuote": false,
55
"tabWidth": 2,
6-
"trailingComma": "es5"
7-
}
6+
"trailingComma": "es5",
7+
"plugins": [
8+
"prettier-plugin-tailwindcss"
9+
]
10+
}

components.json

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

package.json

+36-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,33 @@
3232
"@docsearch/react": "^3.5.2",
3333
"@emotion/react": "^11.11.1",
3434
"@emotion/styled": "^11.11.0",
35-
"@radix-ui/react-navigation-menu": "^1.1.4",
35+
"@hookform/resolvers": "^3.8.0",
36+
"@radix-ui/react-accordion": "^1.2.0",
37+
"@radix-ui/react-alert-dialog": "^1.1.1",
38+
"@radix-ui/react-avatar": "^1.1.0",
39+
"@radix-ui/react-checkbox": "^1.1.1",
40+
"@radix-ui/react-dialog": "^1.1.1",
41+
"@radix-ui/react-hover-card": "^1.1.1",
42+
"@radix-ui/react-icons": "^1.3.0",
43+
"@radix-ui/react-label": "^2.1.0",
44+
"@radix-ui/react-navigation-menu": "^1.2.0",
45+
"@radix-ui/react-popover": "^1.1.1",
46+
"@radix-ui/react-progress": "^1.1.0",
47+
"@radix-ui/react-radio-group": "^1.2.0",
48+
"@radix-ui/react-scroll-area": "^1.1.0",
49+
"@radix-ui/react-select": "^2.1.1",
50+
"@radix-ui/react-separator": "^1.1.0",
51+
"@radix-ui/react-slider": "^1.2.0",
52+
"@radix-ui/react-slot": "^1.1.0",
53+
"@radix-ui/react-switch": "^1.1.0",
54+
"@radix-ui/react-tabs": "^1.1.0",
55+
"@radix-ui/react-tooltip": "^1.1.2",
3656
"@socialgouv/matomo-next": "^1.8.0",
3757
"chart.js": "^4.4.2",
3858
"chartjs-plugin-datalabels": "^2.2.0",
39-
"embla-carousel-react": "^7.0.0",
59+
"class-variance-authority": "^0.7.0",
60+
"clsx": "^2.1.1",
61+
"embla-carousel-react": "^8.1.6",
4062
"ethereum-blockies-base64": "^1.0.2",
4163
"framer-motion": "^10.13.0",
4264
"gray-matter": "^4.0.3",
@@ -45,6 +67,7 @@
4567
"lodash.merge": "^4.6.2",
4668
"lodash.shuffle": "^4.2.0",
4769
"lodash.union": "^4.6.0",
70+
"lucide-react": "^0.400.0",
4871
"next": "^14.2.3",
4972
"next-i18next": "^14.0.3",
5073
"next-mdx-remote": "^3.0.8",
@@ -55,13 +78,17 @@
5578
"react-chartjs-2": "^5.2.0",
5679
"react-dom": "^18.2.0",
5780
"react-emoji-render": "^2.0.1",
81+
"react-hook-form": "^7.52.1",
5882
"react-i18next": "^13.3.1",
5983
"react-icons": "^4.10.1",
6084
"react-lite-youtube-embed": "^2.4.0",
6185
"react-select": "5.8.0",
6286
"reading-time": "^1.5.0",
6387
"remark-gfm": "^3.0.1",
64-
"yaml-loader": "^0.8.0"
88+
"tailwind-merge": "^2.3.0",
89+
"tailwindcss-animate": "^1.0.7",
90+
"yaml-loader": "^0.8.0",
91+
"zod": "^3.23.8"
6592
},
6693
"devDependencies": {
6794
"@chakra-ui/cli": "^2.4.1",
@@ -81,24 +108,28 @@
81108
"@types/react-dom": "18.2.19",
82109
"@typescript-eslint/eslint-plugin": "^6.19.0",
83110
"@typescript-eslint/parser": "^6.19.0",
111+
"autoprefixer": "^10.4.19",
84112
"chromatic": "10.9.6",
85113
"decompress": "^4.2.1",
86114
"eslint": "^8.45.0",
87115
"eslint-config-next": "^14.2.2",
88116
"eslint-config-prettier": "^9.0.0",
89117
"eslint-plugin-simple-import-sort": "^10.0.0",
118+
"eslint-plugin-storybook": "0.8.0",
90119
"eslint-plugin-unused-imports": "^3.0.0",
91120
"husky": "^9.0.11",
92-
"eslint-plugin-storybook": "0.8.0",
93121
"image-size": "^1.0.2",
94122
"lint-staged": "^15.2.5",
95123
"mdast-util-toc": "^7.0.0",
96124
"minimist": "^1.2.8",
97125
"plaiceholder": "^3.0.0",
98126
"polished": "^4.2.2",
127+
"postcss": "^8.4.39",
128+
"prettier-plugin-tailwindcss": "^0.6.5",
99129
"raw-loader": "^4.0.2",
100130
"storybook": "8.1.10",
101131
"storybook-react-i18next": "3.1.1",
132+
"tailwindcss": "^3.4.4",
102133
"ts-node": "^10.9.1",
103134
"tsconfig-paths-webpack-plugin": "4.1.0",
104135
"typescript": "^5.5.2",
@@ -109,4 +140,4 @@
109140
"jackspeak": "2.1.1",
110141
"sharp": "0.32.6"
111142
}
112-
}
143+
}

postcss.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}

src/components/ui/accordion.tsx

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import { ChevronDown } from "lucide-react"
5+
import * as AccordionPrimitive from "@radix-ui/react-accordion"
6+
7+
import { cn } from "@/lib/utils/cn"
8+
9+
const Accordion = AccordionPrimitive.Root
10+
11+
const AccordionItem = React.forwardRef<
12+
React.ElementRef<typeof AccordionPrimitive.Item>,
13+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
14+
>(({ className, ...props }, ref) => (
15+
<AccordionPrimitive.Item
16+
ref={ref}
17+
className={cn("eth-border-b", className)}
18+
{...props}
19+
/>
20+
))
21+
AccordionItem.displayName = "AccordionItem"
22+
23+
const AccordionTrigger = React.forwardRef<
24+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
25+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
26+
>(({ className, children, ...props }, ref) => (
27+
<AccordionPrimitive.Header className="eth-flex">
28+
<AccordionPrimitive.Trigger
29+
ref={ref}
30+
className={cn(
31+
"eth-flex eth-flex-1 eth-items-center eth-justify-between eth-py-4 eth-font-medium eth-transition-all hover:eth-underline [&[data-state=open]>svg]:eth-rotate-180",
32+
className
33+
)}
34+
{...props}
35+
>
36+
{children}
37+
<ChevronDown className="eth-h-4 eth-w-4 eth-shrink-0 eth-transition-transform eth-duration-200" />
38+
</AccordionPrimitive.Trigger>
39+
</AccordionPrimitive.Header>
40+
))
41+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
42+
43+
const AccordionContent = React.forwardRef<
44+
React.ElementRef<typeof AccordionPrimitive.Content>,
45+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
46+
>(({ className, children, ...props }, ref) => (
47+
<AccordionPrimitive.Content
48+
ref={ref}
49+
className="eth-overflow-hidden eth-text-sm eth-transition-all data-[state=closed]:eth-animate-accordion-up data-[state=open]:eth-animate-accordion-down"
50+
{...props}
51+
>
52+
<div className={cn("eth-pb-4 eth-pt-0", className)}>{children}</div>
53+
</AccordionPrimitive.Content>
54+
))
55+
56+
AccordionContent.displayName = AccordionPrimitive.Content.displayName
57+
58+
export { Accordion, AccordionContent,AccordionItem, AccordionTrigger }

src/components/ui/alert-dialog.tsx

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
5+
6+
import { buttonVariants } from "@/components/ui/button"
7+
8+
import { cn } from "@/lib/utils/cn"
9+
10+
const AlertDialog = AlertDialogPrimitive.Root
11+
12+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
13+
14+
const AlertDialogPortal = AlertDialogPrimitive.Portal
15+
16+
const AlertDialogOverlay = React.forwardRef<
17+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
18+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
19+
>(({ className, ...props }, ref) => (
20+
<AlertDialogPrimitive.Overlay
21+
className={cn(
22+
"eth-fixed eth-inset-0 eth-z-50 eth-bg-black/80 eth- data-[state=open]:eth-animate-in data-[state=closed]:eth-animate-out data-[state=closed]:eth-fade-out-0 data-[state=open]:eth-fade-in-0",
23+
className
24+
)}
25+
{...props}
26+
ref={ref}
27+
/>
28+
))
29+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
30+
31+
const AlertDialogContent = React.forwardRef<
32+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
33+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
34+
>(({ className, ...props }, ref) => (
35+
<AlertDialogPortal>
36+
<AlertDialogOverlay />
37+
<AlertDialogPrimitive.Content
38+
ref={ref}
39+
className={cn(
40+
"eth-fixed eth-left-[50%] eth-top-[50%] eth-z-50 eth-grid eth-w-full eth-max-w-lg eth-translate-x-[-50%] eth-translate-y-[-50%] eth-gap-4 eth-border eth-bg-background eth-p-6 eth-shadow-lg eth-duration-200 data-[state=open]:eth-animate-in data-[state=closed]:eth-animate-out data-[state=closed]:eth-fade-out-0 data-[state=open]:eth-fade-in-0 data-[state=closed]:eth-zoom-out-95 data-[state=open]:eth-zoom-in-95 data-[state=closed]:eth-slide-out-to-left-1/2 data-[state=closed]:eth-slide-out-to-top-[48%] data-[state=open]:eth-slide-in-from-left-1/2 data-[state=open]:eth-slide-in-from-top-[48%] sm:eth-rounded-lg",
41+
className
42+
)}
43+
{...props}
44+
/>
45+
</AlertDialogPortal>
46+
))
47+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
48+
49+
const AlertDialogHeader = ({
50+
className,
51+
...props
52+
}: React.HTMLAttributes<HTMLDivElement>) => (
53+
<div
54+
className={cn(
55+
"eth-flex eth-flex-col eth-space-y-2 eth-text-center sm:eth-text-left",
56+
className
57+
)}
58+
{...props}
59+
/>
60+
)
61+
AlertDialogHeader.displayName = "AlertDialogHeader"
62+
63+
const AlertDialogFooter = ({
64+
className,
65+
...props
66+
}: React.HTMLAttributes<HTMLDivElement>) => (
67+
<div
68+
className={cn(
69+
"eth-flex eth-flex-col-reverse sm:eth-flex-row sm:eth-justify-end sm:eth-space-x-2",
70+
className
71+
)}
72+
{...props}
73+
/>
74+
)
75+
AlertDialogFooter.displayName = "AlertDialogFooter"
76+
77+
const AlertDialogTitle = React.forwardRef<
78+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
79+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
80+
>(({ className, ...props }, ref) => (
81+
<AlertDialogPrimitive.Title
82+
ref={ref}
83+
className={cn("eth-text-lg eth-font-semibold", className)}
84+
{...props}
85+
/>
86+
))
87+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
88+
89+
const AlertDialogDescription = React.forwardRef<
90+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
91+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
92+
>(({ className, ...props }, ref) => (
93+
<AlertDialogPrimitive.Description
94+
ref={ref}
95+
className={cn("eth-text-sm eth-text-muted-foreground", className)}
96+
{...props}
97+
/>
98+
))
99+
AlertDialogDescription.displayName =
100+
AlertDialogPrimitive.Description.displayName
101+
102+
const AlertDialogAction = React.forwardRef<
103+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
104+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
105+
>(({ className, ...props }, ref) => (
106+
<AlertDialogPrimitive.Action
107+
ref={ref}
108+
className={cn(buttonVariants(), className)}
109+
{...props}
110+
/>
111+
))
112+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
113+
114+
const AlertDialogCancel = React.forwardRef<
115+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
116+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
117+
>(({ className, ...props }, ref) => (
118+
<AlertDialogPrimitive.Cancel
119+
ref={ref}
120+
className={cn(
121+
buttonVariants({ variant: "outline" }),
122+
"eth-mt-2 sm:eth-mt-0",
123+
className
124+
)}
125+
{...props}
126+
/>
127+
))
128+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
129+
130+
export {
131+
AlertDialog,
132+
AlertDialogAction,
133+
AlertDialogCancel,
134+
AlertDialogContent,
135+
AlertDialogDescription,
136+
AlertDialogFooter,
137+
AlertDialogHeader,
138+
AlertDialogOverlay,
139+
AlertDialogPortal,
140+
AlertDialogTitle,
141+
AlertDialogTrigger,
142+
}

src/components/ui/alert.tsx

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import * as React from "react"
2+
import { cva, type VariantProps } from "class-variance-authority"
3+
4+
import { cn } from "@/lib/utils/cn"
5+
6+
const alertVariants = cva(
7+
"eth-relative eth-w-full eth-rounded-lg eth-border eth-p-4 [&>svg~*]:eth-pl-7 [&>svg+div]:eth-translate-y-[-3px] [&>svg]:eth-absolute [&>svg]:eth-left-4 [&>svg]:eth-top-4 [&>svg]:eth-text-foreground",
8+
{
9+
variants: {
10+
variant: {
11+
default: "eth-bg-background eth-text-foreground",
12+
destructive:
13+
"eth-border-destructive/50 eth-text-destructive dark:eth-border-destructive [&>svg]:eth-text-destructive",
14+
},
15+
},
16+
defaultVariants: {
17+
variant: "default",
18+
},
19+
}
20+
)
21+
22+
const Alert = React.forwardRef<
23+
HTMLDivElement,
24+
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
25+
>(({ className, variant, ...props }, ref) => (
26+
<div
27+
ref={ref}
28+
role="alert"
29+
className={cn(alertVariants({ variant }), className)}
30+
{...props}
31+
/>
32+
))
33+
Alert.displayName = "Alert"
34+
35+
const AlertTitle = React.forwardRef<
36+
HTMLParagraphElement,
37+
React.HTMLAttributes<HTMLHeadingElement>
38+
>(({ className, ...props }, ref) => (
39+
<h5
40+
ref={ref}
41+
className={cn("eth-mb-1 eth-font-medium eth-leading-none eth-tracking-tight", className)}
42+
{...props}
43+
/>
44+
))
45+
AlertTitle.displayName = "AlertTitle"
46+
47+
const AlertDescription = React.forwardRef<
48+
HTMLParagraphElement,
49+
React.HTMLAttributes<HTMLParagraphElement>
50+
>(({ className, ...props }, ref) => (
51+
<div
52+
ref={ref}
53+
className={cn("eth-text-sm [&_p]:eth-leading-relaxed", className)}
54+
{...props}
55+
/>
56+
))
57+
AlertDescription.displayName = "AlertDescription"
58+
59+
export { Alert, AlertDescription,AlertTitle }

0 commit comments

Comments
 (0)