From 430264118350379be14b4e5e49074c89c322ad65 Mon Sep 17 00:00:00 2001 From: JustAnotherDevv Date: Sat, 13 Jul 2024 01:28:53 +0200 Subject: [PATCH] shadcn ui --- packages/nextjs/@/lib/utils.ts | 6 + packages/nextjs/components.json | 17 ++ .../nextjs/contracts/deployedContracts.ts | 148 ++++++++++- packages/nextjs/package.json | 5 + packages/nextjs/styles/globals.css | 126 +++++++-- packages/nextjs/tailwind.config.js | 242 +++++++++++++++++- yarn.lock | 53 ++++ 7 files changed, 563 insertions(+), 34 deletions(-) create mode 100644 packages/nextjs/@/lib/utils.ts create mode 100644 packages/nextjs/components.json diff --git a/packages/nextjs/@/lib/utils.ts b/packages/nextjs/@/lib/utils.ts new file mode 100644 index 0000000..d084cca --- /dev/null +++ b/packages/nextjs/@/lib/utils.ts @@ -0,0 +1,6 @@ +import { type ClassValue, clsx } from "clsx" +import { twMerge } from "tailwind-merge" + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)) +} diff --git a/packages/nextjs/components.json b/packages/nextjs/components.json new file mode 100644 index 0000000..813e2c3 --- /dev/null +++ b/packages/nextjs/components.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "default", + "rsc": true, + "tsx": true, + "tailwind": { + "config": "tailwind.config.js", + "css": "styles/globals.css", + "baseColor": "slate", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils" + } +} \ No newline at end of file diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index 008d4eb..9160ed9 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -4,6 +4,152 @@ */ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; -const deployedContracts = {} as const; +const deployedContracts = { + 31337: { + YourContract: { + address: "0x5FbDB2315678afecb367f032d93F642f64180aa3", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_owner", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "greetingSetter", + type: "address", + }, + { + indexed: false, + internalType: "string", + name: "newGreeting", + type: "string", + }, + { + indexed: false, + internalType: "bool", + name: "premium", + type: "bool", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "GreetingChange", + type: "event", + }, + { + inputs: [], + name: "greeting", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "premium", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "_newGreeting", + type: "string", + }, + ], + name: "setGreeting", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "totalCounter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "userGreetingCounter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, + ], + inheritedFunctions: {}, + }, + }, +} as const; export default deployedContracts satisfies GenericContractsDeclaration; diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 951d786..eeea141 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -21,7 +21,10 @@ "@uniswap/v2-sdk": "^3.0.1", "blo": "^1.0.1", "burner-connector": "^0.0.8", + "class-variance-authority": "^0.7.0", + "clsx": "^2.1.1", "daisyui": "4.5.0", + "lucide-react": "^0.408.0", "next": "^14.0.4", "next-themes": "^0.2.1", "nprogress": "^0.2.0", @@ -30,6 +33,8 @@ "react-copy-to-clipboard": "^5.1.0", "react-dom": "^18.2.0", "react-hot-toast": "^2.4.0", + "tailwind-merge": "^2.4.0", + "tailwindcss-animate": "^1.0.7", "use-debounce": "^8.0.4", "usehooks-ts": "^2.13.0", "viem": "2.13.6", diff --git a/packages/nextjs/styles/globals.css b/packages/nextjs/styles/globals.css index 3fb55ae..a9de62a 100644 --- a/packages/nextjs/styles/globals.css +++ b/packages/nextjs/styles/globals.css @@ -1,32 +1,104 @@ -@import "tailwindcss/base"; -@import "tailwindcss/components"; -@import "tailwindcss/utilities"; +@tailwind base; + @tailwind components; + @tailwind utilities; -:root, -[data-theme] { - background: oklch(var(--b2)); -} + @layer base { + :root { + --background: 0 0% 100%; + --foreground: 222.2 84% 4.9%; + --card: 0 0% 100%; + --card-foreground: 222.2 84% 4.9%; + --popover: 0 0% 100%; + --popover-foreground: 222.2 84% 4.9%; + --primary: 222.2 47.4% 11.2%; + --primary-foreground: 210 40% 98%; + --secondary: 210 40% 96.1%; + --secondary-foreground: 222.2 47.4% 11.2%; + --muted: 210 40% 96.1%; + --muted-foreground: 215.4 16.3% 46.9%; + --accent: 210 40% 96.1%; + --accent-foreground: 222.2 47.4% 11.2%; + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 210 40% 98%; + --border: 214.3 31.8% 91.4%; + --input: 214.3 31.8% 91.4%; + --ring: 222.2 84% 4.9%; + --radius: 0.5rem; + --chart-1: 12 76% 61%; + --chart-2: 173 58% 39%; + --chart-3: 197 37% 24%; + --chart-4: 43 74% 66%; + --chart-5: 27 87% 67%; + } -body { - min-height: 100vh; -} + .dark { + --background: 222.2 84% 4.9%; + --foreground: 210 40% 98%; + --card: 222.2 84% 4.9%; + --card-foreground: 210 40% 98%; + --popover: 222.2 84% 4.9%; + --popover-foreground: 210 40% 98%; + --primary: 210 40% 98%; + --primary-foreground: 222.2 47.4% 11.2%; + --secondary: 217.2 32.6% 17.5%; + --secondary-foreground: 210 40% 98%; + --muted: 217.2 32.6% 17.5%; + --muted-foreground: 215 20.2% 65.1%; + --accent: 217.2 32.6% 17.5%; + --accent-foreground: 210 40% 98%; + --destructive: 0 62.8% 30.6%; + --destructive-foreground: 210 40% 98%; + --border: 217.2 32.6% 17.5%; + --input: 217.2 32.6% 17.5%; + --ring: 212.7 26.8% 83.9%; + --chart-1: 220 70% 50%; + --chart-2: 160 60% 45%; + --chart-3: 30 80% 55%; + --chart-4: 280 65% 60%; + --chart-5: 340 75% 55%; + } + } -h1, -h2, -h3, -h4 { - margin-bottom: 0.5rem; - line-height: 1; -} + @layer base { + * { + @apply border-border; + } + body { + @apply bg-background text-foreground; + } + } -p { - margin: 1rem 0; -} -.btn { - @apply shadow-md; -} - -.btn.btn-ghost { - @apply shadow-none; -} + @import "tailwindcss/base"; + @import "tailwindcss/components"; + @import "tailwindcss/utilities"; + + :root, + [data-theme] { + background: oklch(var(--b2)); + } + + body { + min-height: 100vh; + } + + h1, + h2, + h3, + h4 { + margin-bottom: 0.5rem; + line-height: 1; + } + + p { + margin: 1rem 0; + } + + .btn { + @apply shadow-md; + } + + .btn.btn-ghost { + @apply shadow-none; + } + \ No newline at end of file diff --git a/packages/nextjs/tailwind.config.js b/packages/nextjs/tailwind.config.js index 9099dc5..aeaeff0 100644 --- a/packages/nextjs/tailwind.config.js +++ b/packages/nextjs/tailwind.config.js @@ -1,7 +1,89 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: ["./app/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}", "./utils/**/*.{js,ts,jsx,tsx}"], - plugins: [require("daisyui")], + darkMode: ["class"], + content: [ + './pages/**/*.{ts,tsx}', + './components/**/*.{ts,tsx}', + './app/**/*.{ts,tsx}', + './src/**/*.{ts,tsx}', + ], + prefix: "", + theme: { + theme: { + extend: { + boxShadow: { + center: "0 0 12px -2px rgb(0 0 0 / 0.05)", + }, + animation: { + "pulse-fast": "pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite", + }, + }, + }, + container: { + center: true, + padding: "2rem", + screens: { + "2xl": "1400px", + }, + }, + extend: { + colors: { + border: "hsl(var(--border))", + input: "hsl(var(--input))", + ring: "hsl(var(--ring))", + background: "hsl(var(--background))", + foreground: "hsl(var(--foreground))", + primary: { + DEFAULT: "hsl(var(--primary))", + foreground: "hsl(var(--primary-foreground))", + }, + secondary: { + DEFAULT: "hsl(var(--secondary))", + foreground: "hsl(var(--secondary-foreground))", + }, + destructive: { + DEFAULT: "hsl(var(--destructive))", + foreground: "hsl(var(--destructive-foreground))", + }, + muted: { + DEFAULT: "hsl(var(--muted))", + foreground: "hsl(var(--muted-foreground))", + }, + accent: { + DEFAULT: "hsl(var(--accent))", + foreground: "hsl(var(--accent-foreground))", + }, + popover: { + DEFAULT: "hsl(var(--popover))", + foreground: "hsl(var(--popover-foreground))", + }, + card: { + DEFAULT: "hsl(var(--card))", + foreground: "hsl(var(--card-foreground))", + }, + }, + borderRadius: { + lg: "var(--radius)", + md: "calc(var(--radius) - 2px)", + sm: "calc(var(--radius) - 4px)", + }, + keyframes: { + "accordion-down": { + from: { height: "0" }, + to: { height: "var(--radix-accordion-content-height)" }, + }, + "accordion-up": { + from: { height: "var(--radix-accordion-content-height)" }, + to: { height: "0" }, + }, + }, + animation: { + "accordion-down": "accordion-down 0.2s ease-out", + "accordion-up": "accordion-up 0.2s ease-out", + }, + }, + }, + plugins: [require("tailwindcss-animate"), require("daisyui")], darkTheme: "dark", darkMode: ["selector", "[data-theme='dark']"], // DaisyUI theme colors @@ -74,14 +156,162 @@ module.exports = { }, ], }, +}/** @type {import('tailwindcss').Config} */ +module.exports = { + darkMode: ["class"], + content: [ + './pages/**/*.{ts,tsx}', + './components/**/*.{ts,tsx}', + './app/**/*.{ts,tsx}', + './src/**/*.{ts,tsx}', + ], + prefix: "", theme: { + theme: { + extend: { + boxShadow: { + center: "0 0 12px -2px rgb(0 0 0 / 0.05)", + }, + animation: { + "pulse-fast": "pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite", + }, + }, + }, + container: { + center: true, + padding: "2rem", + screens: { + "2xl": "1400px", + }, + }, extend: { - boxShadow: { - center: "0 0 12px -2px rgb(0 0 0 / 0.05)", + colors: { + border: "hsl(var(--border))", + input: "hsl(var(--input))", + ring: "hsl(var(--ring))", + background: "hsl(var(--background))", + foreground: "hsl(var(--foreground))", + primary: { + DEFAULT: "hsl(var(--primary))", + foreground: "hsl(var(--primary-foreground))", + }, + secondary: { + DEFAULT: "hsl(var(--secondary))", + foreground: "hsl(var(--secondary-foreground))", + }, + destructive: { + DEFAULT: "hsl(var(--destructive))", + foreground: "hsl(var(--destructive-foreground))", + }, + muted: { + DEFAULT: "hsl(var(--muted))", + foreground: "hsl(var(--muted-foreground))", + }, + accent: { + DEFAULT: "hsl(var(--accent))", + foreground: "hsl(var(--accent-foreground))", + }, + popover: { + DEFAULT: "hsl(var(--popover))", + foreground: "hsl(var(--popover-foreground))", + }, + card: { + DEFAULT: "hsl(var(--card))", + foreground: "hsl(var(--card-foreground))", + }, + }, + borderRadius: { + lg: "var(--radius)", + md: "calc(var(--radius) - 2px)", + sm: "calc(var(--radius) - 4px)", + }, + keyframes: { + "accordion-down": { + from: { height: "0" }, + to: { height: "var(--radix-accordion-content-height)" }, + }, + "accordion-up": { + from: { height: "var(--radix-accordion-content-height)" }, + to: { height: "0" }, + }, }, animation: { - "pulse-fast": "pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite", + "accordion-down": "accordion-down 0.2s ease-out", + "accordion-up": "accordion-up 0.2s ease-out", }, }, }, -}; + plugins: [require("tailwindcss-animate"), require("daisyui")], + darkTheme: "dark", + darkMode: ["selector", "[data-theme='dark']"], + // DaisyUI theme colors + daisyui: { + themes: [ + { + light: { + primary: "#93BBFB", + "primary-content": "#212638", + secondary: "#DAE8FF", + "secondary-content": "#212638", + accent: "#93BBFB", + "accent-content": "#212638", + neutral: "#212638", + "neutral-content": "#ffffff", + "base-100": "#ffffff", + "base-200": "#f4f8ff", + "base-300": "#DAE8FF", + "base-content": "#212638", + info: "#93BBFB", + success: "#34EEB6", + warning: "#FFCF72", + error: "#FF8863", + + "--rounded-btn": "9999rem", + + ".tooltip": { + "--tooltip-tail": "6px", + }, + ".link": { + textUnderlineOffset: "2px", + }, + ".link:hover": { + opacity: "80%", + }, + }, + }, + { + dark: { + primary: "#212638", + "primary-content": "#F9FBFF", + secondary: "#323f61", + "secondary-content": "#F9FBFF", + accent: "#4969A6", + "accent-content": "#F9FBFF", + neutral: "#F9FBFF", + "neutral-content": "#385183", + "base-100": "#385183", + "base-200": "#2A3655", + "base-300": "#212638", + "base-content": "#F9FBFF", + info: "#385183", + success: "#34EEB6", + warning: "#FFCF72", + error: "#FF8863", + + "--rounded-btn": "9999rem", + + ".tooltip": { + "--tooltip-tail": "6px", + "--tooltip-color": "oklch(var(--p))", + }, + ".link": { + textUnderlineOffset: "2px", + }, + ".link:hover": { + opacity: "80%", + }, + }, + }, + ], + }, +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 346ac62..572aacd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2248,11 +2248,14 @@ __metadata: autoprefixer: ^10.4.12 blo: ^1.0.1 burner-connector: ^0.0.8 + class-variance-authority: ^0.7.0 + clsx: ^2.1.1 daisyui: 4.5.0 eslint: ^8.15.0 eslint-config-next: ^14.0.4 eslint-config-prettier: ^9.1.0 eslint-plugin-prettier: ^5.1.3 + lucide-react: ^0.408.0 next: ^14.0.4 next-themes: ^0.2.1 nprogress: ^0.2.0 @@ -2263,7 +2266,9 @@ __metadata: react-copy-to-clipboard: ^5.1.0 react-dom: ^18.2.0 react-hot-toast: ^2.4.0 + tailwind-merge: ^2.4.0 tailwindcss: ^3.4.3 + tailwindcss-animate: ^1.0.7 type-fest: ^4.6.0 typescript: 5.1.6 use-debounce: ^8.0.4 @@ -5188,6 +5193,15 @@ __metadata: languageName: node linkType: hard +"class-variance-authority@npm:^0.7.0": + version: 0.7.0 + resolution: "class-variance-authority@npm:0.7.0" + dependencies: + clsx: 2.0.0 + checksum: e7fd1fab433ef06f52a1b7b241b70b4a185864deef199d3b0a2c3412f1cc179517288264c383f3b971a00d76811625fc8f7ffe709e6170219e88cd7368f08a20 + languageName: node + linkType: hard + "classic-level@npm:^1.2.0": version: 1.3.0 resolution: "classic-level@npm:1.3.0" @@ -5304,6 +5318,13 @@ __metadata: languageName: node linkType: hard +"clsx@npm:2.0.0": + version: 2.0.0 + resolution: "clsx@npm:2.0.0" + checksum: a2cfb2351b254611acf92faa0daf15220f4cd648bdf96ce369d729813b85336993871a4bf6978ddea2b81b5a130478339c20d9d0b5c6fc287e5147f0c059276e + languageName: node + linkType: hard + "clsx@npm:2.1.0": version: 2.1.0 resolution: "clsx@npm:2.1.0" @@ -5318,6 +5339,13 @@ __metadata: languageName: node linkType: hard +"clsx@npm:^2.1.1": + version: 2.1.1 + resolution: "clsx@npm:2.1.1" + checksum: acd3e1ab9d8a433ecb3cc2f6a05ab95fe50b4a3cfc5ba47abb6cbf3754585fcb87b84e90c822a1f256c4198e3b41c7f6c391577ffc8678ad587fc0976b24fd57 + languageName: node + linkType: hard + "cluster-key-slot@npm:^1.1.0": version: 1.1.2 resolution: "cluster-key-slot@npm:1.1.2" @@ -9954,6 +9982,15 @@ __metadata: languageName: node linkType: hard +"lucide-react@npm:^0.408.0": + version: 0.408.0 + resolution: "lucide-react@npm:0.408.0" + peerDependencies: + react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 + checksum: 80318ea5b49057db3761e5d8909336a14a8c84ebe205ef68c20100013b23aadcdee628b1175c630aec14c20b85320fb502723f6d4a9b46a6a9659451ed5fce48 + languageName: node + linkType: hard + "make-dir@npm:^3.1.0": version: 3.1.0 resolution: "make-dir@npm:3.1.0" @@ -13495,6 +13532,22 @@ __metadata: languageName: node linkType: hard +"tailwind-merge@npm:^2.4.0": + version: 2.4.0 + resolution: "tailwind-merge@npm:2.4.0" + checksum: 442ab18af754eb90a1c730289b10a5df89ec8f197b4783bd31651fffc06ac06dbe7a8f491c2e133c906d6ab466170a5fc1f45aa2d22874e47706acf9d8b0cfe5 + languageName: node + linkType: hard + +"tailwindcss-animate@npm:^1.0.7": + version: 1.0.7 + resolution: "tailwindcss-animate@npm:1.0.7" + peerDependencies: + tailwindcss: "*" + checksum: c1760983eb3fec0c8421e95082bf308e6845df43e2f90862386366e82545c801b26b4d189c4cd23d6915252b76d18005c8e5f591f8b119944c7fb8650d0f8bce + languageName: node + linkType: hard + "tailwindcss@npm:^3.4.3": version: 3.4.3 resolution: "tailwindcss@npm:3.4.3"