-
Notifications
You must be signed in to change notification settings - Fork 5
Add Tailwind and Shadcn #240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0481c4a
Add Tailwind CSS integration and update ESLint configuration
jerryzhou196 a270695
Update React, React-DOM, and TypeScript dependencies; adjust Webpack …
jerryzhou196 aba5399
Potential fix for pull request finding
jerryzhou196 0e68542
Merge main into add-tailwind-shadcn
jerryzhou196 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ config/** | |
| coverage/** | ||
| scripts/** | ||
|
|
||
| tailwind.config.js | ||
| *.css | ||
| Dockerfile | ||
| LICENSE | ||
| *.lock | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "$schema": "https://ui.shadcn.com/schema.json", | ||
| "style": "default", | ||
| "rsc": false, | ||
| "tsx": true, | ||
| "tailwind": { | ||
| "config": "tailwind.config.js", | ||
| "css": "src/index.css", | ||
| "baseColor": "slate", | ||
| "cssVariables": false, | ||
| "prefix": "" | ||
| }, | ||
| "aliases": { | ||
| "components": "components", | ||
| "utils": "lib/utils", | ||
| "ui": "components/ui", | ||
| "lib": "lib", | ||
| "hooks": "hooks" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import React from 'react'; | ||
| import { Slot } from '@radix-ui/react-slot'; | ||
| import { cva, VariantProps } from 'class-variance-authority'; | ||
|
|
||
| import { cn } from 'lib/utils'; | ||
|
|
||
| // Variants use the GlobalTheme-derived Tailwind tokens (see tailwind.config.js) | ||
| // rather than shadcn's semantic CSS variables, matching this project's palette. | ||
| const buttonVariants = cva( | ||
| 'inline-flex items-center justify-center whitespace-nowrap rounded text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', | ||
| { | ||
| variants: { | ||
| variant: { | ||
| default: 'bg-primary text-white hover:bg-primaryDark', | ||
| destructive: 'bg-red text-white hover:bg-darkRed', | ||
| outline: 'border border-light3 bg-white text-dark1 hover:bg-light1', | ||
| secondary: 'bg-light2 text-dark1 hover:bg-light3', | ||
| ghost: 'text-dark1 hover:bg-light1', | ||
| link: 'text-primary underline-offset-4 hover:underline', | ||
| }, | ||
| size: { | ||
| default: 'h-10 px-4 py-2', | ||
| sm: 'h-9 rounded px-3', | ||
| lg: 'h-11 rounded 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 }; | ||
|
jerryzhou196 marked this conversation as resolved.
jerryzhou196 marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /* | ||
| * Tailwind CSS entrypoint. | ||
| * | ||
| * Utilities are layered on top of the app's existing reset (public/index.css) | ||
| * and styled-components styles. Tailwind's preflight is disabled in | ||
| * tailwind.config.js, so `@tailwind base` is effectively a no-op here but is | ||
| * kept so future `@layer base { ... }` additions work as expected. | ||
| */ | ||
| @tailwind base; | ||
| @tailwind components; | ||
| @tailwind utilities; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { ClassValue, clsx } from 'clsx'; | ||
| import { twMerge } from 'tailwind-merge'; | ||
|
|
||
| /** | ||
| * Merge class names with Tailwind-aware conflict resolution. | ||
| * Used by shadcn/ui components and any Tailwind-styled component. | ||
| */ | ||
| export function cn(...inputs: ClassValue[]) { | ||
| return twMerge(clsx(inputs)); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /** @type {import('tailwindcss').Config} */ | ||
| module.exports = { | ||
| darkMode: ['class'], | ||
| content: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'], | ||
| // The app ships its own CSS reset in public/index.css | ||
| // (`* { box-sizing: border-box; margin: 0; padding: 0 }`, button/anchor | ||
| // resets, etc.), so Tailwind's preflight is disabled to avoid double- | ||
| // resetting and altering the existing styled-components UI. | ||
| corePlugins: { | ||
| preflight: false, | ||
| }, | ||
| theme: { | ||
| extend: { | ||
| // Mirrors src/constants/GlobalTheme.tsx so styled-components and Tailwind | ||
| // share a single palette. Keep these two files in sync. | ||
| colors: { | ||
| primary: '#0052cc', | ||
| primaryDark: '#0747a6', | ||
| primaryExtraDark: '#042049', | ||
| courses: '#ff8b00', | ||
| professors: '#36b37e', | ||
| accent: '#ffc400', | ||
| accentDark: '#e8b300', | ||
|
|
||
| dark1: '#172b4d', | ||
| dark2: '#505f79', | ||
| dark3: '#97a0af', | ||
|
|
||
| light1: '#f4f5f7', | ||
| light2: '#ebecf0', | ||
| light3: '#dfe1e5', | ||
| light4: '#c6c9c9', | ||
|
|
||
| lecture: '#b3d4ff', | ||
| lab: '#b3f3ff', | ||
| tutorial: '#c0b6f2', | ||
|
|
||
| white: '#ffffff', | ||
| red: '#ff5630', | ||
| darkRed: '#de350b', | ||
|
|
||
| google: '#4285f4', | ||
| facebook: '#3c5a99', | ||
|
|
||
| transparent: 'rgba(0, 0, 0, 0)', | ||
| }, | ||
| // Mirrors GlobalTheme.breakpoints (min-width). `zero` (0) is the base, so | ||
| // it is intentionally omitted as a Tailwind screen. | ||
| screens: { | ||
| mobileLarge: '600px', | ||
| tablet: '800px', | ||
| desktop: '1200px', | ||
| }, | ||
| }, | ||
| }, | ||
| plugins: [require('tailwindcss-animate')], | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.