Skip to content

Commit

Permalink
Install Shadcn/UI for Project
Browse files Browse the repository at this point in the history
  • Loading branch information
jekigates committed Jun 16, 2024
1 parent e9cb06e commit 88fb1bf
Show file tree
Hide file tree
Showing 10 changed files with 436 additions and 243 deletions.
17 changes: 17 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "renderer/styles/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
259 changes: 120 additions & 139 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
"postinstall": "electron-builder install-app-deps"
},
"dependencies": {
"@radix-ui/react-slot": "^1.0.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"electron-serve": "^1.3.0",
"electron-store": "^8.2.0"
"electron-store": "^8.2.0",
"lucide-react": "^0.395.0",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@types/node": "^20.11.16",
Expand All @@ -25,7 +31,7 @@
"postcss": "^8.4.38",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^3.4.3",
"tailwindcss": "^3.4.4",
"typescript": "^5.4.5"
}
}
56 changes: 56 additions & 0 deletions renderer/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"

import { cn } from "@/lib/utils"

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline:
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
)
}
)
Button.displayName = "Button"

export { Button, buttonVariants }
6 changes: 6 additions & 0 deletions renderer/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))
}
67 changes: 35 additions & 32 deletions renderer/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
import React from 'react'
import Head from 'next/head'
import Link from 'next/link'
import Image from 'next/image'
import React from "react";
import Head from "next/head";
import Link from "next/link";
import Image from "next/image";
import { buttonVariants } from "@/components/ui/button";

export default function HomePage() {
return (
<React.Fragment>
<Head>
<title>Home - Nextron (with-tailwindcss)</title>
</Head>
<div className="grid grid-col-1 text-2xl w-full text-center">
<div>
<Image
className="ml-auto mr-auto"
src="/images/logo.png"
alt="Logo image"
width={256}
height={256}
/>
</div>
<span>⚡ Electron ⚡</span>
<span>+</span>
<span>Next.js</span>
<span>+</span>
<span>tailwindcss</span>
<span>=</span>
<span>💕 </span>
</div>
<div className="mt-1 w-full flex-wrap flex justify-center">
<Link href="/next">Go to next page</Link>
</div>
</React.Fragment>
)
return (
<React.Fragment>
<Head>
<title>Home - Nextron (with-tailwindcss)</title>
</Head>
<div className="grid grid-col-1 text-2xl w-full text-center">
<div>
<Image
className="ml-auto mr-auto"
src="/images/logo.png"
alt="Logo image"
width={256}
height={256}
/>
</div>
<span>⚡ Electron ⚡</span>
<span>+</span>
<span>Next.js</span>
<span>+</span>
<span>tailwindcss</span>
<span>=</span>
<span>💕 </span>
</div>
<div className="mt-1 w-full flex-wrap flex justify-center">
<Link href="/next" className={buttonVariants()}>
Go to next page
</Link>
</div>
</React.Fragment>
);
}
55 changes: 29 additions & 26 deletions renderer/pages/next.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
import React from 'react'
import Head from 'next/head'
import Link from 'next/link'
import Image from 'next/image'
import React from "react";
import Head from "next/head";
import Link from "next/link";
import Image from "next/image";
import { buttonVariants } from "@/components/ui/button";

export default function NextPage() {
return (
<React.Fragment>
<Head>
<title>Next - Nextron (with-tailwindcss)</title>
</Head>
<div className="grid grid-col-1 text-2xl w-full text-center">
<div>
<Image
className="ml-auto mr-auto"
src="/images/logo.png"
alt="Logo image"
width={256}
height={256}
/>
</div>
<span>⚡ Nextron ⚡</span>
</div>
<div className="mt-1 w-full flex-wrap flex justify-center">
<Link href="/home">Go to home page</Link>
</div>
</React.Fragment>
)
return (
<React.Fragment>
<Head>
<title>Next - Nextron (with-tailwindcss)</title>
</Head>
<div className="grid grid-col-1 text-2xl w-full text-center">
<div>
<Image
className="ml-auto mr-auto"
src="/images/logo.png"
alt="Logo image"
width={256}
height={256}
/>
</div>
<span>⚡ Nextron ⚡</span>
</div>
<div className="mt-1 w-full flex-wrap flex justify-center">
<Link href="/home" className={buttonVariants()}>
Go to home page
</Link>
</div>
</React.Fragment>
);
}
83 changes: 72 additions & 11 deletions renderer/styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,76 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@tailwind components;
@tailwind utilities;

@layer base {
body {
@apply bg-gray-900 text-white;
}
}
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 0 0% 3.9%;

--card: 0 0% 100%;
--card-foreground: 0 0% 3.9%;

--popover: 0 0% 100%;
--popover-foreground: 0 0% 3.9%;

--primary: 0 0% 9%;
--primary-foreground: 0 0% 98%;

--secondary: 0 0% 96.1%;
--secondary-foreground: 0 0% 9%;

--muted: 0 0% 96.1%;
--muted-foreground: 0 0% 45.1%;

--accent: 0 0% 96.1%;
--accent-foreground: 0 0% 9%;

--destructive: 0 84.2% 60.2%;
--destructive-foreground: 0 0% 98%;

--border: 0 0% 89.8%;
--input: 0 0% 89.8%;
--ring: 0 0% 3.9%;

--radius: 0.5rem;
}

@layer components {
.btn-blue {
@apply text-white font-bold px-4 py-2 rounded bg-blue-600 hover:bg-blue-500;
.dark {
--background: 0 0% 3.9%;
--foreground: 0 0% 98%;

--card: 0 0% 3.9%;
--card-foreground: 0 0% 98%;

--popover: 0 0% 3.9%;
--popover-foreground: 0 0% 98%;

--primary: 0 0% 98%;
--primary-foreground: 0 0% 9%;

--secondary: 0 0% 14.9%;
--secondary-foreground: 0 0% 98%;

--muted: 0 0% 14.9%;
--muted-foreground: 0 0% 63.9%;

--accent: 0 0% 14.9%;
--accent-foreground: 0 0% 98%;

--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 0% 98%;

--border: 0 0% 14.9%;
--input: 0 0% 14.9%;
--ring: 0 0% 83.1%;
}
}
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
Loading

0 comments on commit 88fb1bf

Please sign in to comment.