ikramhussainsiyam-create-my-project 1.0.1 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/cli.js +17 -4
- package/package.json +1 -1
- package/templates/NextJS/JavaScript/.eslintrc.json +3 -0
- package/templates/NextJS/JavaScript/README.md +36 -0
- package/templates/NextJS/JavaScript/gitignore-template +38 -0
- package/templates/NextJS/JavaScript/jsconfig.json +7 -0
- package/templates/NextJS/JavaScript/next.config.mjs +4 -0
- package/templates/{ViteJS/TypeScript → NextJS/JavaScript}/package-lock.json +3099 -2165
- package/templates/NextJS/JavaScript/package.json +30 -0
- package/templates/NextJS/JavaScript/postcss.config.mjs +8 -0
- package/templates/NextJS/JavaScript/src/app/favicon.ico +0 -0
- package/templates/{ViteJS/TypeScript/src/index.css → NextJS/JavaScript/src/app/globals.css} +7 -2
- package/templates/NextJS/JavaScript/src/app/layout.jsx +26 -0
- package/templates/NextJS/JavaScript/src/app/page.jsx +3 -0
- package/templates/NextJS/JavaScript/src/components/Navlink.jsx +28 -0
- package/templates/NextJS/JavaScript/src/components/ToastContainer.jsx +84 -0
- package/templates/NextJS/JavaScript/src/components/ui/Alert.jsx +48 -0
- package/templates/NextJS/JavaScript/src/components/ui/Button.jsx +58 -0
- package/templates/NextJS/JavaScript/src/components/ui/Skeleton.jsx +14 -0
- package/templates/NextJS/JavaScript/src/lib/utils.js +24 -0
- package/templates/NextJS/JavaScript/tailwind.config.js +20 -0
- package/templates/ViteJS/JavaScript/README.md +3 -0
- package/templates/ViteJS/JavaScript/eslint.config.js +1 -4
- package/templates/ViteJS/JavaScript/gitignore-template +1 -0
- package/templates/ViteJS/JavaScript/package.json +7 -2
- package/templates/ViteJS/JavaScript/src/index.css +15 -1
- package/templates/ViteJS/JavaScript/src/lib/utils.js +10 -0
- package/templates/ViteJS/JavaScript/tailwind.config.js +8 -3
- package/templates/ViteJS/JavaScript/src/components/Button.jsx +0 -5
- package/templates/ViteJS/TypeScript/README.md +0 -50
- package/templates/ViteJS/TypeScript/eslint.config.js +0 -35
- package/templates/ViteJS/TypeScript/gitignore-template +0 -24
- package/templates/ViteJS/TypeScript/index.html +0 -13
- package/templates/ViteJS/TypeScript/package.json +0 -33
- package/templates/ViteJS/TypeScript/postcss.config.js +0 -6
- package/templates/ViteJS/TypeScript/public/vite.svg +0 -1
- package/templates/ViteJS/TypeScript/src/App.tsx +0 -5
- package/templates/ViteJS/TypeScript/src/components/Button.tsx +0 -3
- package/templates/ViteJS/TypeScript/src/main.tsx +0 -10
- package/templates/ViteJS/TypeScript/src/vite-env.d.ts +0 -1
- package/templates/ViteJS/TypeScript/tailwind.config.js +0 -13
- package/templates/ViteJS/TypeScript/tsconfig.app.json +0 -25
- package/templates/ViteJS/TypeScript/tsconfig.json +0 -7
- package/templates/ViteJS/TypeScript/tsconfig.node.json +0 -23
- package/templates/ViteJS/TypeScript/vite.config.ts +0 -7
@@ -0,0 +1,30 @@
|
|
1
|
+
{
|
2
|
+
"name": "module-7-introduction-to-nextjs",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"private": true,
|
5
|
+
"scripts": {
|
6
|
+
"dev": "next dev",
|
7
|
+
"build": "next build",
|
8
|
+
"start": "next start",
|
9
|
+
"lint": "next lint"
|
10
|
+
},
|
11
|
+
"dependencies": {
|
12
|
+
"@tailwindcss/aspect-ratio": "^0.4.2",
|
13
|
+
"@tailwindcss/forms": "^0.5.9",
|
14
|
+
"clsx": "^2.1.1",
|
15
|
+
"next": "14.2.18",
|
16
|
+
"react": "^18",
|
17
|
+
"react-dom": "^18",
|
18
|
+
"react-hook-form": "^7.53.2",
|
19
|
+
"react-icons": "^5.3.0",
|
20
|
+
"sonner": "^1.7.0",
|
21
|
+
"tailwind-merge": "^2.5.4",
|
22
|
+
"use-immer": "^0.10.0"
|
23
|
+
},
|
24
|
+
"devDependencies": {
|
25
|
+
"eslint": "^8",
|
26
|
+
"eslint-config-next": "14.2.18",
|
27
|
+
"postcss": "^8",
|
28
|
+
"tailwindcss": "^3.4.1"
|
29
|
+
}
|
30
|
+
}
|
Binary file
|
@@ -4,9 +4,8 @@
|
|
4
4
|
|
5
5
|
@layer base {
|
6
6
|
body {
|
7
|
-
@apply
|
7
|
+
@apply antialiased bg-white font-sans;
|
8
8
|
}
|
9
|
-
|
10
9
|
/* scroll bar styling */
|
11
10
|
::-webkit-scrollbar {
|
12
11
|
width: 12px;
|
@@ -22,4 +21,10 @@
|
|
22
21
|
.btn {
|
23
22
|
@apply px-2 py-1 border rounded hover:bg-zinc-100 active:bg-white active:scale-95;
|
24
23
|
}
|
24
|
+
.container {
|
25
|
+
@apply px-4;
|
26
|
+
}
|
27
|
+
.input {
|
28
|
+
@apply px-3 py-2 border rounded;
|
29
|
+
}
|
25
30
|
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import ToastContainer from "@/components/ToastContainer";
|
2
|
+
import { Inter } from "next/font/google";
|
3
|
+
import "./globals.css";
|
4
|
+
|
5
|
+
const fontSans = Inter({
|
6
|
+
subsets: ["latin"],
|
7
|
+
variable: "--font-sans",
|
8
|
+
display: "swap",
|
9
|
+
});
|
10
|
+
|
11
|
+
export const metadata = {
|
12
|
+
title: "Project Title",
|
13
|
+
description: "Project Description",
|
14
|
+
};
|
15
|
+
|
16
|
+
export default function RootLayout({ children }) {
|
17
|
+
return (
|
18
|
+
<html lang="en">
|
19
|
+
<body className={fontSans.variable}>
|
20
|
+
<main>{children}</main>
|
21
|
+
|
22
|
+
<ToastContainer />
|
23
|
+
</body>
|
24
|
+
</html>
|
25
|
+
);
|
26
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use client";
|
2
|
+
import Link from "next/link";
|
3
|
+
import { usePathname } from "next/navigation";
|
4
|
+
import { forwardRef } from "react";
|
5
|
+
|
6
|
+
function Navlink({ href, className, children, ...props }, ref) {
|
7
|
+
const pathname = usePathname();
|
8
|
+
const isActive = href === pathname;
|
9
|
+
|
10
|
+
return (
|
11
|
+
<Link
|
12
|
+
href={href}
|
13
|
+
{...props}
|
14
|
+
className={
|
15
|
+
isActive && className
|
16
|
+
? `underline ${className}`
|
17
|
+
: isActive
|
18
|
+
? "underline"
|
19
|
+
: className
|
20
|
+
}
|
21
|
+
ref={ref}
|
22
|
+
>
|
23
|
+
{children}
|
24
|
+
</Link>
|
25
|
+
);
|
26
|
+
}
|
27
|
+
|
28
|
+
export default forwardRef(Navlink);
|
@@ -0,0 +1,84 @@
|
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
import {
|
4
|
+
FaCircleCheck,
|
5
|
+
FaCircleExclamation,
|
6
|
+
FaCircleInfo,
|
7
|
+
FaCircleXmark,
|
8
|
+
} from "react-icons/fa6";
|
9
|
+
import { LiaSpinnerSolid } from "react-icons/lia";
|
10
|
+
import { Toaster } from "sonner";
|
11
|
+
|
12
|
+
const ToastContainer = ({ type = "iconic", ...props }) => {
|
13
|
+
const icons = () => {
|
14
|
+
switch (type) {
|
15
|
+
case "neutral":
|
16
|
+
return {
|
17
|
+
success: <FaCircleCheck className="text-xl" />,
|
18
|
+
error: <FaCircleXmark className="text-xl" />,
|
19
|
+
info: <FaCircleInfo className="text-xl" />,
|
20
|
+
warning: <FaCircleExclamation className="text-xl" />,
|
21
|
+
loading: <LiaSpinnerSolid className="text-2xl animate-spin" />,
|
22
|
+
};
|
23
|
+
|
24
|
+
case "iconic":
|
25
|
+
return {
|
26
|
+
success: <FaCircleCheck className="text-xl text-lime-500" />,
|
27
|
+
error: <FaCircleXmark className="text-xl text-rose-500" />,
|
28
|
+
info: <FaCircleInfo className="text-xl text-sky-500" />,
|
29
|
+
warning: <FaCircleExclamation className="text-xl text-amber-500" />,
|
30
|
+
loading: <LiaSpinnerSolid className="text-2xl animate-spin" />,
|
31
|
+
};
|
32
|
+
|
33
|
+
case "colored":
|
34
|
+
return {
|
35
|
+
success: <FaCircleCheck className="text-xl text-lime-700" />,
|
36
|
+
error: <FaCircleXmark className="text-xl text-rose-700" />,
|
37
|
+
info: <FaCircleInfo className="text-xl text-sky-700" />,
|
38
|
+
warning: <FaCircleExclamation className="text-xl text-amber-700" />,
|
39
|
+
loading: <LiaSpinnerSolid className="text-2xl animate-spin" />,
|
40
|
+
};
|
41
|
+
}
|
42
|
+
};
|
43
|
+
|
44
|
+
return (
|
45
|
+
<Toaster
|
46
|
+
{...props}
|
47
|
+
toastOptions={{
|
48
|
+
classNames: {
|
49
|
+
toast: `group toast bg-background text-foreground font-sans gap-3 items-start ${
|
50
|
+
type === "colored" ? "shadow-lg" : ""
|
51
|
+
}`,
|
52
|
+
title: "text-base font-semibold",
|
53
|
+
description: `text-sm ${
|
54
|
+
type === "colored" ? "" : "text-muted-foreground"
|
55
|
+
}`,
|
56
|
+
icon: "text-center text-foreground mt-[4.3px]",
|
57
|
+
success:
|
58
|
+
type === "colored"
|
59
|
+
? "bg-lime-200 text-lime-700 shadow-lime-600/20 border-transparent"
|
60
|
+
: "",
|
61
|
+
error:
|
62
|
+
type === "colored"
|
63
|
+
? "bg-rose-200 text-rose-700 shadow-rose-600/20 border-transparent"
|
64
|
+
: "",
|
65
|
+
info:
|
66
|
+
type === "colored"
|
67
|
+
? "bg-sky-200 text-sky-700 shadow-sky-600/20 border-transparent"
|
68
|
+
: "",
|
69
|
+
warning:
|
70
|
+
type === "colored"
|
71
|
+
? "bg-amber-200 text-amber-700 shadow-amber-600/20 border-transparent"
|
72
|
+
: "",
|
73
|
+
actionButton:
|
74
|
+
"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
75
|
+
cancelButton:
|
76
|
+
"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
|
77
|
+
},
|
78
|
+
}}
|
79
|
+
icons={icons()}
|
80
|
+
/>
|
81
|
+
);
|
82
|
+
};
|
83
|
+
|
84
|
+
export default ToastContainer;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { cn } from "@/lib/utils";
|
2
|
+
|
3
|
+
export default function Alert({ type, title, description, className }) {
|
4
|
+
return (
|
5
|
+
<div
|
6
|
+
className={cn(
|
7
|
+
`flex p-4 gap-3 text-sm rounded-lg border border-transparent ${alertType(
|
8
|
+
type
|
9
|
+
)}`,
|
10
|
+
className
|
11
|
+
)}
|
12
|
+
role="alert"
|
13
|
+
>
|
14
|
+
<svg
|
15
|
+
className={"w-4 h-4 mt-0.5"}
|
16
|
+
aria-hidden="true"
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
18
|
+
fill="currentColor"
|
19
|
+
viewBox="0 0 20 20"
|
20
|
+
>
|
21
|
+
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
|
22
|
+
</svg>
|
23
|
+
<span className="sr-only">Danger</span>
|
24
|
+
<div className="space-y-0.5">
|
25
|
+
<div>
|
26
|
+
<span className="font-semibold capitalize">{type || "Alert"}</span>:{" "}
|
27
|
+
{title}
|
28
|
+
</div>
|
29
|
+
<div>{description}</div>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
);
|
33
|
+
}
|
34
|
+
|
35
|
+
function alertType(type) {
|
36
|
+
switch (type) {
|
37
|
+
case "success":
|
38
|
+
return "text-lime-800 bg-lime-100 border-lime-300";
|
39
|
+
case "warning":
|
40
|
+
return "text-amber-800 bg-amber-100 border-amber-300";
|
41
|
+
case "error":
|
42
|
+
return "text-rose-800 bg-rose-100 border-rose-300";
|
43
|
+
case "info":
|
44
|
+
return "text-sky-800 bg-sky-100 border-sky-300";
|
45
|
+
default:
|
46
|
+
return "text-gray-800 bg-gray-100 border-gray-300";
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { cn } from "@/lib/utils";
|
2
|
+
|
3
|
+
export default function Button({
|
4
|
+
size = "md",
|
5
|
+
color = "blue",
|
6
|
+
rounded = "lg",
|
7
|
+
children,
|
8
|
+
onClick,
|
9
|
+
className,
|
10
|
+
...props
|
11
|
+
}) {
|
12
|
+
return (
|
13
|
+
<button
|
14
|
+
{...props}
|
15
|
+
onClick={onClick}
|
16
|
+
className={cn(
|
17
|
+
`focus:ring-4 text-center font-medium focus:outline-none border border-transparent flex items-center gap-2.5 active:scale-[.97] transition duration-100 ${buttonStyles.color[color]} ${buttonStyles.size[size]} ${buttonStyles.rounded[rounded]}`,
|
18
|
+
className
|
19
|
+
)}
|
20
|
+
>
|
21
|
+
{children}
|
22
|
+
</button>
|
23
|
+
);
|
24
|
+
}
|
25
|
+
|
26
|
+
const buttonStyles = {
|
27
|
+
color: {
|
28
|
+
blue: "text-white bg-blue-700 hover:bg-blue-800 focus:ring-blue-300",
|
29
|
+
dark: "text-white bg-zinc-800 hover:bg-zinc-900 focus:ring-zinc-300",
|
30
|
+
outline:
|
31
|
+
"text-zinc-900 bg-white border-zinc-300 hover:bg-zinc-100 focus:ring-zinc-100",
|
32
|
+
ghost:
|
33
|
+
"text-zinc-900 bg-zinc-100 hover:bg-zinc-200/70 active:bg-zinc-100 focus:ring-zinc-100",
|
34
|
+
green: "text-white bg-green-700 hover:bg-green-800 focus:ring-green-300",
|
35
|
+
red: "text-white bg-red-700 hover:bg-red-800 focus:ring-red-300",
|
36
|
+
indigo:
|
37
|
+
"text-white bg-indigo-700 hover:bg-indigo-800 focus:ring-indigo-300",
|
38
|
+
amber: "text-white bg-amber-400 hover:bg-amber-500 focus:ring-amber-300",
|
39
|
+
"gradient-lime":
|
40
|
+
"text-zinc-900 bg-gradient-to-r from-teal-200 to-lime-200 hover:bg-gradient-to-l hover:from-teal-200 hover:to-lime-200 focus:ring-lime-200",
|
41
|
+
"gradient-blue":
|
42
|
+
"text-white bg-gradient-to-br from-purple-600 to-blue-500 hover:bg-gradient-to-bl focus:ring-blue-300",
|
43
|
+
},
|
44
|
+
size: {
|
45
|
+
sm: "text-sm px-3.5 py-1.5",
|
46
|
+
md: "text-sm px-5 py-2.5",
|
47
|
+
lg: "text-base px-5 py-2.5",
|
48
|
+
xl: "text-lg px-5 py-2.5",
|
49
|
+
},
|
50
|
+
rounded: {
|
51
|
+
sm: "rounded-sm",
|
52
|
+
md: "rounded-md",
|
53
|
+
lg: "rounded-lg",
|
54
|
+
xl: "rounded-xl",
|
55
|
+
full: "rounded-full",
|
56
|
+
none: "rounded-none",
|
57
|
+
},
|
58
|
+
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { cn } from "@/lib/utils/utils";
|
2
|
+
|
3
|
+
export default function Skeleton({ className, children }) {
|
4
|
+
return (
|
5
|
+
<div
|
6
|
+
className={cn(
|
7
|
+
"bg-zinc-200 animate-none animate-pulse rounded-md w-full h-full",
|
8
|
+
className
|
9
|
+
)}
|
10
|
+
>
|
11
|
+
{children}
|
12
|
+
</div>
|
13
|
+
);
|
14
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import clsx from "clsx";
|
2
|
+
import { toast } from "sonner";
|
3
|
+
import { twMerge } from "tailwind-merge";
|
4
|
+
|
5
|
+
export function cn(...classes) {
|
6
|
+
return twMerge(clsx(classes));
|
7
|
+
}
|
8
|
+
|
9
|
+
export function getRandomID() {
|
10
|
+
return Math.random().toString(36).substring(2, 9);
|
11
|
+
}
|
12
|
+
|
13
|
+
export const showToast = (
|
14
|
+
type, // "success" | "error" | "info" | "warning" | "loading"
|
15
|
+
message,
|
16
|
+
options
|
17
|
+
) => {
|
18
|
+
toast[type](message, {
|
19
|
+
position: options?.position || "top-center",
|
20
|
+
id: options?.id,
|
21
|
+
duration: options?.duration || 2000,
|
22
|
+
description: options?.description,
|
23
|
+
});
|
24
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
2
|
+
import aspectRatio from "@tailwindcss/aspect-ratio";
|
3
|
+
import forms from "@tailwindcss/forms";
|
4
|
+
|
5
|
+
module.exports = {
|
6
|
+
content: [
|
7
|
+
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
|
8
|
+
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
|
9
|
+
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
|
10
|
+
],
|
11
|
+
|
12
|
+
theme: {
|
13
|
+
extend: {
|
14
|
+
fontFamily: {
|
15
|
+
sans: ["var(--font-sans)", "sans-serif"],
|
16
|
+
},
|
17
|
+
},
|
18
|
+
},
|
19
|
+
plugins: [forms, aspectRatio],
|
20
|
+
};
|
@@ -6,3 +6,6 @@ Currently, two official plugins are available:
|
|
6
6
|
|
7
7
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
8
8
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
9
|
+
|
10
|
+
<!-- TODO 1: add some most used components -->
|
11
|
+
<!-- TODO 2: add some most used utils / hooks / configs -->
|
@@ -35,10 +35,7 @@ export default [
|
|
35
35
|
],
|
36
36
|
"react/prop-types": "off",
|
37
37
|
"react/no-unescaped-entities": "off",
|
38
|
-
"react-refresh/only-export-components":
|
39
|
-
"warn",
|
40
|
-
{ allowConstantExport: true },
|
41
|
-
],
|
38
|
+
"react-refresh/only-export-components": "off",
|
42
39
|
},
|
43
40
|
},
|
44
41
|
];
|
@@ -10,9 +10,15 @@
|
|
10
10
|
"preview": "vite preview"
|
11
11
|
},
|
12
12
|
"dependencies": {
|
13
|
+
"@tailwindcss/aspect-ratio": "^0.4.2",
|
14
|
+
"@tailwindcss/forms": "^0.5.9",
|
15
|
+
"clsx": "^2.1.1",
|
16
|
+
"tailwind-merge": "^2.5.4",
|
17
|
+
"react-hook-form": "^7.53.2",
|
13
18
|
"react": "^18.3.1",
|
14
19
|
"react-dom": "^18.3.1",
|
15
|
-
"use-immer": "^0.10.0"
|
20
|
+
"use-immer": "^0.10.0",
|
21
|
+
"react-toastify": "^10.0.6"
|
16
22
|
},
|
17
23
|
"devDependencies": {
|
18
24
|
"@eslint/js": "^9.11.1",
|
@@ -24,7 +30,6 @@
|
|
24
30
|
"eslint-plugin-react": "^7.37.0",
|
25
31
|
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
26
32
|
"eslint-plugin-react-refresh": "^0.4.12",
|
27
|
-
|
28
33
|
"globals": "^15.9.0",
|
29
34
|
"postcss": "^8.4.47",
|
30
35
|
"tailwindcss": "^3.4.14",
|
@@ -1,10 +1,11 @@
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Raleway:ital,wght@0,100..900;1,100..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");
|
1
2
|
@tailwind base;
|
2
3
|
@tailwind components;
|
3
4
|
@tailwind utilities;
|
4
5
|
|
5
6
|
@layer base {
|
6
7
|
body {
|
7
|
-
@apply font-
|
8
|
+
@apply font-inter bg-white;
|
8
9
|
}
|
9
10
|
|
10
11
|
/* scroll bar styling */
|
@@ -22,4 +23,17 @@
|
|
22
23
|
.btn {
|
23
24
|
@apply px-2 py-1 border rounded hover:bg-zinc-100 active:bg-white active:scale-95;
|
24
25
|
}
|
26
|
+
/* TODO: remove 👇 these classes if you don't need them. */
|
27
|
+
.flex-c {
|
28
|
+
@apply flex justify-center items-center gap-2;
|
29
|
+
}
|
30
|
+
.flex-y {
|
31
|
+
@apply flex flex-col gap-2 items-center;
|
32
|
+
}
|
33
|
+
.flex-x {
|
34
|
+
@apply flex flex-row gap-2 items-center;
|
35
|
+
}
|
36
|
+
.title {
|
37
|
+
@apply text-2xl font-semibold mb-6;
|
38
|
+
}
|
25
39
|
}
|
@@ -1,13 +1,18 @@
|
|
1
1
|
/** @type {import('tailwindcss').Config} */
|
2
|
+
import aspectRatio from "@tailwindcss/aspect-ratio";
|
3
|
+
import forms from "@tailwindcss/forms";
|
4
|
+
|
2
5
|
export default {
|
3
6
|
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
|
4
7
|
theme: {
|
5
8
|
extend: {
|
6
9
|
fontFamily: {
|
7
|
-
inter: ["Inter", "
|
8
|
-
|
10
|
+
inter: ["Inter", "sans-serif"],
|
11
|
+
},
|
12
|
+
container: {
|
13
|
+
center: true,
|
9
14
|
},
|
10
15
|
},
|
11
16
|
},
|
12
|
-
plugins: [],
|
17
|
+
plugins: [forms, aspectRatio],
|
13
18
|
};
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# React + TypeScript + Vite
|
2
|
-
|
3
|
-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
4
|
-
|
5
|
-
Currently, two official plugins are available:
|
6
|
-
|
7
|
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
9
|
-
|
10
|
-
## Expanding the ESLint configuration
|
11
|
-
|
12
|
-
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
13
|
-
|
14
|
-
- Configure the top-level `parserOptions` property like this:
|
15
|
-
|
16
|
-
```js
|
17
|
-
export default tseslint.config({
|
18
|
-
languageOptions: {
|
19
|
-
// other options...
|
20
|
-
parserOptions: {
|
21
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
22
|
-
tsconfigRootDir: import.meta.dirname,
|
23
|
-
},
|
24
|
-
},
|
25
|
-
})
|
26
|
-
```
|
27
|
-
|
28
|
-
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
|
29
|
-
- Optionally add `...tseslint.configs.stylisticTypeChecked`
|
30
|
-
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
|
31
|
-
|
32
|
-
```js
|
33
|
-
// eslint.config.js
|
34
|
-
import react from 'eslint-plugin-react'
|
35
|
-
|
36
|
-
export default tseslint.config({
|
37
|
-
// Set the react version
|
38
|
-
settings: { react: { version: '18.3' } },
|
39
|
-
plugins: {
|
40
|
-
// Add the react plugin
|
41
|
-
react,
|
42
|
-
},
|
43
|
-
rules: {
|
44
|
-
// other rules...
|
45
|
-
// Enable its recommended rules
|
46
|
-
...react.configs.recommended.rules,
|
47
|
-
...react.configs['jsx-runtime'].rules,
|
48
|
-
},
|
49
|
-
})
|
50
|
-
```
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import js from "@eslint/js";
|
2
|
-
import reactHooks from "eslint-plugin-react-hooks";
|
3
|
-
import reactRefresh from "eslint-plugin-react-refresh";
|
4
|
-
import globals from "globals";
|
5
|
-
import tseslint from "typescript-eslint";
|
6
|
-
|
7
|
-
export default tseslint.config(
|
8
|
-
{ ignores: ["dist"] },
|
9
|
-
{
|
10
|
-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
11
|
-
files: ["**/*.{ts,tsx}"],
|
12
|
-
languageOptions: {
|
13
|
-
ecmaVersion: 2020,
|
14
|
-
globals: globals.browser,
|
15
|
-
},
|
16
|
-
plugins: {
|
17
|
-
"react-hooks": reactHooks,
|
18
|
-
"react-refresh": reactRefresh,
|
19
|
-
},
|
20
|
-
rules: {
|
21
|
-
...reactHooks.configs.recommended.rules,
|
22
|
-
"react/jsx-no-target-blank": "off",
|
23
|
-
"no-unused-vars": [
|
24
|
-
"error",
|
25
|
-
{ vars: "all", args: "after-used", ignoreRestSiblings: true },
|
26
|
-
],
|
27
|
-
"react/prop-types": "off",
|
28
|
-
"react/no-unescaped-entities": "off",
|
29
|
-
"react-refresh/only-export-components": [
|
30
|
-
"warn",
|
31
|
-
{ allowConstantExport: true },
|
32
|
-
],
|
33
|
-
},
|
34
|
-
}
|
35
|
-
);
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# Logs
|
2
|
-
logs
|
3
|
-
*.log
|
4
|
-
npm-debug.log*
|
5
|
-
yarn-debug.log*
|
6
|
-
yarn-error.log*
|
7
|
-
pnpm-debug.log*
|
8
|
-
lerna-debug.log*
|
9
|
-
|
10
|
-
node_modules
|
11
|
-
dist
|
12
|
-
dist-ssr
|
13
|
-
*.local
|
14
|
-
|
15
|
-
# Editor directories and files
|
16
|
-
.vscode/*
|
17
|
-
!.vscode/extensions.json
|
18
|
-
.idea
|
19
|
-
.DS_Store
|
20
|
-
*.suo
|
21
|
-
*.ntvs*
|
22
|
-
*.njsproj
|
23
|
-
*.sln
|
24
|
-
*.sw?
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8" />
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
-
<title>Your Project Title | Vite + React + TS</title>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<div id="root"></div>
|
11
|
-
<script type="module" src="/src/main.tsx"></script>
|
12
|
-
</body>
|
13
|
-
</html>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "typescript",
|
3
|
-
"private": true,
|
4
|
-
"version": "0.0.0",
|
5
|
-
"type": "module",
|
6
|
-
"scripts": {
|
7
|
-
"dev": "vite",
|
8
|
-
"build": "tsc -b && vite build",
|
9
|
-
"lint": "eslint .",
|
10
|
-
"preview": "vite preview"
|
11
|
-
},
|
12
|
-
"dependencies": {
|
13
|
-
"react": "^18.3.1",
|
14
|
-
"react-dom": "^18.3.1",
|
15
|
-
"use-immer": "^0.10.0"
|
16
|
-
},
|
17
|
-
"devDependencies": {
|
18
|
-
"@eslint/js": "^9.13.0",
|
19
|
-
"@types/react": "^18.3.11",
|
20
|
-
"@types/react-dom": "^18.3.1",
|
21
|
-
"@vitejs/plugin-react": "^4.3.3",
|
22
|
-
"autoprefixer": "^10.4.20",
|
23
|
-
"eslint": "^9.13.0",
|
24
|
-
"eslint-plugin-react-hooks": "^5.0.0",
|
25
|
-
"eslint-plugin-react-refresh": "^0.4.13",
|
26
|
-
"globals": "^15.11.0",
|
27
|
-
"postcss": "^8.4.47",
|
28
|
-
"tailwindcss": "^3.4.14",
|
29
|
-
"typescript": "~5.6.2",
|
30
|
-
"typescript-eslint": "^8.10.0",
|
31
|
-
"vite": "^5.4.9"
|
32
|
-
}
|
33
|
-
}
|