Skip to content

Commit

Permalink
shadcn
Browse files Browse the repository at this point in the history
  • Loading branch information
TuTiDore committed Dec 9, 2023
1 parent 27e2a3f commit 212da10
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 23 deletions.
16 changes: 16 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.cjs",
"css": "src/index.css",
"baseColor": "zinc",
"cssVariables": false
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-tooltip": "^1.0.7",
"@tauri-apps/api": "^1.5.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"framer-motion": "^10.16.16",
"lodash": "^4.17.21",
"lucide-react": "^0.294.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-toastify": "^9.1.3",
"tailwind-merge": "^2.1.0"
"tailwind-merge": "^2.1.0",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@tauri-apps/cli": "^1.5.7",
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import DiscordLogo from "./assets/discord-mark-white.svg";
import GithubLogo from "./assets/GitHub-Mark-Light-64px.png";
import Switch from "./layout/Switch";
import Tooltip from "./layout/Tooltip";
import { cn } from "./utils";
import { cn } from "./lib/utils";
import "./App.css";

type Selection = ToySelection | ConfigSelection | null;
Expand Down
2 changes: 1 addition & 1 deletion src/features/Toy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Tooltip from "../layout/Tooltip";
import BatteryIcon from "../components/BatteryIcon";
import { useEffect, useState } from "react";
import { FeVCToy } from "../../src-tauri/bindings/FeVCToy";
import { cn } from "../utils";
import { cn } from "../lib/utils";

export default function Toy({ toy }: { toy: FeVCToy }) {
const [selectedFeatureIndex, setSelectedFeatureIndex] = useState(0);
Expand Down
3 changes: 2 additions & 1 deletion src/layout/Slider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as SliderPrimitive from "@radix-ui/react-slider";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import { cn, round0 } from "../utils";
import { round0 } from "../utils";
import { cn } from "../lib/utils";
import { useState } from "react";

export default function Slider(
Expand Down
2 changes: 1 addition & 1 deletion src/layout/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as SwitchPrimitive from "@radix-ui/react-switch";
import { SwitchProps } from "@radix-ui/react-switch";
import { cn } from "../utils";
import { cn } from "../lib/utils";

const themeColors = {
"white-cyan": {
Expand Down
6 changes: 6 additions & 0 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
7 changes: 0 additions & 7 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { clsx, ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

export const percent = new Intl.NumberFormat("en-US", {
style: "percent",
minimumFractionDigits: 0,
Expand All @@ -15,7 +12,3 @@ export const round0 = new Intl.NumberFormat("en-US", {
export function assertExhaustive(e: never): never {
throw new Error("Non-Exhaustive switch statement", e);
}

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
36 changes: 32 additions & 4 deletions tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
darkMode: ["class"],
content: [
'./pages/**/*.{ts,tsx}',
'./components/**/*.{ts,tsx}',
'./app/**/*.{ts,tsx}',
'./src/**/*.{ts,tsx}',
],
theme: {
extend: {},
container: {
center: true,
padding: "2rem",
screens: {
"2xl": "1400px",
},
},
extend: {
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: [],
};
plugins: [require("tailwindcss-animate")],
}
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
Expand Down
7 changes: 6 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";

export default defineConfig({
plugins: [react()],

resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
// prevent vite from obscuring rust errors
clearScreen: false,
Expand Down
27 changes: 22 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1103,16 +1103,23 @@ chokidar@^3.5.3:
optionalDependencies:
fsevents "~2.3.2"

clsx@^1.1.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12"
integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==
class-variance-authority@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/class-variance-authority/-/class-variance-authority-0.7.0.tgz#1c3134d634d80271b1837452b06d821915954522"
integrity sha512-jFI8IQw4hczaL4ALINxqLEXQbWcNjoSkloa4IaufXCJr6QawJyw7tuRysRsrE8w2p/4gGaxKIt/hX3qz/IbD1A==
dependencies:
clsx "2.0.0"

clsx@^2.0.0:
clsx@2.0.0, clsx@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.0.0.tgz#12658f3fd98fafe62075595a5c30e43d18f3d00b"
integrity sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q==

clsx@^1.1.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12"
integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==

color-convert@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
Expand Down Expand Up @@ -2050,6 +2057,11 @@ lru-cache@^6.0.0:
dependencies:
yallist "^4.0.0"

lucide-react@^0.294.0:
version "0.294.0"
resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.294.0.tgz#dc406e1e7e2f722cf93218fe5b31cf3c95778817"
integrity sha512-V7o0/VECSGbLHn3/1O67FUgBwWB+hmzshrgDVRJQhMh8uj5D3HBuIvhuAmQTtlupILSplwIZg5FTc4tTKMA2SA==

merge2@^1.3.0, merge2@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
Expand Down Expand Up @@ -2644,6 +2656,11 @@ tailwind-merge@^2.1.0:
dependencies:
"@babel/runtime" "^7.23.5"

tailwindcss-animate@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/tailwindcss-animate/-/tailwindcss-animate-1.0.7.tgz#318b692c4c42676cc9e67b19b78775742388bef4"
integrity sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==

tailwindcss@^3.3.6:
version "3.3.6"
resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.3.6.tgz#4dd7986bf4902ad385d90d45fd4b2fa5fab26d5f"
Expand Down

0 comments on commit 212da10

Please sign in to comment.