config tailwind
This commit is contained in:
+3
-2
@@ -1,5 +1,6 @@
|
||||
const config = {
|
||||
plugins: ["@tailwindcss/postcss"],
|
||||
plugins: {
|
||||
'@tailwindcss/postcss': {},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@import "tailwindcss";
|
||||
@import "tailwindcss/utilities";
|
||||
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
@@ -24,3 +25,42 @@ body {
|
||||
color: var(--foreground);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
:root {
|
||||
--primary: #6366F1;
|
||||
--secondary: #A78BFA;
|
||||
--textColorLight: #FFFFFF;
|
||||
--textColorGray: #222222;
|
||||
--bgPrimary: #FFFFFF;
|
||||
--gray-100: #EBEBEB;
|
||||
--gray-200: #F5F5F5;
|
||||
--gray-300: #81848A;
|
||||
--gray-400: #777;
|
||||
--gray-500: #222;
|
||||
|
||||
.dark{
|
||||
--primary: #FA003F;
|
||||
--secondary: #7C3AED;
|
||||
--textColorLight: #FA003F;
|
||||
--textColorGray: #FA003F;
|
||||
--bgPrimary: #FA003F;
|
||||
--gray-100: #EBEBEB;
|
||||
--gray-200: #F5F5F5;
|
||||
--gray-300: #81848A;
|
||||
--gray-400: #777;
|
||||
--gray-500: #222;
|
||||
}
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-primary: var(--primary-default);
|
||||
--color-secondary: var(--secondary-default);
|
||||
--color-text-light: var(--textColorLight-default);
|
||||
--color-text-gray: var(--textColorGray-default);
|
||||
--color-bg-primary: var(--bgPrimary-default);
|
||||
--color-gray-100: var(--gray-100);
|
||||
--color-gray-200: var(--gray-200);
|
||||
--color-gray-300: var(--gray-300);
|
||||
--color-gray-400: var(--gray-400);
|
||||
--color-gray-500: var(--gray-500);
|
||||
}
|
||||
|
||||
+9
-9
@@ -1,20 +1,20 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import type { Metadata } from 'next';
|
||||
import { Geist, Geist_Mono } from 'next/font/google';
|
||||
import './globals.css';
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
variable: '--font-geist-sans',
|
||||
subsets: ['latin'],
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
subsets: ["latin"],
|
||||
variable: '--font-geist-mono',
|
||||
subsets: ['latin'],
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
title: 'Create Next App',
|
||||
description: 'Generated by create next app',
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
|
||||
+49
-97
@@ -1,103 +1,55 @@
|
||||
import Image from "next/image";
|
||||
// ... existing imports ...
|
||||
import Button from '../components/Button'; // Adjust the import path if necessary
|
||||
|
||||
async function getData() {
|
||||
// Simulate a delay to show server-side data fetching
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
return { message: 'This data was fetched on the server!' };
|
||||
}
|
||||
|
||||
export default async function Home() {
|
||||
const data = await getData();
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
|
||||
<main className="flex flex-col gap-[32px] row-start-2 items-center sm:items-start">
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={180}
|
||||
height={38}
|
||||
priority
|
||||
/>
|
||||
<ol className="list-inside list-decimal text-sm/6 text-center sm:text-left font-[family-name:var(--font-geist-mono)]">
|
||||
<li className="mb-2 tracking-[-.01em]">
|
||||
Get started by editing{" "}
|
||||
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-[family-name:var(--font-geist-mono)] font-semibold">
|
||||
src/app/page.tsx
|
||||
</code>
|
||||
.
|
||||
</li>
|
||||
<li className="tracking-[-.01em]">
|
||||
Save and see your changes instantly.
|
||||
</li>
|
||||
</ol>
|
||||
<main className="flex min-h-screen flex-col items-center justify-between p-24 text-gray-300">
|
||||
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
|
||||
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
|
||||
{data.message}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4 items-center flex-col sm:flex-row">
|
||||
<a
|
||||
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:w-auto"
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={20}
|
||||
height={20}
|
||||
/>
|
||||
Deploy now
|
||||
</a>
|
||||
<a
|
||||
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 w-full sm:w-auto md:w-[158px]"
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Read our docs
|
||||
</a>
|
||||
<div className="mt-8 flex gap-4">
|
||||
<Button>Default Button</Button>
|
||||
<Button disabled>Disabled Button</Button>
|
||||
<Button loading>Loading Button</Button>
|
||||
<Button endIcon={<span>→</span>}>Button with Icon</Button>
|
||||
</div>
|
||||
|
||||
<div className="mt-8 flex flex-col gap-4">
|
||||
<h3>Standard Buttons:</h3>
|
||||
<div className="flex gap-4">
|
||||
<Button>Default Button</Button>
|
||||
<Button disabled>Disabled Button</Button>
|
||||
<Button loading>Loading Button</Button>
|
||||
<Button endIcon={<span>→</span>}>Button with Icon</Button>
|
||||
</div>
|
||||
</main>
|
||||
<footer className="row-start-3 flex gap-[24px] flex-wrap items-center justify-center">
|
||||
<a
|
||||
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
aria-hidden
|
||||
src="/file.svg"
|
||||
alt="File icon"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Learn
|
||||
</a>
|
||||
<a
|
||||
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
aria-hidden
|
||||
src="/window.svg"
|
||||
alt="Window icon"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Examples
|
||||
</a>
|
||||
<a
|
||||
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
|
||||
href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
aria-hidden
|
||||
src="/globe.svg"
|
||||
alt="Globe icon"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Go to nextjs.org →
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<h3>Sized Buttons:</h3>
|
||||
<div className="flex gap-4 items-center">
|
||||
<Button size="small">Small Button</Button>
|
||||
<Button size="medium">Medium Button</Button>
|
||||
<Button size="large">Large Button</Button>
|
||||
</div>
|
||||
|
||||
<h3>Icon Buttons:</h3>
|
||||
<div className="flex gap-4 items-center">
|
||||
<Button iconOnly endIcon={<span>←</span>} size="small" />
|
||||
<Button iconOnly endIcon={<span>←</span>} size="medium" />
|
||||
<Button iconOnly endIcon={<span>←</span>} size="large" />
|
||||
<Button iconOnly endIcon={<span>←</span>} disabled size="medium" />
|
||||
<Button iconOnly endIcon={<span>←</span>} loading size="medium" />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import React, { ButtonHTMLAttributes, ReactNode } from 'react';
|
||||
|
||||
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
children?: ReactNode; // Make children optional for icon-only buttons
|
||||
loading?: boolean;
|
||||
disabled?: boolean;
|
||||
endIcon?: ReactNode;
|
||||
size?: 'small' | 'medium' | 'large'; // Add size prop
|
||||
iconOnly?: boolean; // Add iconOnly prop
|
||||
}
|
||||
|
||||
const Button: React.FC<ButtonProps> = ({
|
||||
children,
|
||||
loading = false,
|
||||
disabled = false,
|
||||
endIcon,
|
||||
size = 'medium', // Default size to medium
|
||||
iconOnly = false, // Default iconOnly to false
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
const baseStyles =
|
||||
'inline-flex items-center justify-center border border-transparent font-medium rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2 ';
|
||||
const enabledStyles =
|
||||
'text-white bg-primary-light hover:bg-indigo-700 active:bg-indigo-800 focus:ring-indigo-500';
|
||||
const disabledStyles = 'text-gray-400 bg-gray-200 cursor-not-allowed';
|
||||
const loadingStyles = 'text-gray-400 bg-gray-200 cursor-wait';
|
||||
|
||||
const sizeStyles = {
|
||||
small: iconOnly ? 'p-2 text-sm' : 'px-3 py-1.5 text-sm',
|
||||
medium: iconOnly ? 'p-2.5 text-base' : 'px-4 py-2 text-base',
|
||||
large: iconOnly ? 'p-3 text-lg' : 'px-6 py-3 text-lg',
|
||||
};
|
||||
|
||||
const currentStyles = disabled
|
||||
? disabledStyles
|
||||
: loading
|
||||
? loadingStyles
|
||||
: enabledStyles;
|
||||
|
||||
return (
|
||||
<button
|
||||
className={`${baseStyles} ${sizeStyles[size]} ${currentStyles} ${className || 'bg-gray-500 '}`}
|
||||
disabled={disabled || loading}
|
||||
{...props}
|
||||
>
|
||||
{loading ? (
|
||||
<svg
|
||||
className="animate-spin -ml-1 mr-3 h-5 w-5 text-primary"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<circle
|
||||
className="opacity-25"
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="10"
|
||||
stroke="currentColor"
|
||||
strokeWidth="4"
|
||||
></circle>
|
||||
<path
|
||||
className="opacity-75"
|
||||
fill="currentColor"
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l2-2.647z"
|
||||
></path>
|
||||
</svg>
|
||||
) : null}
|
||||
{children && !iconOnly ? children : null}
|
||||
{endIcon && !loading && !iconOnly ? (
|
||||
<span className="ml-2">{endIcon}</span>
|
||||
) : null}
|
||||
{iconOnly && endIcon && !loading ? endIcon : null}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
export default Button;
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { Config } from 'tailwindcss';
|
||||
|
||||
const config: Config = {
|
||||
darkMode: ['class', 'string'],
|
||||
content: [
|
||||
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
],
|
||||
theme: {
|
||||
// Move your custom colors directly here to override default Tailwind colors
|
||||
extend: {
|
||||
colors: {
|
||||
// Custom colors
|
||||
primary: {
|
||||
light: '#6366F1',
|
||||
DEFAULT: '#6366F1',
|
||||
dark: '#FA003F',
|
||||
},
|
||||
secondary: {
|
||||
light: '#A78BFA',
|
||||
DEFAULT: '#8B5CF6',
|
||||
dark: '#7C3AED',
|
||||
},
|
||||
textColorLight: {
|
||||
light: '#FFFFFF',
|
||||
DEFAULT: '#FFFFFF',
|
||||
dark: '#FA003F',
|
||||
},
|
||||
textColorGray: {
|
||||
light: '#222222',
|
||||
DEFAULT: '#222222',
|
||||
dark: '#FA003F',
|
||||
},
|
||||
bgPrimary: {
|
||||
light: '#FFFFFF',
|
||||
DEFAULT: '#FFFFFF',
|
||||
dark: '#FA003F',
|
||||
},
|
||||
gray: {
|
||||
light: {
|
||||
100: '#EBEBEB',
|
||||
200: '#F5F5F5',
|
||||
300: '#81848A',
|
||||
400: '#777',
|
||||
500: '#222',
|
||||
},
|
||||
dark: {
|
||||
100: '#EBEBEB',
|
||||
200: '#F5F5F5',
|
||||
300: '#81848A',
|
||||
400: '#777',
|
||||
500: '#222',
|
||||
},
|
||||
},
|
||||
},
|
||||
backgroundImage: {
|
||||
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
|
||||
'gradient-conic':
|
||||
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
|
||||
},
|
||||
// Any other extensions go here
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
};
|
||||
|
||||
export default config;
|
||||
+1
-1
@@ -22,6 +22,6 @@
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "tailwind.config.js"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user