text
stringlengths 21
253k
| id
stringlengths 25
123
| metadata
dict | __index_level_0__
int64 0
181
|
---|---|---|---|
import { Background } from "@/app/(web)/_components/background";
import { WebFooter } from "@/app/(web)/_components/footer";
import { WebHeader } from "@/app/(web)/_components/header";
type WebLayoutProps = {
children: React.ReactNode;
};
export default function WebLayout({ children }: WebLayoutProps) {
return (
<div>
<Background>
<WebHeader />
{children}
<WebFooter />
</Background>
</div>
);
}
| alifarooq9/rapidlaunch/starterkits/saas/src/app/(web)/layout.tsx | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/(web)/layout.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 223
} | 18 |
import { siteConfig } from "@/config/site";
export const signupPageConfig = {
title: "Signup",
description: `Signup to ${siteConfig.name} to get started building your next project.`,
} as const;
| alifarooq9/rapidlaunch/starterkits/saas/src/app/auth/signup/_constants/page-config.ts | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/auth/signup/_constants/page-config.ts",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 63
} | 19 |
export const waitlistPageConfig = {
title: "Join the waitlist",
description:
"Welcome to Rapidlaunch, a platform which provides resources for building applications faster. We're currently working on adding more features and improving the user experience. In the meantime, you can join our waitlist!",
} as const;
| alifarooq9/rapidlaunch/starterkits/saas/src/app/waitlist/_constants/page-config.ts | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/waitlist/_constants/page-config.ts",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 81
} | 20 |
"use client";
import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { Cross2Icon } from "@radix-ui/react-icons";
import { cn } from "@/lib/utils";
const Dialog = DialogPrimitive.Root;
const DialogTrigger = DialogPrimitive.Trigger;
const DialogPortal = DialogPrimitive.Portal;
const DialogClose = DialogPrimitive.Close;
const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
ref={ref}
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className,
)}
{...props}
/>
));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className,
)}
{...props}
>
{children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<Cross2Icon className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
));
DialogContent.displayName = DialogPrimitive.Content.displayName;
const DialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-left",
className,
)}
{...props}
/>
);
DialogHeader.displayName = "DialogHeader";
const DialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
className,
)}
{...props}
/>
);
DialogFooter.displayName = "DialogFooter";
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className,
)}
{...props}
/>
));
DialogTitle.displayName = DialogPrimitive.Title.displayName;
const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
));
DialogDescription.displayName = DialogPrimitive.Description.displayName;
export {
Dialog,
DialogPortal,
DialogOverlay,
DialogTrigger,
DialogClose,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
};
| alifarooq9/rapidlaunch/starterkits/saas/src/components/ui/dialog.tsx | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/components/ui/dialog.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 1732
} | 21 |
"use client";
import * as React from "react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import {
getCoreRowModel,
getFacetedRowModel,
getFacetedUniqueValues,
getFilteredRowModel,
getPaginationRowModel,
getSortedRowModel,
useReactTable,
type ColumnDef,
type ColumnFiltersState,
type PaginationState,
type SortingState,
type VisibilityState,
} from "@tanstack/react-table";
import { z } from "zod";
import { useDebounce } from "@/hooks/use-debounce";
import type {
DataTableFilterableColumn,
DataTableSearchableColumn,
} from "@/types/data-table";
interface UseDataTableProps<TData, TValue> {
/**
* The data for the table.
* @default []
* @type TData[]
*/
data: TData[];
/**
* The columns of the table.
* @default []
* @type ColumnDef<TData, TValue>[]
*/
columns: ColumnDef<TData, TValue>[];
/**
* The number of pages in the table.
* @type number
*/
pageCount: number;
/**
* The searchable columns of the table.
* @default []
* @type {id: keyof TData, title: string}[]
* @example searchableColumns={[{ id: "title", title: "titles" }]}
*/
searchableColumns?: DataTableSearchableColumn<TData>[];
/**
* The filterable columns of the table. When provided, renders dynamic faceted filters, and the advancedFilter prop is ignored.
* @default []
* @type {id: keyof TData, title: string, options: { label: string, value: string, icon?: React.ComponentType<{ className?: string }> }[]}[]
* @example filterableColumns={[{ id: "status", title: "Status", options: ["todo", "in-progress", "done", "canceled"]}]}
*/
filterableColumns?: DataTableFilterableColumn<TData>[];
}
const schema = z.object({
page: z.coerce.number().default(1),
per_page: z.coerce.number().default(10),
sort: z.string().optional(),
});
export function useDataTable<TData, TValue>({
data,
columns,
pageCount,
searchableColumns = [],
filterableColumns = [],
}: UseDataTableProps<TData, TValue>) {
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
// Search params
const { page, per_page, sort } = schema.parse(
Object.fromEntries(searchParams),
);
const [column, order] = sort?.split(".") ?? [];
// Create query string
const createQueryString = React.useCallback(
(params: Record<string, string | number | null>) => {
const newSearchParams = new URLSearchParams(
searchParams?.toString(),
);
for (const [key, value] of Object.entries(params)) {
if (value === null) {
newSearchParams.delete(key);
} else {
newSearchParams.set(key, String(value));
}
}
return newSearchParams.toString();
},
[searchParams],
);
// Initial column filters
const initialColumnFilters: ColumnFiltersState = React.useMemo(() => {
return Array.from(searchParams.entries()).reduce<ColumnFiltersState>(
(filters, [key, value]) => {
const filterableColumn = filterableColumns.find(
(column) => column.id === key,
);
const searchableColumn = searchableColumns.find(
(column) => column.id === key,
);
if (filterableColumn) {
filters.push({
id: key,
value: value.split("."),
});
} else if (searchableColumn) {
filters.push({
id: key,
value: [value],
});
}
return filters;
},
[],
);
}, [filterableColumns, searchableColumns, searchParams]);
// Table states
const [rowSelection, setRowSelection] = React.useState({});
const [columnVisibility, setColumnVisibility] =
React.useState<VisibilityState>({});
const [columnFilters, setColumnFilters] =
React.useState<ColumnFiltersState>(initialColumnFilters);
// Handle server-side pagination
const [{ pageIndex, pageSize }, setPagination] =
React.useState<PaginationState>({
pageIndex: page - 1,
pageSize: per_page,
});
const pagination = React.useMemo(
() => ({
pageIndex,
pageSize,
}),
[pageIndex, pageSize],
);
React.useEffect(() => {
router.push(
`${pathname}?${createQueryString({
page: pageIndex + 1,
per_page: pageSize,
})}`,
{
scroll: false,
},
);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pageIndex, pageSize]);
// Handle server-side sorting
const [sorting, setSorting] = React.useState<SortingState>([
{
id: column ?? "",
desc: order === "desc",
},
]);
React.useEffect(() => {
router.push(
`${pathname}?${createQueryString({
page,
sort: sorting[0]?.id
? `${sorting[0]?.id}.${sorting[0]?.desc ? "desc" : "asc"}`
: null,
})}`,
);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [sorting]);
// Handle server-side filtering
const debouncedSearchableColumnFilters = JSON.parse(
useDebounce(
JSON.stringify(
columnFilters.filter((filter) => {
return searchableColumns.find(
(column) => column.id === filter.id,
);
}),
),
300,
),
) as ColumnFiltersState;
const filterableColumnFilters = columnFilters.filter((filter) => {
return filterableColumns.find((column) => column.id === filter.id);
});
const [mounted, setMounted] = React.useState(false);
React.useEffect(() => {
// Prevent resetting the page on initial render
if (!mounted) {
setMounted(true);
return;
}
// Initialize new params
const newParamsObject = {
page: 1,
};
// Handle debounced searchable column filters
for (const column of debouncedSearchableColumnFilters) {
if (typeof column.value === "string") {
Object.assign(newParamsObject, {
[column.id]:
typeof column.value === "string" ? column.value : null,
});
}
}
// Handle filterable column filters
for (const column of filterableColumnFilters) {
if (
typeof column.value === "object" &&
Array.isArray(column.value)
) {
Object.assign(newParamsObject, {
[column.id]: column.value.join("."),
});
}
}
// Remove deleted values
for (const key of searchParams.keys()) {
if (
(searchableColumns.find((column) => column.id === key) &&
!debouncedSearchableColumnFilters.find(
(column) => column.id === key,
)) ??
(filterableColumns.find((column) => column.id === key) &&
!filterableColumnFilters.find(
(column) => column.id === key,
))
) {
Object.assign(newParamsObject, { [key]: null });
}
}
// After cumulating all the changes, push new params
router.push(`${pathname}?${createQueryString(newParamsObject)}`);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
// eslint-disable-next-line react-hooks/exhaustive-deps
JSON.stringify(debouncedSearchableColumnFilters),
// eslint-disable-next-line react-hooks/exhaustive-deps
JSON.stringify(filterableColumnFilters),
]);
const table = useReactTable({
data,
columns,
pageCount: pageCount ?? -1,
state: {
pagination,
sorting,
columnVisibility,
rowSelection,
columnFilters,
},
enableRowSelection: true,
onRowSelectionChange: setRowSelection,
onPaginationChange: setPagination,
onSortingChange: setSorting,
onColumnFiltersChange: setColumnFilters,
onColumnVisibilityChange: setColumnVisibility,
getCoreRowModel: getCoreRowModel(),
getFilteredRowModel: getFilteredRowModel(),
getPaginationRowModel: getPaginationRowModel(),
getSortedRowModel: getSortedRowModel(),
getFacetedRowModel: getFacetedRowModel(),
getFacetedUniqueValues: getFacetedUniqueValues(),
manualPagination: true,
manualSorting: true,
manualFiltering: true,
});
return { table };
}
| alifarooq9/rapidlaunch/starterkits/saas/src/hooks/use-data-table.ts | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/hooks/use-data-table.ts",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 4451
} | 22 |
import { db } from "@/server/db";
import { waitlistUsers } from "@/server/db/schema";
import { adminProcedure } from "@/server/procedures";
import { asc, count, desc, ilike, or } from "drizzle-orm";
import { unstable_noStore as noStore } from "next/cache";
import { z } from "zod";
const panginatedWaitlistPropsSchema = z.object({
page: z.coerce.number().default(1),
per_page: z.coerce.number().default(10),
sort: z.string().optional(),
email: z.string().optional(),
operator: z.string().optional(),
});
type GetPaginatedWaitlistQueryProps = z.infer<
typeof panginatedWaitlistPropsSchema
>;
export async function getPaginatedWaitlistQuery(
input: GetPaginatedWaitlistQueryProps,
) {
noStore();
await adminProcedure();
const offset = (input.page - 1) * input.per_page;
const [column, order] = (input.sort?.split(".") as [
keyof typeof waitlistUsers.$inferSelect | undefined,
"asc" | "desc" | undefined,
]) ?? ["title", "desc"];
const { data, total } = await db.transaction(async (tx) => {
const data = await tx
.select()
.from(waitlistUsers)
.offset(offset)
.limit(input.per_page)
.where(
or(
input.email
? ilike(waitlistUsers.email, `%${input.email}%`)
: undefined,
),
)
.orderBy(
column && column in waitlistUsers
? order === "asc"
? asc(waitlistUsers[column])
: desc(waitlistUsers[column])
: desc(waitlistUsers.createdAt),
)
.execute();
const total = await tx
.select({
count: count(),
})
.from(waitlistUsers)
.where(
or(
input.email
? ilike(waitlistUsers.email, `%${input.email}%`)
: undefined,
),
)
.execute()
.then((res) => res[0]?.count ?? 0);
return { data, total };
});
const pageCount = Math.ceil(total / input.per_page);
return { data, pageCount, total };
}
export async function getAllWaitlistUsersQuery() {
noStore();
await adminProcedure();
const data = await db
.select()
.from(waitlistUsers)
.orderBy(desc(waitlistUsers.createdAt))
.execute();
return data;
}
| alifarooq9/rapidlaunch/starterkits/saas/src/server/actions/waitlist/query.ts | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/server/actions/waitlist/query.ts",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 1264
} | 23 |
NEXT_PUBLIC_SUPABASE_URL=https://********************.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=****************************************************************************************************************************************************************************************************************
NEXT_PUBLIC_OPENAI_API_KEY=sk-************************************************
NEXT_PUBLIC_OPENAI_ASSISTANT_KEY=asst_************************
# Update these with your Supabase details from your project settings > API
SUPABASE_SERVICE_ROLE_KEY=***************************************************************************************************************************************************************************************************************************
# Update these with your Stripe credentials from https://dashboard.stripe.com/apikeys
# NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_***************************************************************************************************
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_***************************************************************************************************
# STRIPE_SECRET_KEY=sk_live_***************************************************************************************************
STRIPE_SECRET_KEY=sk_test_***************************************************************************************************
# The commented variable is usually for production webhook key. This you get in the Stripe dashboard and is usually shorter.
# STRIPE_WEBHOOK_SECRET=whsec_********************************
STRIPE_WEBHOOK_SECRET=whsec_****************************************************************
# Update this with your stable site URL only for the production environment.
# NEXT_PUBLIC_SITE_URL=https://horizon-ui.com/shadcn-nextjs-boilerplate
# NEXT_PUBLIC_SITE_URL=https://******************.com
NEXT_PUBLIC_AWS_S3_REGION=eu-north-1
NEXT_PUBLIC_AWS_S3_ACCESS_KEY_ID=********************
NEXT_PUBLIC_AWS_S3_SECRET_ACCESS_KEY=****************************************
NEXT_PUBLIC_AWS_S3_BUCKET_NAME=mybucket | horizon-ui/shadcn-nextjs-boilerplate/.env.local.example | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/.env.local.example",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 468
} | 24 |
import SupabaseProvider from './supabase-provider';
import { PropsWithChildren } from 'react';
import '@/styles/globals.css';
import { ThemeProvider } from './theme-provider';
export const dynamic = 'force-dynamic';
export default function RootLayout({
// Layouts must accept a children prop.
// This will be populated with nested layouts or pages
children
}: PropsWithChildren) {
return (
<html lang="en">
<head>
<title>
Horizon UI Boilerplate - Launch your startup project 10X in a few
moments - The best NextJS Boilerplate (This is an example)
</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
{/* <!-- Social tags --> */}
<meta
name="keywords"
content="Add here your main keywords and separate them with a comma"
/>
<meta name="description" content="Add here your website description" />
{/* <!-- Schema.org markup for Google+ --> */}
<meta itemProp="name" content="Add here your website name / title" />
<meta
itemProp="description"
content="Add here your website description"
/>
<meta
itemProp="image"
content="Add here the link for your website SEO image"
/>
{/* <!-- Twitter Card data --> */}
<meta name="twitter:card" content="product" />
<meta
name="twitter:title"
content="Add here your website name / title"
/>
<meta
name="twitter:description"
content="Add here your website description"
/>
<meta
name="twitter:image"
content="Add here the link for your website SEO image"
/>
{/* <!-- Open Graph data --> */}
<meta
property="og:title"
content="Add here your website name / title"
/>
<meta property="og:type" content="product" />
<meta property="og:url" content="https://your-website.com" />
<meta
property="og:image"
content="Add here the link for your website SEO image"
/>
<meta
property="og:description"
content="Add here your website description"
/>
<meta
property="og:site_name"
content="Add here your website name / title"
/>
<link rel="canonical" href="https://your-website.com" />
<link rel="icon" href="/img/favicon.ico" />
</head>
<body id={'root'} className="loading bg-white">
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<SupabaseProvider>
<main id="skip">{children}</main>
</SupabaseProvider>
</ThemeProvider>
</body>
</html>
);
}
| horizon-ui/shadcn-nextjs-boilerplate/app/layout.tsx | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/app/layout.tsx",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 1173
} | 25 |
'use client';
import PasswordSignIn from '@/components/auth-ui/PasswordSignIn';
import EmailSignIn from '@/components/auth-ui/EmailSignIn';
import Separator from '@/components/auth-ui/Separator';
import OauthSignIn from '@/components/auth-ui/OauthSignIn';
import ForgotPassword from '@/components/auth-ui/ForgotPassword';
import UpdatePassword from '@/components/auth-ui/UpdatePassword';
import SignUp from '@/components/auth-ui/Signup';
export default function AuthUI(props: any) {
return (
<div className="my-auto mb-auto mt-8 flex flex-col md:mt-[70px] md:max-w-full lg:mt-[130px] lg:max-w-[420px]">
<p className="text-[32px] font-bold text-zinc-950 dark:text-white">
{props.viewProp === 'signup'
? 'Sign Up'
: props.viewProp === 'forgot_password'
? 'Forgot Password'
: props.viewProp === 'update_password'
? 'Update Password'
: props.viewProp === 'email_signin'
? 'Email Sign In'
: 'Sign In'}
</p>
<p className="mb-2.5 mt-2.5 font-normal text-zinc-950 dark:text-zinc-400">
{props.viewProp === 'signup'
? 'Enter your email and password to sign up!'
: props.viewProp === 'forgot_password'
? 'Enter your email to get a passoword reset link!'
: props.viewProp === 'update_password'
? 'Choose a new password for your account!'
: props.viewProp === 'email_signin'
? 'Enter your email to get a magic link!'
: 'Enter your email and password to sign in!'}
</p>
{props.viewProp !== 'update_password' &&
props.viewProp !== 'signup' &&
props.allowOauth && (
<>
<OauthSignIn />
<Separator />
</>
)}
{props.viewProp === 'password_signin' && (
<PasswordSignIn
allowEmail={props.allowEmail}
redirectMethod={props.redirectMethod}
/>
)}
{props.viewProp === 'email_signin' && (
<EmailSignIn
allowPassword={props.allowPassword}
redirectMethod={props.redirectMethod}
disableButton={props.disableButton}
/>
)}
{props.viewProp === 'forgot_password' && (
<ForgotPassword
allowEmail={props.allowEmail}
redirectMethod={props.redirectMethod}
disableButton={props.disableButton}
/>
)}
{props.viewProp === 'update_password' && (
<UpdatePassword redirectMethod={props.redirectMethod} />
)}
{props.viewProp === 'signup' && (
<SignUp
allowEmail={props.allowEmail}
redirectMethod={props.redirectMethod}
/>
)}
</div>
);
}
| horizon-ui/shadcn-nextjs-boilerplate/components/auth/AuthUI.tsx | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/components/auth/AuthUI.tsx",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 1236
} | 26 |
'use client';
/* eslint-disable */
import AdminNavbarLinks from './NavbarLinksAdmin';
import NavLink from '@/components/link/NavLink';
export default function AdminNavbar(props: {
brandText: string;
[x: string]: any;
}) {
const { brandText } = props;
return (
<nav
className={`fixed right-3 top-3 z-[0] flex w-[calc(100vw_-_6%)] flex-row items-center justify-between rounded-lg bg-white/30 py-2 backdrop-blur-xl transition-all dark:bg-transparent md:right-[30px] md:top-4 md:w-[calc(100vw_-_8%)] md:p-2 lg:w-[calc(100vw_-_6%)] xl:top-[20px] xl:w-[calc(100vw_-_365px)] 2xl:w-[calc(100vw_-_380px)]`}
>
<div className="ml-[6px]">
<div className="h-6 md:mb-2 md:w-[224px] md:pt-1">
<a
className="hidden text-xs font-normal text-zinc-950 hover:underline dark:text-white dark:hover:text-white md:inline"
href=""
>
Pages
<span className="mx-1 text-xs text-zinc-950 hover:text-zinc-950 dark:text-white">
{' '}
/{' '}
</span>
</a>
<NavLink
className="text-xs font-normal capitalize text-zinc-950 hover:underline dark:text-white dark:hover:text-white"
href="#"
>
{brandText}
</NavLink>
</div>
<p className="text-md shrink capitalize text-zinc-950 dark:text-white md:text-3xl">
<NavLink
href="#"
className="font-bold capitalize hover:text-zinc-950 dark:hover:text-white"
>
{brandText}
</NavLink>
</p>
</div>
<div className="w-[154px] min-w-max md:ml-auto md:w-[unset]">
<AdminNavbarLinks />
</div>
</nav>
);
}
| horizon-ui/shadcn-nextjs-boilerplate/components/navbar/NavbarAdmin.tsx | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/components/navbar/NavbarAdmin.tsx",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 872
} | 27 |
import Stripe from 'stripe';
import { ComponentType, ReactNode } from 'react';
export type OpenAIModel =
| 'gpt-3.5-turbo'
| 'gpt-4'
| 'gpt-4-1106-preview'
| 'gpt-4o';
export interface TranslateBody {
// inputLanguage: string;
// outputLanguage: string;
topic: string;
paragraphs: string;
essayType: string;
model: OpenAIModel;
type?: 'review' | 'refactor' | 'complexity' | 'normal';
}
export interface ChatBody {
inputMessage: string;
model: OpenAIModel;
apiKey?: string | undefined | null;
}
export interface TranslateResponse {
code: string;
}
export interface PageMeta {
title: string;
description: string;
cardImage: string;
}
export interface Customer {
id: string /* primary key */;
stripe_customer_id?: string;
}
export interface Product {
id: string /* primary key */;
active?: boolean;
name?: string;
description?: string;
image?: string;
metadata?: Stripe.Metadata;
}
export interface ProductWithPrice extends Product {
prices?: Price[];
}
export interface UserDetails {
id: string /* primary key */;
first_name: string;
last_name: string;
full_name?: string;
avatar_url?: string;
billing_address?: Stripe.Address;
payment_method?: Stripe.PaymentMethod[Stripe.PaymentMethod.Type];
}
export interface Price {
id: string /* primary key */;
product_id?: string /* foreign key to products.id */;
active?: boolean;
description?: string;
unit_amount?: number;
currency?: string;
type?: Stripe.Price.Type;
interval?: Stripe.Price.Recurring.Interval;
interval_count?: number;
trial_period_days?: number | null;
metadata?: Stripe.Metadata;
products?: Product;
}
export interface PriceWithProduct extends Price {}
export interface Subscription {
id: string /* primary key */;
user_id: string;
status?: Stripe.Subscription.Status;
metadata?: Stripe.Metadata;
price_id?: string /* foreign key to prices.id */;
quantity?: number;
cancel_at_period_end?: boolean;
created: string;
current_period_start: string;
current_period_end: string;
ended_at?: string;
cancel_at?: string;
canceled_at?: string;
trial_start?: string;
trial_end?: string;
prices?: Price;
}
export interface IRoute {
path: string;
name: string;
layout?: string;
exact?: boolean;
component?: ComponentType;
disabled?: boolean;
icon?: JSX.Element;
secondary?: boolean;
collapse?: boolean;
items?: IRoute[];
rightElement?: boolean;
invisible?: boolean;
}
export interface EssayBody {
topic: string;
words: '300' | '200';
essayType: '' | 'Argumentative' | 'Classic' | 'Persuasive' | 'Critique';
model: OpenAIModel;
apiKey?: string | undefined;
}
export interface PremiumEssayBody {
words: string;
topic: string;
essayType:
| ''
| 'Argumentative'
| 'Classic'
| 'Persuasive'
| 'Memoir'
| 'Critique'
| 'Compare/Contrast'
| 'Narrative'
| 'Descriptive'
| 'Expository'
| 'Cause and Effect'
| 'Reflective'
| 'Informative';
tone: string;
citation: string;
level: string;
model: OpenAIModel;
apiKey?: string | undefined;
}
| horizon-ui/shadcn-nextjs-boilerplate/types/types.ts | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/types/types.ts",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 1054
} | 28 |
import { createBrowserClient } from '@supabase/ssr';
export function createClient() {
return createBrowserClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
);
}
| horizon-ui/shadcn-nextjs-boilerplate/utils/supabase/client.ts | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/utils/supabase/client.ts",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 81
} | 29 |
import { SignIn } from '@clerk/nextjs';
import { getTranslations } from 'next-intl/server';
import { getI18nPath } from '@/utils/Helpers';
export async function generateMetadata(props: { params: { locale: string } }) {
const t = await getTranslations({
locale: props.params.locale,
namespace: 'SignIn',
});
return {
title: t('meta_title'),
description: t('meta_description'),
};
}
const SignInPage = (props: { params: { locale: string } }) => (
<SignIn path={getI18nPath('/sign-in', props.params.locale)} />
);
export default SignInPage;
| ixartz/SaaS-Boilerplate/src/app/[locale]/(auth)/(center)/sign-in/[[...sign-in]]/page.tsx | {
"file_path": "ixartz/SaaS-Boilerplate/src/app/[locale]/(auth)/(center)/sign-in/[[...sign-in]]/page.tsx",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 199
} | 30 |
export const DemoBadge = () => (
<div className="fixed bottom-0 right-20 z-10">
<a
href="https://react-saas.com"
>
<div className="rounded-md bg-gray-900 px-3 py-2 font-semibold text-gray-100">
<span className="text-gray-500">Demo of</span>
{' SaaS Boilerplate'}
</div>
</a>
</div>
);
| ixartz/SaaS-Boilerplate/src/components/DemoBadge.tsx | {
"file_path": "ixartz/SaaS-Boilerplate/src/components/DemoBadge.tsx",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 160
} | 31 |
import React from 'react';
import { type FieldPath, type FieldValues, useFormContext } from 'react-hook-form';
type FormFieldContextValue<
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
> = {
name: TName;
};
export const FormFieldContext = React.createContext<FormFieldContextValue>(
{} as FormFieldContextValue,
);
type FormItemContextValue = {
id: string;
};
export const FormItemContext = React.createContext<FormItemContextValue>(
{} as FormItemContextValue,
);
export const useFormField = () => {
const fieldContext = React.useContext(FormFieldContext);
const itemContext = React.useContext(FormItemContext);
const { getFieldState, formState } = useFormContext();
const fieldState = getFieldState(fieldContext.name, formState);
if (!fieldContext) {
throw new Error('useFormField should be used within <FormField>');
}
const { id } = itemContext;
return {
id,
name: fieldContext.name,
formItemId: `${id}-form-item`,
formDescriptionId: `${id}-form-item-description`,
formMessageId: `${id}-form-item-message`,
...fieldState,
};
};
| ixartz/SaaS-Boilerplate/src/components/ui/useFormField.ts | {
"file_path": "ixartz/SaaS-Boilerplate/src/components/ui/useFormField.ts",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 363
} | 32 |
import { cn } from '@/utils/Helpers';
export const Section = (props: {
children: React.ReactNode;
title?: string;
subtitle?: string;
description?: string;
className?: string;
}) => (
<div className={cn('px-3 py-16', props.className)}>
{(props.title || props.subtitle || props.description) && (
<div className="mx-auto mb-12 max-w-screen-md text-center">
{props.subtitle && (
<div className="bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 bg-clip-text text-sm font-bold text-transparent">
{props.subtitle}
</div>
)}
{props.title && (
<div className="mt-1 text-3xl font-bold">{props.title}</div>
)}
{props.description && (
<div className="mt-2 text-lg text-muted-foreground">
{props.description}
</div>
)}
</div>
)}
<div className="mx-auto max-w-screen-lg">{props.children}</div>
</div>
);
| ixartz/SaaS-Boilerplate/src/features/landing/Section.tsx | {
"file_path": "ixartz/SaaS-Boilerplate/src/features/landing/Section.tsx",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 452
} | 33 |
import Link from 'next/link';
import { StickyBanner } from '@/features/landing/StickyBanner';
export const DemoBanner = () => (
<StickyBanner>
Live Demo of SaaS Boilerplate -
{' '}
<Link href="/sign-up">Explore the User Dashboard</Link>
</StickyBanner>
);
| ixartz/SaaS-Boilerplate/src/templates/DemoBanner.tsx | {
"file_path": "ixartz/SaaS-Boilerplate/src/templates/DemoBanner.tsx",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 103
} | 34 |
/* eslint-disable ts/no-require-imports */
import type { Config } from 'tailwindcss';
const config = {
darkMode: ['class'],
content: ['./src/**/*.{js,ts,jsx,tsx}'],
prefix: '',
theme: {
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')],
} satisfies Config;
export default config;
| ixartz/SaaS-Boilerplate/tailwind.config.ts | {
"file_path": "ixartz/SaaS-Boilerplate/tailwind.config.ts",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 1045
} | 35 |
import { eventHandler, setResponseHeader, defaultContentType } from 'h3';
import { renderToString, renderToStaticMarkup } from 'react-dom/server';
import { createElement } from 'react';
import SvgPreview from '../../lib/SvgPreview/index.tsx';
import iconNodes from '../../data/iconNodes';
import createLucideIcon from 'lucide-react/src/createLucideIcon';
import Backdrop from '../../lib/SvgPreview/Backdrop.tsx';
export default eventHandler((event) => {
const { params } = event.context;
const pathData = params.data.split('/');
const data = pathData.at(-1).slice(0, -4);
const [name] = pathData;
const src = Buffer.from(data, 'base64')
.toString('utf8')
.replaceAll('\n', '')
.replace(/<svg[^>]*>|<\/svg>/g, '');
const children = [];
// Finds the longest matching icon to be use as the backdrop.
// For `square-dashed-bottom-code` it suggests `square-dashed-bottom-code`.
// For `square-dashed-bottom-i-dont-exist` it suggests `square-dashed-bottom`.
const backdropName = name
.split('-')
.map((_, idx, arr) => arr.slice(0, idx + 1).join('-'))
.reverse()
.find((groupName) => groupName in iconNodes);
if (!(name in iconNodes) && backdropName) {
const iconNode = iconNodes[backdropName];
const LucideIcon = createLucideIcon(backdropName, iconNode);
const svg = renderToStaticMarkup(createElement(LucideIcon));
const backdropString = svg.replaceAll('\n', '').replace(/<svg[^>]*>|<\/svg>/g, '');
children.push(
createElement(Backdrop, {
backdropString,
src,
color: '#777',
}),
);
}
const svg = Buffer.from(
// We can't use jsx here, is not supported here by nitro.
renderToString(createElement(SvgPreview, { src, showGrid: true }, children)),
).toString('utf8');
defaultContentType(event, 'image/svg+xml');
setResponseHeader(event, 'Cache-Control', 'public,max-age=31536000');
return svg;
});
| lucide-icons/lucide/docs/.vitepress/api/gh-icon/[...data].get.ts | {
"file_path": "lucide-icons/lucide/docs/.vitepress/api/gh-icon/[...data].get.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 705
} | 36 |
import React from 'react';
interface BackdropProps {
src: string;
color?: string;
outline?: boolean;
backdropString: string;
}
const Backdrop = ({
src,
color = 'red',
outline = true,
backdropString,
}: BackdropProps): JSX.Element => {
const id = React.useId();
return (
<>
<defs xmlns="http://www.w3.org/2000/svg">
<pattern
id={`pattern-${id}`}
width=".1"
height=".1"
patternUnits="userSpaceOnUse"
patternTransform="rotate(45 50 50)"
>
<line
stroke={color}
strokeWidth={0.1}
y2={1}
/>
<line
stroke={color}
strokeWidth={0.1}
y2={1}
/>
</pattern>
</defs>
<mask
id={`svg-preview-backdrop-mask-${id}`}
maskUnits="userSpaceOnUse"
>
<g
stroke="#fff"
dangerouslySetInnerHTML={{ __html: backdropString }}
/>
<g dangerouslySetInnerHTML={{ __html: src }} />
</mask>
<mask
id={`svg-preview-backdrop-mask-outline-${id}`}
maskUnits="userSpaceOnUse"
>
<rect
x="0"
y="0"
width="24"
height="24"
fill="#fff"
stroke="none"
/>
<g
strokeWidth={1.75}
dangerouslySetInnerHTML={{ __html: backdropString }}
/>
</mask>
<g mask={`url(#svg-preview-backdrop-mask-${id})`}>
<rect
x="0"
y="0"
width="24"
height="24"
opacity={0.5}
fill={`url(#pattern-${id})`}
stroke="none"
/>
<g
stroke={color}
strokeWidth={2.25}
opacity={0.75}
dangerouslySetInnerHTML={{ __html: src }}
/>
{outline && (
<g
stroke={color}
strokeWidth={2.25}
opacity={0.75}
mask={`url(#svg-preview-backdrop-mask-outline-${id})`}
dangerouslySetInnerHTML={{ __html: backdropString }}
/>
)}
</g>
</>
);
};
export default Backdrop;
| lucide-icons/lucide/docs/.vitepress/lib/SvgPreview/Backdrop.tsx | {
"file_path": "lucide-icons/lucide/docs/.vitepress/lib/SvgPreview/Backdrop.tsx",
"repo_id": "lucide-icons/lucide",
"token_count": 1224
} | 37 |
:root {
--vp-c-brand: #f56565;
--vp-c-brand-light: #f67373;
--vp-c-brand-lighter: #f89191;
--vp-c-brand-dark: #dc5a5a;
--vp-c-brand-darker: #c45050;
--vp-c-brand-1: #f67373;
--vp-c-brand-2: #ff7070;
--vp-c-brand-3: #f56565;
--vp-c-brand-4: #dc5a5a;
--vp-c-brand-5: #c45050;
--vp-c-bg-alt-up: #fff;
--vp-c-bg-alt-down: #fff;
--vp-code-editor-plain: #24292e;
--vp-code-editor-comment: #6a737d;
--vp-code-editor-keyword: #d73a49;
--vp-code-editor-tag: #22863a;
--vp-code-editor-punctuation: #24292e;
--vp-code-editor-definition: #6f42c1;
--vp-code-editor-property: #005cc5;
--vp-code-editor-static: #f78c6c;
--vp-code-editor-string: #032f62;
--vp-c-text-4: rgba(60, 60, 67, 0.32);
}
.dark {
--vp-c-bg-alt-up: #1b1b1d;
--vp-c-bg-alt-down: #0f0f10;
--vp-code-editor-plain: #e1e4e8;
--vp-code-editor-comment: #6a737d;
--vp-code-editor-keyword: #f97583;
--vp-code-editor-tag: #85e89d;
--vp-code-editor-punctuation: #9ecbff;
--vp-code-editor-definition: #b392f0;
--vp-code-editor-property: #79b8ff;
--vp-code-editor-static: #f78c6c;
--vp-code-editor-string: #9ecbff;
--vp-c-text-4: rgba(235, 235, 245, 0.16);
}
.VPNavBarTitle .logo {
height: 36px;
width: 36px;
}
.VPNavBarTitle .title {
font-size: 21px;
}
.VPHomeHero > .container {
gap: 24px;
}
.VPHomeHero .image-container {
transform: none;
width: 100%;
/* padding: 0 24px; */
}
/* .VPHomeHero .container {
flex-direction: column-reverse;
} */
.VPHomeHero .container .main {
/* flex:1; */
flex-shirk: 0;
}
.VPHomeHero .container .main h1.name {
color: var(--vp-c-text);
}
.VPHomeHero .container .main h1.name .clip {
color: inherit;
-webkit-text-fill-color: unset;
color: var(--vp-c-text);
font-size: 36px;
}
.VPHomeHero .container .main h1::first-line {
color: var(--vp-c-brand);
}
/* */
.VPHomeHero .container .image {
margin: 0;
order: 2;
/* flex: 1; */
margin-top: 32px;
}
.VPHomeHero .container .image-container {
height: auto;
justify-content: flex-end;
}
.VPHomeHero .container .image-bg {
display: none;
}
.VPFeature .icon {
background-color: var(--vp-c-bg);
}
.vp-doc[class*=' _icons_'] > div {
max-width: 100%;
}
.VPDoc:has(.vp-doc[class*=' _icons_']) > .container > .content {
padding-right: 0;
padding-left: 0;
}
@media (min-width: 640px) {
.VPHomeHero .container .main h1.name .clip {
font-size: unset;
}
}
@media (min-width: 960px) {
.VPHomeHero .container .image {
order: 1;
margin-bottom: auto;
margin-top: 0;
position: relative;
}
.VPHomeHero .container .main {
width: 50%;
}
.VPHomeHero .container .image {
width: 50%;
}
.VPHomeHero .container .image-container {
display: block;
}
.VPHomeHero .container .main h1.name {
}
}
.VPNavBarHamburger .container > span {
border-radius: 2px;
}
/*
html:has(* .outline-link:target) {
scroll-behavior: smooth;
} */
.sp-wrapper + * {
margin-top: 24px;
}
.sp-wrapper .sp-layout {
border-radius: 8px;
}
.sp-wrapper .sp-tabs-scrollable-container {
border-radius: 8px 8px 0 0;
position: relative;
box-shadow: inset 0 -1px var(--vp-code-tab-divider);
margin-bottom: 0px;
margin-top: -1px;
height: 48px;
padding-bottom: 1px;
}
.sp-wrapper .sp-preview-container {
background-color: transparent;
}
.sp-wrapper .sp-tabs .sp-tab-button {
padding: 0 12px;
line-height: 48px;
height: 48px;
font-size: 14px;
font-weight: 500;
position: relative;
/* box-sizing: content-box; */
}
.sp-wrapper .sp-tabs .sp-tab-button:after {
position: absolute;
right: 8px;
left: 8px;
bottom: 0px;
z-index: 1;
height: 1px;
content: '';
background-color: transparent;
transition: background-color 0.25s;
}
.sp-wrapper .sp-tabs .sp-tab-button[data-active='true'] {
color: var(--vp-code-tab-active-text-color);
}
.sp-wrapper .sp-tabs .sp-tab-button[data-active='true']:after {
background-color: var(--vp-code-tab-active-bar-color);
}
| lucide-icons/lucide/docs/.vitepress/theme/style.css | {
"file_path": "lucide-icons/lucide/docs/.vitepress/theme/style.css",
"repo_id": "lucide-icons/lucide",
"token_count": 1763
} | 38 |
import {
CakeSlice,
Candy,
Apple,
Cookie,
Martini,
IceCream2,
Sandwich,
Wine,
Dessert,
} from "lucide-react";
import "./icon.css";
function App() {
return (
<div className="app">
<CakeSlice />
<Candy />
<Apple />
<Cookie />
<Martini />
<IceCream2 />
<Sandwich />
<Wine />
<Dessert />
</div>
);
}
export default App;
| lucide-icons/lucide/docs/guide/advanced/examples/global-styling-css-example/App.js | {
"file_path": "lucide-icons/lucide/docs/guide/advanced/examples/global-styling-css-example/App.js",
"repo_id": "lucide-icons/lucide",
"token_count": 196
} | 39 |
import { Landmark } from "lucide-react";
function App() {
return (
<div className="app">
<Landmark size={64} />
</div>
);
}
export default App; | lucide-icons/lucide/docs/guide/basics/examples/size-icon-example/App.js | {
"file_path": "lucide-icons/lucide/docs/guide/basics/examples/size-icon-example/App.js",
"repo_id": "lucide-icons/lucide",
"token_count": 66
} | 40 |
import relatedIcons from '../.vitepress/data/relatedIcons.json';
import iconNodes from '../.vitepress/data/iconNodes';
import * as iconDetails from '../.vitepress/data/iconDetails';
import { IconEntity } from '../.vitepress/theme/types';
export default {
paths: async () => {
return (Object.values(iconDetails) as unknown as IconEntity[]).map((iconEntity) => {
const params = {
...iconEntity,
relatedIcons: relatedIcons[iconEntity.name].map((name: string) => ({
name,
iconNode: iconNodes[name],
})),
};
return {
params,
};
});
},
};
| lucide-icons/lucide/docs/icons/[name].paths.ts | {
"file_path": "lucide-icons/lucide/docs/icons/[name].paths.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 255
} | 41 |
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
id="lucide-logo"
>
<path d="M14 12C14 9.79086 12.2091 8 10 8C7.79086 8 6 9.79086 6 12C6 16.4183 9.58172 20 14 20C18.4183 20 22 16.4183 22 12C22 8.446 20.455 5.25285 18 3.05557" stroke="#2D3748" />
<path d="M10 12C10 14.2091 11.7909 16 14 16C16.2091 16 18 14.2091 18 12C18 7.58172 14.4183 4 10 4C5.58172 4 2 7.58172 2 12C2 15.5841 3.57127 18.8012 6.06253 21" stroke="#F56565" />
</svg>
| lucide-icons/lucide/docs/public/logo-icon.svg | {
"file_path": "lucide-icons/lucide/docs/public/logo-icon.svg",
"repo_id": "lucide-icons/lucide",
"token_count": 280
} | 42 |
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
| lucide-icons/lucide/docs/public/site.webmanifest | {
"file_path": "lucide-icons/lucide/docs/public/site.webmanifest",
"repo_id": "lucide-icons/lucide",
"token_count": 244
} | 43 |
export default {
xmlns: 'http://www.w3.org/2000/svg',
width: 24,
height: 24,
viewBox: '0 0 24 24',
fill: 'none',
stroke: 'currentColor',
'stroke-width': 2,
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
};
| lucide-icons/lucide/packages/lucide-angular/src/icons/constants/default-attributes.ts | {
"file_path": "lucide-icons/lucide/packages/lucide-angular/src/icons/constants/default-attributes.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 95
} | 44 |
import { IconNode } from '../src/createLucideIcon';
export const airVent: IconNode = [
[
'path',
{
d: 'M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2',
key: 'larmp2',
},
],
['path', { d: 'M6 8h12', key: '6g4wlu' }],
['path', { d: 'M18.3 17.7a2.5 2.5 0 0 1-3.16 3.83 2.53 2.53 0 0 1-1.14-2V12', key: '1bo8pg' }],
['path', { d: 'M6.6 15.6A2 2 0 1 0 10 17v-5', key: 't9h90c' }],
];
export const coffee: IconNode = [
['path', { d: 'M17 8h1a4 4 0 1 1 0 8h-1', key: 'jx4kbh' }],
['path', { d: 'M3 8h14v9a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4Z', key: '1bxrl0' }],
['line', { x1: '6', x2: '6', y1: '2', y2: '4', key: '1cr9l3' }],
['line', { x1: '10', x2: '10', y1: '2', y2: '4', key: '170wym' }],
['line', { x1: '14', x2: '14', y1: '2', y2: '4', key: '1c5f70' }],
];
| lucide-icons/lucide/packages/lucide-preact/tests/testIconNodes.ts | {
"file_path": "lucide-icons/lucide/packages/lucide-preact/tests/testIconNodes.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 473
} | 45 |
export * from './icons';
export * as icons from './icons';
export * from './aliases';
export * from './types';
export { default as createLucideIcon } from './createLucideIcon';
export { default as Icon } from './Icon';
| lucide-icons/lucide/packages/lucide-react/src/lucide-react.ts | {
"file_path": "lucide-icons/lucide/packages/lucide-react/src/lucide-react.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 66
} | 46 |
import path from 'path';
import { babel } from '@rollup/plugin-babel';
import esbuild from 'esbuild';
import plugins from '@lucide/rollup-plugins';
import ts from 'typescript';
import pkg from './package.json' assert { type: 'json' };
const packageName = 'LucideSolid';
const outputFileName = 'lucide-solid';
const outputDir = 'dist';
const inputs = ['src/lucide-solid.ts'];
const bundles = [
{
format: 'cjs',
inputs,
outputDir,
preserveModules: true,
},
{
format: 'esm',
inputs,
outputDir,
preserveModules: true,
},
];
const configs = bundles
.map(({ inputs, outputDir, format, preserveModules }) =>
inputs.map((input) => ({
input,
plugins: [
babel({
extensions: ['.ts', '.tsx', '.js', '.jsx'],
babelHelpers: 'bundled',
presets: [
'babel-preset-solid',
'@babel/preset-typescript',
['@babel/preset-env', { bugfixes: true, targets: 'last 2 years' }],
],
}),
...plugins({
pkg,
withEsbuild: false,
}),
format === 'esm'
? {
name: 'ts',
buildEnd() {
// Transpile typescript to './dist/source'
esbuild.build({
entryPoints: ['./src/**/*.tsx', './src/**/*.ts'],
outdir: './dist/source',
outExtension: {
'.js': '.jsx',
},
loader: {
'.js': 'jsx',
},
jsx: 'preserve',
jsxImportSource: 'solid-js',
bundle: true,
format: 'esm',
sourcemap: true,
target: ['esnext'],
banner: {
js: `/**
* @license ${pkg.name} v${pkg.version} - ${pkg.license}
*
* This source code is licensed under the ${pkg.license} license.
* See the LICENSE file in the root directory of this source tree.
*/`,
},
plugins: [
{
name: 'externalize-everything-except-own-dependencies',
setup(build) {
build.onResolve({ filter: /(.*)/ }, (args) => {
const modulePath = path.join(args.resolveDir, args.path);
if (
args.kind === 'import-statement' &&
args.path !== '@lucide/shared' &&
!modulePath.includes('packages/shared')
) {
return { path: args.path, external: true };
}
});
},
},
],
external: ['solid-js'],
});
// Generate types
const program = ts.createProgram([pkg.source], {
target: ts.ScriptTarget.ESNext,
module: ts.ModuleKind.ESNext,
moduleResolution: ts.ModuleResolutionKind.NodeJs,
jsx: ts.JsxEmit.Preserve,
jsxImportSource: 'solid-js',
allowSyntheticDefaultImports: true,
esModuleInterop: true,
declarationDir: `dist/types`,
declaration: true,
emitDeclarationOnly: true,
});
program.emit();
},
}
: null,
],
external: ['solid-js', 'solid-js/web', 'solid-js/store'],
output: {
name: packageName,
...(preserveModules
? {
dir: `${outputDir}/${format}`,
exports: 'auto',
}
: {
file: `${outputDir}/${format}/${outputFileName}.js`,
}),
format: format === 'source' ? 'esm' : format,
preserveModules,
preserveModulesRoot: 'src',
sourcemap: true,
},
})),
)
.flat();
export default configs;
| lucide-icons/lucide/packages/lucide-solid/rollup.config.mjs | {
"file_path": "lucide-icons/lucide/packages/lucide-solid/rollup.config.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 2329
} | 47 |
/* eslint-disable import/no-extraneous-dependencies */
import base64SVG from '@lucide/build-icons/utils/base64SVG.mjs';
import { getJSBanner } from './license.mjs';
export default ({ iconName, children, componentName, getSvg, deprecated, deprecationReason }) => {
const svgContents = getSvg();
const svgBase64 = base64SVG(svgContents);
return `\
<script lang="ts">
${getJSBanner()}
import Icon from '../Icon.svelte';
import type { IconNode, IconProps } from '../types.js';
type $$Props = IconProps;
const iconNode: IconNode = ${JSON.stringify(children)};
/**
* @component @name ${componentName}
* @description Lucide SVG icon component, renders SVG Element with children.
*
* @preview ![img](data:image/svg+xml;base64,${svgBase64}) - https://lucide.dev/icons/${iconName}
* @see https://lucide.dev/guide/packages/lucide-svelte - Documentation
*
* @param {Object} props - Lucide icons props and any valid SVG attribute
* @returns {FunctionalComponent} Svelte component
* ${deprecated ? `@deprecated ${deprecationReason}` : ''}
*/
</script>
<Icon name="${iconName}" {...$$props} iconNode={iconNode}>
<slot/>
</Icon>
`;
};
| lucide-icons/lucide/packages/lucide-svelte/scripts/exportTemplate.mjs | {
"file_path": "lucide-icons/lucide/packages/lucide-svelte/scripts/exportTemplate.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 391
} | 48 |
import { defineConfig } from 'vitest/config';
import { svelte } from '@sveltejs/vite-plugin-svelte';
export default defineConfig({
plugins: [
svelte({
hot: false,
}),
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: './tests/setupVitest.ts',
alias: [{ find: /^svelte$/, replacement: 'svelte/internal' }],
},
});
| lucide-icons/lucide/packages/lucide-svelte/vitest.config.ts | {
"file_path": "lucide-icons/lucide/packages/lucide-svelte/vitest.config.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 152
} | 49 |
import { defineConfig } from 'vitest/config';
import vue from '@vitejs/plugin-vue2';
export default defineConfig({
plugins: [vue()],
test: {
globals: true,
environment: 'jsdom',
transformMode: {
web: [/\.jsx?$/],
},
setupFiles: './tests/setupVitest.js',
threads: false,
isolate: false,
},
resolve: {
conditions: ['development', 'browser'],
},
});
| lucide-icons/lucide/packages/lucide-vue/vitest.config.ts | {
"file_path": "lucide-icons/lucide/packages/lucide-vue/vitest.config.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 160
} | 50 |
import path from 'path';
import { getCurrentDirPath, writeFileIfNotExists } from '../../tools/build-helpers/helpers.mjs';
const currentDir = getCurrentDirPath(import.meta.url);
const ICONS_DIR = path.resolve(currentDir, '../../icons');
const iconNames = process.argv.slice(2);
const iconSvgTemplate = `<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
</svg>
`;
const iconJsonTemplate = `{
"$schema": "../icon.schema.json",
"contributors": [
],
"tags": [
],
"categories": [
]
}
`;
iconNames.forEach((iconName) => {
writeFileIfNotExists(iconSvgTemplate, `${iconName}.svg`, ICONS_DIR);
writeFileIfNotExists(iconJsonTemplate, `${iconName}.json`, ICONS_DIR);
});
| lucide-icons/lucide/scripts/generate/generateIcons.mjs | {
"file_path": "lucide-icons/lucide/scripts/generate/generateIcons.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 324
} | 51 |
import fs from 'node:fs';
import path from 'path';
import simpleGit from 'simple-git';
import { Octokit } from '@octokit/rest';
import pMemoize from 'p-memoize';
const IGNORED_COMMITS = ['433bbae4f1d4abb50a26306d6679a38ace5c8b78'];
const FETCH_DEPTH = process.env.FETCH_DEPTH || 1000;
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
const git = simpleGit();
const cache = new Map();
const getUserName = pMemoize(
async (commit) => {
const { data: fetchedCommit } = await octokit.repos.getCommit({
owner: 'lucide-icons',
repo: 'lucide',
ref: commit.hash,
});
if (!fetchedCommit?.author?.login) {
console.error(`Could not find author name for ${commit.author_email}`);
}
return fetchedCommit?.author?.login;
},
{ cacheKey: ([commit]) => commit.author_email, cache },
);
// Check that a commit changes more than just the icon name
const isCommitRelevant = async (hash, file) => {
const summary = await git.diffSummary(['--diff-filter=AM', `${hash}~1`, hash]);
return summary.files.some(({ file: name }) => name === file);
};
const getContributors = async (file, includeCoAuthors) => {
const { all } = await git.log([`HEAD~${FETCH_DEPTH}..`, '--', file]);
const commits = file.endsWith('.svg')
? (
await Promise.all(all.map((commit) => isCommitRelevant(commit.hash, file) && commit))
).filter(Boolean)
: all;
const emails = new Map();
for (let i = commits.length - 1; i >= 0; i -= 1) {
const commit = commits[i];
if (!IGNORED_COMMITS.includes(commit.hash)) {
if (!emails.has(commit.author_email)) {
emails.set(commit.author_email, getUserName(commit));
}
if (includeCoAuthors) {
const matches = commit.body.matchAll(
/(^Author:|^Co-authored-by:)\s+(?<author>[^<]+)\s+<(?<email>[^>]+)>/gm,
);
// eslint-disable-next-line no-restricted-syntax
for (const match of matches) {
if (!emails.has(match.groups.email) && cache.has(match.groups.email)) {
emails.set(match.groups.email, Promise.resolve(cache.get(match.groups.email)));
}
}
}
}
}
return Promise.all(Array.from(emails.values()));
};
const files = process.env.CHANGED_FILES.split(' ')
.map((file) => file.replace('.json', '.svg'))
.filter((file, idx, arr) => arr.indexOf(file) === idx);
if (!files.every((file) => file.startsWith('icons/'))) {
console.error("file path must start with 'icons/'");
process.exit(1);
}
// get all contributors to be able to associate them when they are co authors
await getContributors('icons');
await Promise.all(
files.map(async (file) => {
const jsonFile = path.join(process.cwd(), file.replace('.svg', '.json'));
const json = JSON.parse(fs.readFileSync(jsonFile));
const { tags, categories, aliases, contributors: previousContributors, ...rest } = json;
const contributors = [
...(previousContributors || []),
...(await getContributors(file, true)),
].filter((contributor, idx, arr) => contributor && arr.indexOf(contributor) === idx);
fs.writeFileSync(
jsonFile,
JSON.stringify(
{
$schema: '../icon.schema.json',
contributors,
aliases,
tags,
categories,
...rest,
},
null,
2,
) + '\n',
);
}),
);
| lucide-icons/lucide/scripts/updateContributors.mjs | {
"file_path": "lucide-icons/lucide/scripts/updateContributors.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 1386
} | 52 |
/* eslint-disable import/prefer-default-export */
import fs from 'fs';
import path from 'path';
/**
* Reads metadata for an icon or category
*
* @param {string} fileName
* @param {string} directory
* @returns {object} The metadata for the icon or category
*/
export const readMetadata = (fileName, directory) =>
JSON.parse(fs.readFileSync(path.join(directory, fileName), 'utf-8'));
| lucide-icons/lucide/tools/build-helpers/src/readMetadata.mjs | {
"file_path": "lucide-icons/lucide/tools/build-helpers/src/readMetadata.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 120
} | 53 |
#!/usr/bin/env node
import fs from 'fs';
import path from 'path';
import getArgumentOptions from 'minimist';
import { readSvgDirectory } from '@lucide/helpers';
import renderIconsObject from './render/renderIconsObject.mjs';
import generateIconFiles from './building/generateIconFiles.mjs';
import generateExportsFile from './building/generateExportsFile.mjs';
import generateAliasesFile from './building/generateAliasesFile.mjs';
// eslint-disable-next-line import/no-named-as-default, import/no-named-as-default-member
import getIconMetaData from './utils/getIconMetaData.mjs';
import generateDynamicImports from './building/generateDynamicImports.mjs';
const cliArguments = getArgumentOptions(process.argv.slice(2));
const ICONS_DIR = path.resolve(process.cwd(), '../../icons');
const OUTPUT_DIR = path.resolve(process.cwd(), cliArguments.output || '../build');
if (!fs.existsSync(OUTPUT_DIR)) {
fs.mkdirSync(OUTPUT_DIR);
}
const {
renderUniqueKey = false,
templateSrc,
silent = false,
iconFileExtension = '.js',
importImportFileExtension = '',
exportFileName = 'index.js',
exportModuleNameCasing = 'pascal',
withAliases = false,
aliasNamesOnly = false,
withDynamicImports = false,
separateAliasesFile = false,
aliasesFileExtension = '.js',
aliasImportFileExtension = '',
pretty = true,
} = cliArguments;
async function buildIcons() {
if (templateSrc == null) {
throw new Error('No `templateSrc` argument given.');
}
const svgFiles = readSvgDirectory(ICONS_DIR);
const icons = renderIconsObject(svgFiles, ICONS_DIR, renderUniqueKey);
const { default: iconFileTemplate } = await import(path.resolve(process.cwd(), templateSrc));
const iconMetaData = await getIconMetaData(ICONS_DIR);
// Generates iconsNodes files for each icon
generateIconFiles({
iconNodes: icons,
outputDirectory: OUTPUT_DIR,
template: iconFileTemplate,
showLog: !silent,
iconFileExtension,
pretty: JSON.parse(pretty),
iconsDir: ICONS_DIR,
iconMetaData,
});
if (withAliases) {
await generateAliasesFile({
iconNodes: icons,
iconMetaData,
aliasNamesOnly,
iconFileExtension,
outputDirectory: OUTPUT_DIR,
fileExtension: aliasesFileExtension,
exportModuleNameCasing,
aliasImportFileExtension,
separateAliasesFile,
showLog: !silent,
});
}
if (withDynamicImports) {
generateDynamicImports({
iconNodes: icons,
outputDirectory: OUTPUT_DIR,
fileExtension: aliasesFileExtension,
showLog: !silent,
});
}
// Generates entry files for the compiler filled with icons exports
generateExportsFile(
path.join(OUTPUT_DIR, 'icons', exportFileName),
path.join(OUTPUT_DIR, 'icons'),
icons,
exportModuleNameCasing,
importImportFileExtension,
);
}
try {
buildIcons();
} catch (error) {
console.error(error);
}
| lucide-icons/lucide/tools/build-icons/cli.mjs | {
"file_path": "lucide-icons/lucide/tools/build-icons/cli.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 1025
} | 54 |
# Create a free PostgreSQL database: https://vercel.com/postgres
DB_PRISMA_URL=
DB_URL_NON_POOLING=
# Create github oauth app: https://github.com/settings/developers
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
# Site Url
NEXT_PUBLIC_APP_URL="http://localhost:3000"
UPLOADTHING_URL="http://localhost:3000"
# Create an account in resend and get the api key https://resend.com/
RESEND_API_KEY=
# Create a project in uploadthing and get api keys https://uploadthing.com/
UPLOADTHING_SECRET=
UPLOADTHING_APP_ID=
#Stripe https://stripe.com/
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET =
STRIPE_PRO_PLAN_ID= | moinulmoin/chadnext/.env.example | {
"file_path": "moinulmoin/chadnext/.env.example",
"repo_id": "moinulmoin/chadnext",
"token_count": 249
} | 55 |
#!/bin/sh
if [ "$LEFTHOOK" = "0" ]; then
exit 0
fi
call_lefthook()
{
dir="$(git rev-parse --show-toplevel)"
osArch=$(uname | tr '[:upper:]' '[:lower:]')
cpuArch=$(uname -m | sed 's/aarch64/arm64/')
if lefthook -h >/dev/null 2>&1
then
lefthook "$@"
elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch}_${cpuArch}/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch}_${cpuArch}/lefthook" "$@"
elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook "$@"
elif yarn lefthook -h >/dev/null 2>&1
then
yarn lefthook "$@"
elif pnpm lefthook -h >/dev/null 2>&1
then
pnpm lefthook "$@"
elif command -v npx >/dev/null 2>&1
then
npx @evilmartians/lefthook "$@"
else
echo "Can't find lefthook in PATH"
fi
}
call_lefthook run "pre-commit" "$@"
| moinulmoin/chadnext/.husky/pre-commit | {
"file_path": "moinulmoin/chadnext/.husky/pre-commit",
"repo_id": "moinulmoin/chadnext",
"token_count": 571
} | 56 |
"use client";
import { useTransition } from "react";
import Icons from "~/components/shared/icons";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "~/components/ui/alert-dialog";
import { Button } from "~/components/ui/button";
import { Card, CardDescription, CardTitle } from "~/components/ui/card";
import { toast } from "~/components/ui/use-toast";
import { deleteProjectById } from "../action";
export default function DeleteCard({ id }: { id: string }) {
const [pending, startTransition] = useTransition();
const handleDelete = async () => {
startTransition(() =>
deleteProjectById(id)
.then(() => {
toast({
title: "Project deleted successfully.",
});
})
.catch((error) => {
console.error(error);
toast({
title: "Error deleting project.",
description: "Please try again.",
variant: "destructive",
});
})
);
};
return (
<Card className="mt-5 flex items-center justify-between p-6">
<div>
<CardTitle className=" mb-2.5">Delete Project</CardTitle>
<CardDescription>
The project will be permanently deleted. This action is irreversible
and can not be undone.
</CardDescription>
</div>
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="destructive">Delete</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction asChild>
<Button variant="destructive" onClick={handleDelete}>
{pending && (
<Icons.spinner className="mr-2 h-5 w-5 animate-spin" />
)}
Delete
</Button>
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</Card>
);
}
| moinulmoin/chadnext/src/app/[locale]/dashboard/projects/[projectId]/delete-card.tsx | {
"file_path": "moinulmoin/chadnext/src/app/[locale]/dashboard/projects/[projectId]/delete-card.tsx",
"repo_id": "moinulmoin/chadnext",
"token_count": 958
} | 57 |
import Features from "~/components/sections/features";
import Hero from "~/components/sections/hero";
import OpenSource from "~/components/sections/open-source";
import Pricing from "~/components/sections/pricing";
export default async function Home() {
return (
<>
<Hero />
<Features />
<Pricing />
<OpenSource />
</>
);
}
| moinulmoin/chadnext/src/app/[locale]/page.tsx | {
"file_path": "moinulmoin/chadnext/src/app/[locale]/page.tsx",
"repo_id": "moinulmoin/chadnext",
"token_count": 129
} | 58 |
import { type MetadataRoute } from "next";
import { siteUrl } from "~/config/site";
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: siteUrl,
lastModified: new Date(),
changeFrequency: "weekly",
priority: 1,
alternates: {
languages: {
en: `${siteUrl}/en`,
fr: `${siteUrl}/fr`,
},
},
},
{
url: `${siteUrl}/login`,
lastModified: new Date(),
changeFrequency: "weekly",
priority: 0.5,
alternates: {
languages: {
en: `${siteUrl}/en/login`,
fr: `${siteUrl}/fr/login`,
},
},
},
{
url: `${siteUrl}/about`,
lastModified: new Date(),
changeFrequency: "weekly",
priority: 0.5,
alternates: {
languages: {
en: `${siteUrl}/en/about`,
fr: `${siteUrl}/fr/about`,
},
},
},
{
url: `${siteUrl}/changelog`,
lastModified: new Date(),
changeFrequency: "weekly",
priority: 0.5,
alternates: {
languages: {
en: `${siteUrl}/en/changelog`,
fr: `${siteUrl}/fr/changelog`,
},
},
},
];
}
| moinulmoin/chadnext/src/app/sitemap.ts | {
"file_path": "moinulmoin/chadnext/src/app/sitemap.ts",
"repo_id": "moinulmoin/chadnext",
"token_count": 627
} | 59 |
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { buttonVariants } from "~/components/ui/button";
import { cn } from "~/lib/utils";
import Icons from "../shared/icons";
import LogoutButton from "../shared/logout-button";
const navItems = [
{
title: "Projects",
href: "/dashboard/projects",
icon: Icons.projectPlus,
},
{
title: "Billing",
href: "/dashboard/billing",
icon: Icons.billing,
},
{
title: "Settings",
href: "/dashboard/settings",
icon: Icons.settings,
},
];
interface SidebarNavProps extends React.HTMLAttributes<HTMLElement> {
className?: string;
}
export default function SidebarNav({ className, ...props }: SidebarNavProps) {
const pathname = usePathname();
const isActive = (href: string) => pathname === href;
return (
<nav
className={cn("flex h-full gap-x-2 lg:flex-col lg:gap-y-1.5", className)}
{...props}
>
{navItems.map((item) => (
<Link
key={item.href}
href={item.href}
className={cn(
buttonVariants({ variant: "ghost" }),
isActive(item.href)
? "bg-muted hover:bg-muted"
: "hover:bg-transparent hover:underline",
"justify-start"
)}
>
{<item.icon className="mr-2 h-4 w-4 " />} {item.title}
</Link>
))}
<LogoutButton className="mt-auto hidden lg:block" />
</nav>
);
}
| moinulmoin/chadnext/src/components/layout/sidebar-nav.tsx | {
"file_path": "moinulmoin/chadnext/src/components/layout/sidebar-nav.tsx",
"repo_id": "moinulmoin/chadnext",
"token_count": 658
} | 60 |
import * as React from "react";
import { cn } from "~/lib/utils";
const Card = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"rounded-lg border bg-card text-card-foreground shadow-sm",
className
)}
{...props}
/>
));
Card.displayName = "Card";
const CardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)}
{...props}
/>
));
CardHeader.displayName = "CardHeader";
const CardTitle = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h3
ref={ref}
className={cn(
"text-2xl font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
));
CardTitle.displayName = "CardTitle";
const CardDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<p
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
));
CardDescription.displayName = "CardDescription";
const CardContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
));
CardContent.displayName = "CardContent";
const CardFooter = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(" flex items-center p-6 pt-0", className)}
{...props}
/>
));
CardFooter.displayName = "CardFooter";
export {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
};
| moinulmoin/chadnext/src/components/ui/card.tsx | {
"file_path": "moinulmoin/chadnext/src/components/ui/card.tsx",
"repo_id": "moinulmoin/chadnext",
"token_count": 713
} | 61 |
export const siteUrl =
process.env.NEXT_PUBLIC_APP_URL || "https://chadnext.moinulmoin.com";
export const siteConfig = (locale?: string) => ({
name: "ChadNext",
url: siteUrl + "/" + locale,
ogImage: `${siteUrl}/${locale}/opengraph-image`,
description: "Quick Starter Template for your Next project.",
links: {
twitter: "https://twitter.com/immoinulmoin",
github: "https://github.com/moinulmoin/chadnext",
},
});
export type SiteConfig = typeof siteConfig;
| moinulmoin/chadnext/src/config/site.ts | {
"file_path": "moinulmoin/chadnext/src/config/site.ts",
"repo_id": "moinulmoin/chadnext",
"token_count": 174
} | 62 |
import Stripe from "stripe";
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string, {
apiVersion: "2023-10-16",
typescript: true,
});
| moinulmoin/chadnext/src/lib/stripe.ts | {
"file_path": "moinulmoin/chadnext/src/lib/stripe.ts",
"repo_id": "moinulmoin/chadnext",
"token_count": 58
} | 63 |
import * as React from "react";
function DiscordIcon(props: React.SVGProps<SVGSVGElement> | undefined) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="80"
height="80"
{...props}
viewBox="0 0 24 24"
fill="currentColor"
className="icon icon-tabler mb-4 icons-tabler-filled icon-tabler-brand-discord"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M14.983 3l.123 .006c2.014 .214 3.527 .672 4.966 1.673a1 1 0 0 1 .371 .488c1.876 5.315 2.373 9.987 1.451 12.28c-1.003 2.005 -2.606 3.553 -4.394 3.553c-.732 0 -1.693 -.968 -2.328 -2.045a21.512 21.512 0 0 0 2.103 -.493a1 1 0 1 0 -.55 -1.924c-3.32 .95 -6.13 .95 -9.45 0a1 1 0 0 0 -.55 1.924c.717 .204 1.416 .37 2.103 .494c-.635 1.075 -1.596 2.044 -2.328 2.044c-1.788 0 -3.391 -1.548 -4.428 -3.629c-.888 -2.217 -.39 -6.89 1.485 -12.204a1 1 0 0 1 .371 -.488c1.439 -1.001 2.952 -1.459 4.966 -1.673a1 1 0 0 1 .935 .435l.063 .107l.651 1.285l.137 -.016a12.97 12.97 0 0 1 2.643 0l.134 .016l.65 -1.284a1 1 0 0 1 .754 -.54l.122 -.009zm-5.983 7a2 2 0 0 0 -1.977 1.697l-.018 .154l-.005 .149l.005 .15a2 2 0 1 0 1.995 -2.15zm6 0a2 2 0 0 0 -1.977 1.697l-.018 .154l-.005 .149l.005 .15a2 2 0 1 0 1.995 -2.15z" />
</svg>
);
}
export default DiscordIcon;
| nobruf/shadcn-landing-page/components/icons/discord-icon.tsx | {
"file_path": "nobruf/shadcn-landing-page/components/icons/discord-icon.tsx",
"repo_id": "nobruf/shadcn-landing-page",
"token_count": 673
} | 64 |
"use client";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import {
Carousel,
CarouselContent,
CarouselItem,
CarouselNext,
CarouselPrevious,
} from "@/components/ui/carousel";
import { Star } from "lucide-react";
interface ReviewProps {
image: string;
name: string;
userName: string;
comment: string;
rating: number;
}
const reviewList: ReviewProps[] = [
{
image: "https://github.com/shadcn.png",
name: "John Doe",
userName: "Product Manager",
comment:
"Wow NextJs + Shadcn is awesome!. This template lets me change colors, fonts and images to match my brand identity. ",
rating: 5.0,
},
{
image: "https://github.com/shadcn.png",
name: "Sophia Collins",
userName: "Cybersecurity Analyst",
comment:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna. ",
rating: 4.8,
},
{
image: "https://github.com/shadcn.png",
name: "Adam Johnson",
userName: "Chief Technology Officer",
comment:
"Lorem ipsum dolor sit amet,exercitation. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
rating: 4.9,
},
{
image: "https://github.com/shadcn.png",
name: "Ethan Parker",
userName: "Data Scientist",
comment:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod labore et dolore magna aliqua. Ut enim ad minim veniam.",
rating: 5.0,
},
{
image: "https://github.com/shadcn.png",
name: "Ava Mitchell",
userName: "IT Project Manager",
comment:
"Lorem ipsum dolor sit amet, tempor incididunt aliqua. Ut enim ad minim veniam, quis nostrud incididunt consectetur adipiscing elit.",
rating: 5.0,
},
{
image: "https://github.com/shadcn.png",
name: "Isabella Reed",
userName: "DevOps Engineer",
comment:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
rating: 4.9,
},
];
export const TestimonialSection = () => {
return (
<section id="testimonials" className="container py-24 sm:py-32">
<div className="text-center mb-8">
<h2 className="text-lg text-primary text-center mb-2 tracking-wider">
Testimonials
</h2>
<h2 className="text-3xl md:text-4xl text-center font-bold mb-4">
Hear What Our 1000+ Clients Say
</h2>
</div>
<Carousel
opts={{
align: "start",
}}
className="relative w-[80%] sm:w-[90%] lg:max-w-screen-xl mx-auto"
>
<CarouselContent>
{reviewList.map((review) => (
<CarouselItem
key={review.name}
className="md:basis-1/2 lg:basis-1/3"
>
<Card className="bg-muted/50 dark:bg-card">
<CardContent className="pt-6 pb-0">
<div className="flex gap-1 pb-6">
<Star className="size-4 fill-primary text-primary" />
<Star className="size-4 fill-primary text-primary" />
<Star className="size-4 fill-primary text-primary" />
<Star className="size-4 fill-primary text-primary" />
<Star className="size-4 fill-primary text-primary" />
</div>
{`"${review.comment}"`}
</CardContent>
<CardHeader>
<div className="flex flex-row items-center gap-4">
<Avatar>
<AvatarImage
src="https://avatars.githubusercontent.com/u/75042455?v=4"
alt="radix"
/>
<AvatarFallback>SV</AvatarFallback>
</Avatar>
<div className="flex flex-col">
<CardTitle className="text-lg">{review.name}</CardTitle>
<CardDescription>{review.userName}</CardDescription>
</div>
</div>
</CardHeader>
</Card>
</CarouselItem>
))}
</CarouselContent>
<CarouselPrevious />
<CarouselNext />
</Carousel>
</section>
);
};
| nobruf/shadcn-landing-page/components/layout/sections/testimonial.tsx | {
"file_path": "nobruf/shadcn-landing-page/components/layout/sections/testimonial.tsx",
"repo_id": "nobruf/shadcn-landing-page",
"token_count": 2146
} | 65 |
"use client";
import * as React from "react";
import * as SelectPrimitive from "@radix-ui/react-select";
import { Check, ChevronDown, ChevronUp } from "lucide-react";
import { cn } from "@/lib/utils";
const Select = SelectPrimitive.Root;
const SelectGroup = SelectPrimitive.Group;
const SelectValue = SelectPrimitive.Value;
const SelectTrigger = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Trigger
ref={ref}
className={cn(
"flex h-10 w-full items-center !bg-background justify-between rounded-md border border-input px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
className
)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
<ChevronDown className="h-4 w-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
));
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
const SelectScrollUpButton = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollUpButton
ref={ref}
className={cn(
"flex cursor-default items-center justify-center py-1",
className
)}
{...props}
>
<ChevronUp className="h-4 w-4" />
</SelectPrimitive.ScrollUpButton>
));
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
const SelectScrollDownButton = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollDownButton
ref={ref}
className={cn(
"flex cursor-default items-center justify-center py-1",
className
)}
{...props}
>
<ChevronDown className="h-4 w-4" />
</SelectPrimitive.ScrollDownButton>
));
SelectScrollDownButton.displayName =
SelectPrimitive.ScrollDownButton.displayName;
const SelectContent = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
>(({ className, children, position = "popper", ...props }, ref) => (
<SelectPrimitive.Portal>
<SelectPrimitive.Content
ref={ref}
className={cn(
"relative z-50 max-h-96 min-w-[8rem] border-secondary overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className
)}
position={position}
{...props}
>
<SelectScrollUpButton />
<SelectPrimitive.Viewport
className={cn(
"p-1",
position === "popper" &&
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
)}
>
{children}
</SelectPrimitive.Viewport>
<SelectScrollDownButton />
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
));
SelectContent.displayName = SelectPrimitive.Content.displayName;
const SelectLabel = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Label>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Label
ref={ref}
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
{...props}
/>
));
SelectLabel.displayName = SelectPrimitive.Label.displayName;
const SelectItem = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Item
ref={ref}
className={cn(
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<Check className="h-4 w-4" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
));
SelectItem.displayName = SelectPrimitive.Item.displayName;
const SelectSeparator = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Separator
ref={ref}
className={cn("-mx-1 my-1 h-px bg-muted", className)}
{...props}
/>
));
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
export {
Select,
SelectGroup,
SelectValue,
SelectTrigger,
SelectContent,
SelectLabel,
SelectItem,
SelectSeparator,
SelectScrollUpButton,
SelectScrollDownButton,
};
| nobruf/shadcn-landing-page/components/ui/select.tsx | {
"file_path": "nobruf/shadcn-landing-page/components/ui/select.tsx",
"repo_id": "nobruf/shadcn-landing-page",
"token_count": 2066
} | 66 |
# -----------------------------------------------------------------------------
# App
# -----------------------------------------------------------------------------
NEXT_PUBLIC_APP_URL=http://localhost:3000
# -----------------------------------------------------------------------------
# Authentication (NextAuth.js)
# -----------------------------------------------------------------------------
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_ACCESS_TOKEN=
# -----------------------------------------------------------------------------
# Database (MySQL - PlanetScale)
# -----------------------------------------------------------------------------
DATABASE_URL="mysql://root:root@localhost:3306/taxonomy?schema=public"
# -----------------------------------------------------------------------------
# Email (Postmark)
# -----------------------------------------------------------------------------
SMTP_FROM=
POSTMARK_API_TOKEN=
POSTMARK_SIGN_IN_TEMPLATE=
POSTMARK_ACTIVATION_TEMPLATE=
# -----------------------------------------------------------------------------
# Subscriptions (Stripe)
# -----------------------------------------------------------------------------
STRIPE_API_KEY=
STRIPE_WEBHOOK_SECRET=
STRIPE_PRO_MONTHLY_PLAN_ID= | shadcn-ui/taxonomy/.env.example | {
"file_path": "shadcn-ui/taxonomy/.env.example",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 264
} | 67 |
interface GuidesLayoutProps {
children: React.ReactNode
}
export default function GuidesLayout({ children }: GuidesLayoutProps) {
return <div className="mx-auto max-w-5xl">{children}</div>
}
| shadcn-ui/taxonomy/app/(docs)/guides/layout.tsx | {
"file_path": "shadcn-ui/taxonomy/app/(docs)/guides/layout.tsx",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 62
} | 68 |
import { getServerSession } from "next-auth/next"
import * as z from "zod"
import { authOptions } from "@/lib/auth"
import { db } from "@/lib/db"
import { RequiresProPlanError } from "@/lib/exceptions"
import { getUserSubscriptionPlan } from "@/lib/subscription"
const postCreateSchema = z.object({
title: z.string(),
content: z.string().optional(),
})
export async function GET() {
try {
const session = await getServerSession(authOptions)
if (!session) {
return new Response("Unauthorized", { status: 403 })
}
const { user } = session
const posts = await db.post.findMany({
select: {
id: true,
title: true,
published: true,
createdAt: true,
},
where: {
authorId: user.id,
},
})
return new Response(JSON.stringify(posts))
} catch (error) {
return new Response(null, { status: 500 })
}
}
export async function POST(req: Request) {
try {
const session = await getServerSession(authOptions)
if (!session) {
return new Response("Unauthorized", { status: 403 })
}
const { user } = session
const subscriptionPlan = await getUserSubscriptionPlan(user.id)
// If user is on a free plan.
// Check if user has reached limit of 3 posts.
if (!subscriptionPlan?.isPro) {
const count = await db.post.count({
where: {
authorId: user.id,
},
})
if (count >= 3) {
throw new RequiresProPlanError()
}
}
const json = await req.json()
const body = postCreateSchema.parse(json)
const post = await db.post.create({
data: {
title: body.title,
content: body.content,
authorId: session.user.id,
},
select: {
id: true,
},
})
return new Response(JSON.stringify(post))
} catch (error) {
if (error instanceof z.ZodError) {
return new Response(JSON.stringify(error.issues), { status: 422 })
}
if (error instanceof RequiresProPlanError) {
return new Response("Requires Pro Plan", { status: 402 })
}
return new Response(null, { status: 500 })
}
}
| shadcn-ui/taxonomy/app/api/posts/route.ts | {
"file_path": "shadcn-ui/taxonomy/app/api/posts/route.ts",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 846
} | 69 |
"use client"
import * as React from "react"
import Link from "next/link"
import { useRouter } from "next/navigation"
import EditorJS from "@editorjs/editorjs"
import { zodResolver } from "@hookform/resolvers/zod"
import { Post } from "@prisma/client"
import { useForm } from "react-hook-form"
import TextareaAutosize from "react-textarea-autosize"
import * as z from "zod"
import "@/styles/editor.css"
import { cn } from "@/lib/utils"
import { postPatchSchema } from "@/lib/validations/post"
import { buttonVariants } from "@/components/ui/button"
import { toast } from "@/components/ui/use-toast"
import { Icons } from "@/components/icons"
interface EditorProps {
post: Pick<Post, "id" | "title" | "content" | "published">
}
type FormData = z.infer<typeof postPatchSchema>
export function Editor({ post }: EditorProps) {
const { register, handleSubmit } = useForm<FormData>({
resolver: zodResolver(postPatchSchema),
})
const ref = React.useRef<EditorJS>()
const router = useRouter()
const [isSaving, setIsSaving] = React.useState<boolean>(false)
const [isMounted, setIsMounted] = React.useState<boolean>(false)
const initializeEditor = React.useCallback(async () => {
const EditorJS = (await import("@editorjs/editorjs")).default
const Header = (await import("@editorjs/header")).default
const Embed = (await import("@editorjs/embed")).default
const Table = (await import("@editorjs/table")).default
const List = (await import("@editorjs/list")).default
const Code = (await import("@editorjs/code")).default
const LinkTool = (await import("@editorjs/link")).default
const InlineCode = (await import("@editorjs/inline-code")).default
const body = postPatchSchema.parse(post)
if (!ref.current) {
const editor = new EditorJS({
holder: "editor",
onReady() {
ref.current = editor
},
placeholder: "Type here to write your post...",
inlineToolbar: true,
data: body.content,
tools: {
header: Header,
linkTool: LinkTool,
list: List,
code: Code,
inlineCode: InlineCode,
table: Table,
embed: Embed,
},
})
}
}, [post])
React.useEffect(() => {
if (typeof window !== "undefined") {
setIsMounted(true)
}
}, [])
React.useEffect(() => {
if (isMounted) {
initializeEditor()
return () => {
ref.current?.destroy()
ref.current = undefined
}
}
}, [isMounted, initializeEditor])
async function onSubmit(data: FormData) {
setIsSaving(true)
const blocks = await ref.current?.save()
const response = await fetch(`/api/posts/${post.id}`, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
title: data.title,
content: blocks,
}),
})
setIsSaving(false)
if (!response?.ok) {
return toast({
title: "Something went wrong.",
description: "Your post was not saved. Please try again.",
variant: "destructive",
})
}
router.refresh()
return toast({
description: "Your post has been saved.",
})
}
if (!isMounted) {
return null
}
return (
<form onSubmit={handleSubmit(onSubmit)}>
<div className="grid w-full gap-10">
<div className="flex w-full items-center justify-between">
<div className="flex items-center space-x-10">
<Link
href="/dashboard"
className={cn(buttonVariants({ variant: "ghost" }))}
>
<>
<Icons.chevronLeft className="mr-2 h-4 w-4" />
Back
</>
</Link>
<p className="text-sm text-muted-foreground">
{post.published ? "Published" : "Draft"}
</p>
</div>
<button type="submit" className={cn(buttonVariants())}>
{isSaving && (
<Icons.spinner className="mr-2 h-4 w-4 animate-spin" />
)}
<span>Save</span>
</button>
</div>
<div className="prose prose-stone mx-auto w-[800px] dark:prose-invert">
<TextareaAutosize
autoFocus
id="title"
defaultValue={post.title}
placeholder="Post title"
className="w-full resize-none appearance-none overflow-hidden bg-transparent text-5xl font-bold focus:outline-none"
{...register("title")}
/>
<div id="editor" className="min-h-[500px]" />
<p className="text-sm text-gray-500">
Use{" "}
<kbd className="rounded-md border bg-muted px-1 text-xs uppercase">
Tab
</kbd>{" "}
to open the command menu.
</p>
</div>
</div>
</form>
)
}
| shadcn-ui/taxonomy/components/editor.tsx | {
"file_path": "shadcn-ui/taxonomy/components/editor.tsx",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 2183
} | 70 |
import * as React from "react"
import { cn } from "@/lib/utils"
interface DashboardShellProps extends React.HTMLAttributes<HTMLDivElement> {}
export function DashboardShell({
children,
className,
...props
}: DashboardShellProps) {
return (
<div className={cn("grid items-start gap-8", className)} {...props}>
{children}
</div>
)
}
| shadcn-ui/taxonomy/components/shell.tsx | {
"file_path": "shadcn-ui/taxonomy/components/shell.tsx",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 126
} | 71 |
"use client"
import * as React from "react"
import * as SheetPrimitive from "@radix-ui/react-dialog"
import { VariantProps, cva } from "class-variance-authority"
import { X } from "lucide-react"
import { cn } from "@/lib/utils"
const Sheet = SheetPrimitive.Root
const SheetTrigger = SheetPrimitive.Trigger
const portalVariants = cva("fixed inset-0 z-50 flex", {
variants: {
position: {
top: "items-start",
bottom: "items-end",
left: "justify-start",
right: "justify-end",
},
},
defaultVariants: { position: "right" },
})
interface SheetPortalProps
extends SheetPrimitive.DialogPortalProps,
VariantProps<typeof portalVariants> {}
const SheetPortal = ({
position,
className,
children,
...props
}: SheetPortalProps) => (
<SheetPrimitive.Portal className={cn(className)} {...props}>
<div className={portalVariants({ position })}>{children}</div>
</SheetPrimitive.Portal>
)
SheetPortal.displayName = SheetPrimitive.Portal.displayName
const SheetOverlay = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
>(({ className, children, ...props }, ref) => (
<SheetPrimitive.Overlay
className={cn(
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm transition-all duration-100 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in",
className
)}
{...props}
ref={ref}
/>
))
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
const sheetVariants = cva(
"fixed z-50 scale-100 gap-4 bg-background p-6 opacity-100 shadow-lg border",
{
variants: {
position: {
top: "animate-in slide-in-from-top w-full duration-300",
bottom: "animate-in slide-in-from-bottom w-full duration-300",
left: "animate-in slide-in-from-left h-full duration-300",
right: "animate-in slide-in-from-right h-full duration-300",
},
size: {
content: "",
default: "",
sm: "",
lg: "",
xl: "",
full: "",
},
},
compoundVariants: [
{
position: ["top", "bottom"],
size: "content",
class: "max-h-screen",
},
{
position: ["top", "bottom"],
size: "default",
class: "h-1/3",
},
{
position: ["top", "bottom"],
size: "sm",
class: "h-1/4",
},
{
position: ["top", "bottom"],
size: "lg",
class: "h-1/2",
},
{
position: ["top", "bottom"],
size: "xl",
class: "h-5/6",
},
{
position: ["top", "bottom"],
size: "full",
class: "h-screen",
},
{
position: ["right", "left"],
size: "content",
class: "max-w-screen",
},
{
position: ["right", "left"],
size: "default",
class: "w-1/3",
},
{
position: ["right", "left"],
size: "sm",
class: "w-1/4",
},
{
position: ["right", "left"],
size: "lg",
class: "w-1/2",
},
{
position: ["right", "left"],
size: "xl",
class: "w-5/6",
},
{
position: ["right", "left"],
size: "full",
class: "w-screen",
},
],
defaultVariants: {
position: "right",
size: "default",
},
}
)
export interface DialogContentProps
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
VariantProps<typeof sheetVariants> {}
const SheetContent = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Content>,
DialogContentProps
>(({ position, size, className, children, ...props }, ref) => (
<SheetPortal position={position}>
<SheetOverlay />
<SheetPrimitive.Content
ref={ref}
className={cn(sheetVariants({ position, size }), className)}
{...props}
>
{children}
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</SheetPrimitive.Close>
</SheetPrimitive.Content>
</SheetPortal>
))
SheetContent.displayName = SheetPrimitive.Content.displayName
const SheetHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-2 text-center sm:text-left",
className
)}
{...props}
/>
)
SheetHeader.displayName = "SheetHeader"
const SheetFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
{...props}
/>
)
SheetFooter.displayName = "SheetFooter"
const SheetTitle = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
>(({ className, ...props }, ref) => (
<SheetPrimitive.Title
ref={ref}
className={cn("text-lg font-semibold text-foreground", className)}
{...props}
/>
))
SheetTitle.displayName = SheetPrimitive.Title.displayName
const SheetDescription = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
>(({ className, ...props }, ref) => (
<SheetPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
SheetDescription.displayName = SheetPrimitive.Description.displayName
export {
Sheet,
SheetTrigger,
SheetContent,
SheetHeader,
SheetFooter,
SheetTitle,
SheetDescription,
}
| shadcn-ui/taxonomy/components/ui/sheet.tsx | {
"file_path": "shadcn-ui/taxonomy/components/ui/sheet.tsx",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 2502
} | 72 |
import { DocsConfig } from "types"
export const docsConfig: DocsConfig = {
mainNav: [
{
title: "Documentation",
href: "/docs",
},
{
title: "Guides",
href: "/guides",
},
],
sidebarNav: [
{
title: "Getting Started",
items: [
{
title: "Introduction",
href: "/docs",
},
],
},
{
title: "Documentation",
items: [
{
title: "Introduction",
href: "/docs/documentation",
},
{
title: "Contentlayer",
href: "/docs/in-progress",
disabled: true,
},
{
title: "Components",
href: "/docs/documentation/components",
},
{
title: "Code Blocks",
href: "/docs/documentation/code-blocks",
},
{
title: "Style Guide",
href: "/docs/documentation/style-guide",
},
{
title: "Search",
href: "/docs/in-progress",
disabled: true,
},
],
},
{
title: "Blog",
items: [
{
title: "Introduction",
href: "/docs/in-progress",
disabled: true,
},
{
title: "Build your own",
href: "/docs/in-progress",
disabled: true,
},
{
title: "Writing Posts",
href: "/docs/in-progress",
disabled: true,
},
],
},
{
title: "Dashboard",
items: [
{
title: "Introduction",
href: "/docs/in-progress",
disabled: true,
},
{
title: "Layouts",
href: "/docs/in-progress",
disabled: true,
},
{
title: "Server Components",
href: "/docs/in-progress",
disabled: true,
},
{
title: "Authentication",
href: "/docs/in-progress",
disabled: true,
},
{
title: "Database with Prisma",
href: "/docs/in-progress",
disabled: true,
},
{
title: "API Routes",
href: "/docs/in-progress",
disabled: true,
},
],
},
{
title: "Marketing Site",
items: [
{
title: "Introduction",
href: "/docs/in-progress",
disabled: true,
},
{
title: "File Structure",
href: "/docs/in-progress",
disabled: true,
},
{
title: "Tailwind CSS",
href: "/docs/in-progress",
disabled: true,
},
{
title: "Typography",
href: "/docs/in-progress",
disabled: true,
},
],
},
],
}
| shadcn-ui/taxonomy/config/docs.ts | {
"file_path": "shadcn-ui/taxonomy/config/docs.ts",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 1573
} | 73 |
import * as z from "zod"
export const ogImageSchema = z.object({
heading: z.string(),
type: z.string(),
mode: z.enum(["light", "dark"]).default("dark"),
})
| shadcn-ui/taxonomy/lib/validations/og.ts | {
"file_path": "shadcn-ui/taxonomy/lib/validations/og.ts",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 61
} | 74 |
import Image from "next/image"
import Link from "next/link"
import {
ChevronLeft,
Home,
LineChart,
Package,
Package2,
PanelLeft,
PlusCircle,
Search,
Settings,
ShoppingCart,
Upload,
Users2,
} from "lucide-react"
import { Badge } from "@/registry/default/ui/badge"
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/registry/default/ui/breadcrumb"
import { Button } from "@/registry/default/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/default/ui/card"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/registry/default/ui/dropdown-menu"
import { Input } from "@/registry/default/ui/input"
import { Label } from "@/registry/default/ui/label"
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/registry/default/ui/select"
import { Sheet, SheetContent, SheetTrigger } from "@/registry/default/ui/sheet"
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/registry/default/ui/table"
import { Textarea } from "@/registry/default/ui/textarea"
import {
ToggleGroup,
ToggleGroupItem,
} from "@/registry/default/ui/toggle-group"
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/registry/default/ui/tooltip"
export const description =
"A product edit page. The product edit page has a form to edit the product details, stock, product category, product status, and product images. The product edit page has a sidebar navigation and a main content area. The main content area has a form to edit the product details, stock, product category, product status, and product images. The sidebar navigation has links to product details, stock, product category, product status, and product images."
export const iframeHeight = "1200px"
export const containerClassName = "w-full h-full"
export default function Dashboard() {
return (
<div className="flex min-h-screen w-full flex-col bg-muted/40">
<aside className="fixed inset-y-0 left-0 z-10 hidden w-14 flex-col border-r bg-background sm:flex">
<nav className="flex flex-col items-center gap-4 px-2 sm:py-5">
<Link
href="#"
className="group flex h-9 w-9 shrink-0 items-center justify-center gap-2 rounded-full bg-primary text-lg font-semibold text-primary-foreground md:h-8 md:w-8 md:text-base"
>
<Package2 className="h-4 w-4 transition-all group-hover:scale-110" />
<span className="sr-only">Acme Inc</span>
</Link>
<Tooltip>
<TooltipTrigger asChild>
<Link
href="#"
className="flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8"
>
<Home className="h-5 w-5" />
<span className="sr-only">Dashboard</span>
</Link>
</TooltipTrigger>
<TooltipContent side="right">Dashboard</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Link
href="#"
className="flex h-9 w-9 items-center justify-center rounded-lg bg-accent text-accent-foreground transition-colors hover:text-foreground md:h-8 md:w-8"
>
<ShoppingCart className="h-5 w-5" />
<span className="sr-only">Orders</span>
</Link>
</TooltipTrigger>
<TooltipContent side="right">Orders</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Link
href="#"
className="flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8"
>
<Package className="h-5 w-5" />
<span className="sr-only">Products</span>
</Link>
</TooltipTrigger>
<TooltipContent side="right">Products</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Link
href="#"
className="flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8"
>
<Users2 className="h-5 w-5" />
<span className="sr-only">Customers</span>
</Link>
</TooltipTrigger>
<TooltipContent side="right">Customers</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Link
href="#"
className="flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8"
>
<LineChart className="h-5 w-5" />
<span className="sr-only">Analytics</span>
</Link>
</TooltipTrigger>
<TooltipContent side="right">Analytics</TooltipContent>
</Tooltip>
</nav>
<nav className="mt-auto flex flex-col items-center gap-4 px-2 sm:py-5">
<Tooltip>
<TooltipTrigger asChild>
<Link
href="#"
className="flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8"
>
<Settings className="h-5 w-5" />
<span className="sr-only">Settings</span>
</Link>
</TooltipTrigger>
<TooltipContent side="right">Settings</TooltipContent>
</Tooltip>
</nav>
</aside>
<div className="flex flex-col sm:gap-4 sm:py-4 sm:pl-14">
<header className="sticky top-0 z-30 flex h-14 items-center gap-4 border-b bg-background px-4 sm:static sm:h-auto sm:border-0 sm:bg-transparent sm:px-6">
<Sheet>
<SheetTrigger asChild>
<Button size="icon" variant="outline" className="sm:hidden">
<PanelLeft className="h-5 w-5" />
<span className="sr-only">Toggle Menu</span>
</Button>
</SheetTrigger>
<SheetContent side="left" className="sm:max-w-xs">
<nav className="grid gap-6 text-lg font-medium">
<Link
href="#"
className="group flex h-10 w-10 shrink-0 items-center justify-center gap-2 rounded-full bg-primary text-lg font-semibold text-primary-foreground md:text-base"
>
<Package2 className="h-5 w-5 transition-all group-hover:scale-110" />
<span className="sr-only">Acme Inc</span>
</Link>
<Link
href="#"
className="flex items-center gap-4 px-2.5 text-muted-foreground hover:text-foreground"
>
<Home className="h-5 w-5" />
Dashboard
</Link>
<Link
href="#"
className="flex items-center gap-4 px-2.5 text-muted-foreground hover:text-foreground"
>
<ShoppingCart className="h-5 w-5" />
Orders
</Link>
<Link
href="#"
className="flex items-center gap-4 px-2.5 text-foreground"
>
<Package className="h-5 w-5" />
Products
</Link>
<Link
href="#"
className="flex items-center gap-4 px-2.5 text-muted-foreground hover:text-foreground"
>
<Users2 className="h-5 w-5" />
Customers
</Link>
<Link
href="#"
className="flex items-center gap-4 px-2.5 text-muted-foreground hover:text-foreground"
>
<LineChart className="h-5 w-5" />
Settings
</Link>
</nav>
</SheetContent>
</Sheet>
<Breadcrumb className="hidden md:flex">
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink asChild>
<Link href="#">Dashboard</Link>
</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink asChild>
<Link href="#">Products</Link>
</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage>Edit Product</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
<div className="relative ml-auto flex-1 md:grow-0">
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
<Input
type="search"
placeholder="Search..."
className="w-full rounded-lg bg-background pl-8 md:w-[200px] lg:w-[336px]"
/>
</div>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="outline"
size="icon"
className="overflow-hidden rounded-full"
>
<Image
src="/placeholder-user.jpg"
width={36}
height={36}
alt="Avatar"
className="overflow-hidden rounded-full"
/>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuLabel>My Account</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuItem>Settings</DropdownMenuItem>
<DropdownMenuItem>Support</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem>Logout</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</header>
<main className="grid flex-1 items-start gap-4 p-4 sm:px-6 sm:py-0 md:gap-8">
<div className="mx-auto grid max-w-[59rem] flex-1 auto-rows-max gap-4">
<div className="flex items-center gap-4">
<Button variant="outline" size="icon" className="h-7 w-7">
<ChevronLeft className="h-4 w-4" />
<span className="sr-only">Back</span>
</Button>
<h1 className="flex-1 shrink-0 whitespace-nowrap text-xl font-semibold tracking-tight sm:grow-0">
Pro Controller
</h1>
<Badge variant="outline" className="ml-auto sm:ml-0">
In stock
</Badge>
<div className="hidden items-center gap-2 md:ml-auto md:flex">
<Button variant="outline" size="sm">
Discard
</Button>
<Button size="sm">Save Product</Button>
</div>
</div>
<div className="grid gap-4 md:grid-cols-[1fr_250px] lg:grid-cols-3 lg:gap-8">
<div className="grid auto-rows-max items-start gap-4 lg:col-span-2 lg:gap-8">
<Card x-chunk="dashboard-07-chunk-0">
<CardHeader>
<CardTitle>Product Details</CardTitle>
<CardDescription>
Lipsum dolor sit amet, consectetur adipiscing elit
</CardDescription>
</CardHeader>
<CardContent>
<div className="grid gap-6">
<div className="grid gap-3">
<Label htmlFor="name">Name</Label>
<Input
id="name"
type="text"
className="w-full"
defaultValue="Gamer Gear Pro Controller"
/>
</div>
<div className="grid gap-3">
<Label htmlFor="description">Description</Label>
<Textarea
id="description"
defaultValue="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam auctor, nisl nec ultricies ultricies, nunc nisl ultricies nunc, nec ultricies nunc nisl nec nunc."
className="min-h-32"
/>
</div>
</div>
</CardContent>
</Card>
<Card x-chunk="dashboard-07-chunk-1">
<CardHeader>
<CardTitle>Stock</CardTitle>
<CardDescription>
Lipsum dolor sit amet, consectetur adipiscing elit
</CardDescription>
</CardHeader>
<CardContent>
<Table>
<TableHeader>
<TableRow>
<TableHead className="w-[100px]">SKU</TableHead>
<TableHead>Stock</TableHead>
<TableHead>Price</TableHead>
<TableHead className="w-[100px]">Size</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell className="font-semibold">
GGPC-001
</TableCell>
<TableCell>
<Label htmlFor="stock-1" className="sr-only">
Stock
</Label>
<Input
id="stock-1"
type="number"
defaultValue="100"
/>
</TableCell>
<TableCell>
<Label htmlFor="price-1" className="sr-only">
Price
</Label>
<Input
id="price-1"
type="number"
defaultValue="99.99"
/>
</TableCell>
<TableCell>
<ToggleGroup
type="single"
defaultValue="s"
variant="outline"
>
<ToggleGroupItem value="s">S</ToggleGroupItem>
<ToggleGroupItem value="m">M</ToggleGroupItem>
<ToggleGroupItem value="l">L</ToggleGroupItem>
</ToggleGroup>
</TableCell>
</TableRow>
<TableRow>
<TableCell className="font-semibold">
GGPC-002
</TableCell>
<TableCell>
<Label htmlFor="stock-2" className="sr-only">
Stock
</Label>
<Input
id="stock-2"
type="number"
defaultValue="143"
/>
</TableCell>
<TableCell>
<Label htmlFor="price-2" className="sr-only">
Price
</Label>
<Input
id="price-2"
type="number"
defaultValue="99.99"
/>
</TableCell>
<TableCell>
<ToggleGroup
type="single"
defaultValue="m"
variant="outline"
>
<ToggleGroupItem value="s">S</ToggleGroupItem>
<ToggleGroupItem value="m">M</ToggleGroupItem>
<ToggleGroupItem value="l">L</ToggleGroupItem>
</ToggleGroup>
</TableCell>
</TableRow>
<TableRow>
<TableCell className="font-semibold">
GGPC-003
</TableCell>
<TableCell>
<Label htmlFor="stock-3" className="sr-only">
Stock
</Label>
<Input
id="stock-3"
type="number"
defaultValue="32"
/>
</TableCell>
<TableCell>
<Label htmlFor="price-3" className="sr-only">
Stock
</Label>
<Input
id="price-3"
type="number"
defaultValue="99.99"
/>
</TableCell>
<TableCell>
<ToggleGroup
type="single"
defaultValue="s"
variant="outline"
>
<ToggleGroupItem value="s">S</ToggleGroupItem>
<ToggleGroupItem value="m">M</ToggleGroupItem>
<ToggleGroupItem value="l">L</ToggleGroupItem>
</ToggleGroup>
</TableCell>
</TableRow>
</TableBody>
</Table>
</CardContent>
<CardFooter className="justify-center border-t p-4">
<Button size="sm" variant="ghost" className="gap-1">
<PlusCircle className="h-3.5 w-3.5" />
Add Variant
</Button>
</CardFooter>
</Card>
<Card x-chunk="dashboard-07-chunk-2">
<CardHeader>
<CardTitle>Product Category</CardTitle>
</CardHeader>
<CardContent>
<div className="grid gap-6 sm:grid-cols-3">
<div className="grid gap-3">
<Label htmlFor="category">Category</Label>
<Select>
<SelectTrigger
id="category"
aria-label="Select category"
>
<SelectValue placeholder="Select category" />
</SelectTrigger>
<SelectContent>
<SelectItem value="clothing">Clothing</SelectItem>
<SelectItem value="electronics">
Electronics
</SelectItem>
<SelectItem value="accessories">
Accessories
</SelectItem>
</SelectContent>
</Select>
</div>
<div className="grid gap-3">
<Label htmlFor="subcategory">
Subcategory (optional)
</Label>
<Select>
<SelectTrigger
id="subcategory"
aria-label="Select subcategory"
>
<SelectValue placeholder="Select subcategory" />
</SelectTrigger>
<SelectContent>
<SelectItem value="t-shirts">T-Shirts</SelectItem>
<SelectItem value="hoodies">Hoodies</SelectItem>
<SelectItem value="sweatshirts">
Sweatshirts
</SelectItem>
</SelectContent>
</Select>
</div>
</div>
</CardContent>
</Card>
</div>
<div className="grid auto-rows-max items-start gap-4 lg:gap-8">
<Card x-chunk="dashboard-07-chunk-3">
<CardHeader>
<CardTitle>Product Status</CardTitle>
</CardHeader>
<CardContent>
<div className="grid gap-6">
<div className="grid gap-3">
<Label htmlFor="status">Status</Label>
<Select>
<SelectTrigger id="status" aria-label="Select status">
<SelectValue placeholder="Select status" />
</SelectTrigger>
<SelectContent>
<SelectItem value="draft">Draft</SelectItem>
<SelectItem value="published">Active</SelectItem>
<SelectItem value="archived">Archived</SelectItem>
</SelectContent>
</Select>
</div>
</div>
</CardContent>
</Card>
<Card
className="overflow-hidden"
x-chunk="dashboard-07-chunk-4"
>
<CardHeader>
<CardTitle>Product Images</CardTitle>
<CardDescription>
Lipsum dolor sit amet, consectetur adipiscing elit
</CardDescription>
</CardHeader>
<CardContent>
<div className="grid gap-2">
<Image
alt="Product image"
className="aspect-square w-full rounded-md object-cover"
height="300"
src="/placeholder.svg"
width="300"
/>
<div className="grid grid-cols-3 gap-2">
<button>
<Image
alt="Product image"
className="aspect-square w-full rounded-md object-cover"
height="84"
src="/placeholder.svg"
width="84"
/>
</button>
<button>
<Image
alt="Product image"
className="aspect-square w-full rounded-md object-cover"
height="84"
src="/placeholder.svg"
width="84"
/>
</button>
<button className="flex aspect-square w-full items-center justify-center rounded-md border border-dashed">
<Upload className="h-4 w-4 text-muted-foreground" />
<span className="sr-only">Upload</span>
</button>
</div>
</div>
</CardContent>
</Card>
<Card x-chunk="dashboard-07-chunk-5">
<CardHeader>
<CardTitle>Archive Product</CardTitle>
<CardDescription>
Lipsum dolor sit amet, consectetur adipiscing elit.
</CardDescription>
</CardHeader>
<CardContent>
<div></div>
<Button size="sm" variant="secondary">
Archive Product
</Button>
</CardContent>
</Card>
</div>
</div>
<div className="flex items-center justify-center gap-2 md:hidden">
<Button variant="outline" size="sm">
Discard
</Button>
<Button size="sm">Save Product</Button>
</div>
</div>
</main>
</div>
</div>
)
}
| shadcn-ui/ui/apps/www/__registry__/default/block/dashboard-07.tsx | {
"file_path": "shadcn-ui/ui/apps/www/__registry__/default/block/dashboard-07.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 15461
} | 75 |
"use client"
import {
Area,
AreaChart,
Bar,
BarChart,
CartesianGrid,
Label,
LabelList,
Line,
LineChart,
PolarAngleAxis,
RadialBar,
RadialBarChart,
Rectangle,
ReferenceLine,
XAxis,
YAxis,
} from "recharts"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/new-york//ui/card"
import {
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/registry/new-york//ui/chart"
import { Separator } from "@/registry/new-york//ui/separator"
export const description = "A collection of health charts."
export const iframeHeight = "900px"
export const containerClassName = "min-h-screen py-12"
export default function Charts() {
return (
<div className="chart-wrapper mx-auto flex max-w-6xl flex-col flex-wrap items-start justify-center gap-6 p-6 sm:flex-row sm:p-8">
<div className="grid w-full gap-6 sm:grid-cols-2 lg:max-w-[22rem] lg:grid-cols-1 xl:max-w-[25rem]">
<Card className="lg:max-w-md" x-chunk="charts-01-chunk-0">
<CardHeader className="space-y-0 pb-2">
<CardDescription>Today</CardDescription>
<CardTitle className="text-4xl tabular-nums">
12,584{" "}
<span className="font-sans text-sm font-normal tracking-normal text-muted-foreground">
steps
</span>
</CardTitle>
</CardHeader>
<CardContent>
<ChartContainer
config={{
steps: {
label: "Steps",
color: "hsl(var(--chart-1))",
},
}}
>
<BarChart
accessibilityLayer
margin={{
left: -4,
right: -4,
}}
data={[
{
date: "2024-01-01",
steps: 2000,
},
{
date: "2024-01-02",
steps: 2100,
},
{
date: "2024-01-03",
steps: 2200,
},
{
date: "2024-01-04",
steps: 1300,
},
{
date: "2024-01-05",
steps: 1400,
},
{
date: "2024-01-06",
steps: 2500,
},
{
date: "2024-01-07",
steps: 1600,
},
]}
>
<Bar
dataKey="steps"
fill="var(--color-steps)"
radius={5}
fillOpacity={0.6}
activeBar={<Rectangle fillOpacity={0.8} />}
/>
<XAxis
dataKey="date"
tickLine={false}
axisLine={false}
tickMargin={4}
tickFormatter={(value) => {
return new Date(value).toLocaleDateString("en-US", {
weekday: "short",
})
}}
/>
<ChartTooltip
defaultIndex={2}
content={
<ChartTooltipContent
hideIndicator
labelFormatter={(value) => {
return new Date(value).toLocaleDateString("en-US", {
day: "numeric",
month: "long",
year: "numeric",
})
}}
/>
}
cursor={false}
/>
<ReferenceLine
y={1200}
stroke="hsl(var(--muted-foreground))"
strokeDasharray="3 3"
strokeWidth={1}
>
<Label
position="insideBottomLeft"
value="Average Steps"
offset={10}
fill="hsl(var(--foreground))"
/>
<Label
position="insideTopLeft"
value="12,343"
className="text-lg"
fill="hsl(var(--foreground))"
offset={10}
startOffset={100}
/>
</ReferenceLine>
</BarChart>
</ChartContainer>
</CardContent>
<CardFooter className="flex-col items-start gap-1">
<CardDescription>
Over the past 7 days, you have walked{" "}
<span className="font-medium text-foreground">53,305</span> steps.
</CardDescription>
<CardDescription>
You need{" "}
<span className="font-medium text-foreground">12,584</span> more
steps to reach your goal.
</CardDescription>
</CardFooter>
</Card>
<Card className="flex flex-col lg:max-w-md" x-chunk="charts-01-chunk-1">
<CardHeader className="flex flex-row items-center gap-4 space-y-0 pb-2 [&>div]:flex-1">
<div>
<CardDescription>Resting HR</CardDescription>
<CardTitle className="flex items-baseline gap-1 text-4xl tabular-nums">
62
<span className="text-sm font-normal tracking-normal text-muted-foreground">
bpm
</span>
</CardTitle>
</div>
<div>
<CardDescription>Variability</CardDescription>
<CardTitle className="flex items-baseline gap-1 text-4xl tabular-nums">
35
<span className="text-sm font-normal tracking-normal text-muted-foreground">
ms
</span>
</CardTitle>
</div>
</CardHeader>
<CardContent className="flex flex-1 items-center">
<ChartContainer
config={{
resting: {
label: "Resting",
color: "hsl(var(--chart-1))",
},
}}
className="w-full"
>
<LineChart
accessibilityLayer
margin={{
left: 14,
right: 14,
top: 10,
}}
data={[
{
date: "2024-01-01",
resting: 62,
},
{
date: "2024-01-02",
resting: 72,
},
{
date: "2024-01-03",
resting: 35,
},
{
date: "2024-01-04",
resting: 62,
},
{
date: "2024-01-05",
resting: 52,
},
{
date: "2024-01-06",
resting: 62,
},
{
date: "2024-01-07",
resting: 70,
},
]}
>
<CartesianGrid
strokeDasharray="4 4"
vertical={false}
stroke="hsl(var(--muted-foreground))"
strokeOpacity={0.5}
/>
<YAxis hide domain={["dataMin - 10", "dataMax + 10"]} />
<XAxis
dataKey="date"
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => {
return new Date(value).toLocaleDateString("en-US", {
weekday: "short",
})
}}
/>
<Line
dataKey="resting"
type="natural"
fill="var(--color-resting)"
stroke="var(--color-resting)"
strokeWidth={2}
dot={false}
activeDot={{
fill: "var(--color-resting)",
stroke: "var(--color-resting)",
r: 4,
}}
/>
<ChartTooltip
content={
<ChartTooltipContent
indicator="line"
labelFormatter={(value) => {
return new Date(value).toLocaleDateString("en-US", {
day: "numeric",
month: "long",
year: "numeric",
})
}}
/>
}
cursor={false}
/>
</LineChart>
</ChartContainer>
</CardContent>
</Card>
</div>
<div className="grid w-full flex-1 gap-6 lg:max-w-[20rem]">
<Card className="max-w-xs" x-chunk="charts-01-chunk-2">
<CardHeader>
<CardTitle>Progress</CardTitle>
<CardDescription>
You're average more steps a day this year than last year.
</CardDescription>
</CardHeader>
<CardContent className="grid gap-4">
<div className="grid auto-rows-min gap-2">
<div className="flex items-baseline gap-1 text-2xl font-bold tabular-nums leading-none">
12,453
<span className="text-sm font-normal text-muted-foreground">
steps/day
</span>
</div>
<ChartContainer
config={{
steps: {
label: "Steps",
color: "hsl(var(--chart-1))",
},
}}
className="aspect-auto h-[32px] w-full"
>
<BarChart
accessibilityLayer
layout="vertical"
margin={{
left: 0,
top: 0,
right: 0,
bottom: 0,
}}
data={[
{
date: "2024",
steps: 12435,
},
]}
>
<Bar
dataKey="steps"
fill="var(--color-steps)"
radius={4}
barSize={32}
>
<LabelList
position="insideLeft"
dataKey="date"
offset={8}
fontSize={12}
fill="white"
/>
</Bar>
<YAxis dataKey="date" type="category" tickCount={1} hide />
<XAxis dataKey="steps" type="number" hide />
</BarChart>
</ChartContainer>
</div>
<div className="grid auto-rows-min gap-2">
<div className="flex items-baseline gap-1 text-2xl font-bold tabular-nums leading-none">
10,103
<span className="text-sm font-normal text-muted-foreground">
steps/day
</span>
</div>
<ChartContainer
config={{
steps: {
label: "Steps",
color: "hsl(var(--muted))",
},
}}
className="aspect-auto h-[32px] w-full"
>
<BarChart
accessibilityLayer
layout="vertical"
margin={{
left: 0,
top: 0,
right: 0,
bottom: 0,
}}
data={[
{
date: "2023",
steps: 10103,
},
]}
>
<Bar
dataKey="steps"
fill="var(--color-steps)"
radius={4}
barSize={32}
>
<LabelList
position="insideLeft"
dataKey="date"
offset={8}
fontSize={12}
fill="hsl(var(--muted-foreground))"
/>
</Bar>
<YAxis dataKey="date" type="category" tickCount={1} hide />
<XAxis dataKey="steps" type="number" hide />
</BarChart>
</ChartContainer>
</div>
</CardContent>
</Card>
<Card className="max-w-xs" x-chunk="charts-01-chunk-3">
<CardHeader className="p-4 pb-0">
<CardTitle>Walking Distance</CardTitle>
<CardDescription>
Over the last 7 days, your distance walked and run was 12.5 miles
per day.
</CardDescription>
</CardHeader>
<CardContent className="flex flex-row items-baseline gap-4 p-4 pt-0">
<div className="flex items-baseline gap-1 text-3xl font-bold tabular-nums leading-none">
12.5
<span className="text-sm font-normal text-muted-foreground">
miles/day
</span>
</div>
<ChartContainer
config={{
steps: {
label: "Steps",
color: "hsl(var(--chart-1))",
},
}}
className="ml-auto w-[72px]"
>
<BarChart
accessibilityLayer
margin={{
left: 0,
right: 0,
top: 0,
bottom: 0,
}}
data={[
{
date: "2024-01-01",
steps: 2000,
},
{
date: "2024-01-02",
steps: 2100,
},
{
date: "2024-01-03",
steps: 2200,
},
{
date: "2024-01-04",
steps: 1300,
},
{
date: "2024-01-05",
steps: 1400,
},
{
date: "2024-01-06",
steps: 2500,
},
{
date: "2024-01-07",
steps: 1600,
},
]}
>
<Bar
dataKey="steps"
fill="var(--color-steps)"
radius={2}
fillOpacity={0.2}
activeIndex={6}
activeBar={<Rectangle fillOpacity={0.8} />}
/>
<XAxis
dataKey="date"
tickLine={false}
axisLine={false}
tickMargin={4}
hide
/>
</BarChart>
</ChartContainer>
</CardContent>
</Card>
<Card className="max-w-xs" x-chunk="charts-01-chunk-4">
<CardContent className="flex gap-4 p-4 pb-2">
<ChartContainer
config={{
move: {
label: "Move",
color: "hsl(var(--chart-1))",
},
stand: {
label: "Stand",
color: "hsl(var(--chart-2))",
},
exercise: {
label: "Exercise",
color: "hsl(var(--chart-3))",
},
}}
className="h-[140px] w-full"
>
<BarChart
margin={{
left: 0,
right: 0,
top: 0,
bottom: 10,
}}
data={[
{
activity: "stand",
value: (8 / 12) * 100,
label: "8/12 hr",
fill: "var(--color-stand)",
},
{
activity: "exercise",
value: (46 / 60) * 100,
label: "46/60 min",
fill: "var(--color-exercise)",
},
{
activity: "move",
value: (245 / 360) * 100,
label: "245/360 kcal",
fill: "var(--color-move)",
},
]}
layout="vertical"
barSize={32}
barGap={2}
>
<XAxis type="number" dataKey="value" hide />
<YAxis
dataKey="activity"
type="category"
tickLine={false}
tickMargin={4}
axisLine={false}
className="capitalize"
/>
<Bar dataKey="value" radius={5}>
<LabelList
position="insideLeft"
dataKey="label"
fill="white"
offset={8}
fontSize={12}
/>
</Bar>
</BarChart>
</ChartContainer>
</CardContent>
<CardFooter className="flex flex-row border-t p-4">
<div className="flex w-full items-center gap-2">
<div className="grid flex-1 auto-rows-min gap-0.5">
<div className="text-xs text-muted-foreground">Move</div>
<div className="flex items-baseline gap-1 text-2xl font-bold tabular-nums leading-none">
562
<span className="text-sm font-normal text-muted-foreground">
kcal
</span>
</div>
</div>
<Separator orientation="vertical" className="mx-2 h-10 w-px" />
<div className="grid flex-1 auto-rows-min gap-0.5">
<div className="text-xs text-muted-foreground">Exercise</div>
<div className="flex items-baseline gap-1 text-2xl font-bold tabular-nums leading-none">
73
<span className="text-sm font-normal text-muted-foreground">
min
</span>
</div>
</div>
<Separator orientation="vertical" className="mx-2 h-10 w-px" />
<div className="grid flex-1 auto-rows-min gap-0.5">
<div className="text-xs text-muted-foreground">Stand</div>
<div className="flex items-baseline gap-1 text-2xl font-bold tabular-nums leading-none">
14
<span className="text-sm font-normal text-muted-foreground">
hr
</span>
</div>
</div>
</div>
</CardFooter>
</Card>
</div>
<div className="grid w-full flex-1 gap-6">
<Card className="max-w-xs" x-chunk="charts-01-chunk-5">
<CardContent className="flex gap-4 p-4">
<div className="grid items-center gap-2">
<div className="grid flex-1 auto-rows-min gap-0.5">
<div className="text-sm text-muted-foreground">Move</div>
<div className="flex items-baseline gap-1 text-xl font-bold tabular-nums leading-none">
562/600
<span className="text-sm font-normal text-muted-foreground">
kcal
</span>
</div>
</div>
<div className="grid flex-1 auto-rows-min gap-0.5">
<div className="text-sm text-muted-foreground">Exercise</div>
<div className="flex items-baseline gap-1 text-xl font-bold tabular-nums leading-none">
73/120
<span className="text-sm font-normal text-muted-foreground">
min
</span>
</div>
</div>
<div className="grid flex-1 auto-rows-min gap-0.5">
<div className="text-sm text-muted-foreground">Stand</div>
<div className="flex items-baseline gap-1 text-xl font-bold tabular-nums leading-none">
8/12
<span className="text-sm font-normal text-muted-foreground">
hr
</span>
</div>
</div>
</div>
<ChartContainer
config={{
move: {
label: "Move",
color: "hsl(var(--chart-1))",
},
exercise: {
label: "Exercise",
color: "hsl(var(--chart-2))",
},
stand: {
label: "Stand",
color: "hsl(var(--chart-3))",
},
}}
className="mx-auto aspect-square w-full max-w-[80%]"
>
<RadialBarChart
margin={{
left: -10,
right: -10,
top: -10,
bottom: -10,
}}
data={[
{
activity: "stand",
value: (8 / 12) * 100,
fill: "var(--color-stand)",
},
{
activity: "exercise",
value: (46 / 60) * 100,
fill: "var(--color-exercise)",
},
{
activity: "move",
value: (245 / 360) * 100,
fill: "var(--color-move)",
},
]}
innerRadius="20%"
barSize={24}
startAngle={90}
endAngle={450}
>
<PolarAngleAxis
type="number"
domain={[0, 100]}
dataKey="value"
tick={false}
/>
<RadialBar dataKey="value" background cornerRadius={5} />
</RadialBarChart>
</ChartContainer>
</CardContent>
</Card>
<Card className="max-w-xs" x-chunk="charts-01-chunk-6">
<CardHeader className="p-4 pb-0">
<CardTitle>Active Energy</CardTitle>
<CardDescription>
You're burning an average of 754 calories per day. Good job!
</CardDescription>
</CardHeader>
<CardContent className="flex flex-row items-baseline gap-4 p-4 pt-2">
<div className="flex items-baseline gap-2 text-3xl font-bold tabular-nums leading-none">
1,254
<span className="text-sm font-normal text-muted-foreground">
kcal/day
</span>
</div>
<ChartContainer
config={{
calories: {
label: "Calories",
color: "hsl(var(--chart-1))",
},
}}
className="ml-auto w-[64px]"
>
<BarChart
accessibilityLayer
margin={{
left: 0,
right: 0,
top: 0,
bottom: 0,
}}
data={[
{
date: "2024-01-01",
calories: 354,
},
{
date: "2024-01-02",
calories: 514,
},
{
date: "2024-01-03",
calories: 345,
},
{
date: "2024-01-04",
calories: 734,
},
{
date: "2024-01-05",
calories: 645,
},
{
date: "2024-01-06",
calories: 456,
},
{
date: "2024-01-07",
calories: 345,
},
]}
>
<Bar
dataKey="calories"
fill="var(--color-calories)"
radius={2}
fillOpacity={0.2}
activeIndex={6}
activeBar={<Rectangle fillOpacity={0.8} />}
/>
<XAxis
dataKey="date"
tickLine={false}
axisLine={false}
tickMargin={4}
hide
/>
</BarChart>
</ChartContainer>
</CardContent>
</Card>
<Card className="max-w-xs" x-chunk="charts-01-chunk-7">
<CardHeader className="space-y-0 pb-0">
<CardDescription>Time in Bed</CardDescription>
<CardTitle className="flex items-baseline gap-1 text-4xl tabular-nums">
8
<span className="font-sans text-sm font-normal tracking-normal text-muted-foreground">
hr
</span>
35
<span className="font-sans text-sm font-normal tracking-normal text-muted-foreground">
min
</span>
</CardTitle>
</CardHeader>
<CardContent className="p-0">
<ChartContainer
config={{
time: {
label: "Time",
color: "hsl(var(--chart-2))",
},
}}
>
<AreaChart
accessibilityLayer
data={[
{
date: "2024-01-01",
time: 8.5,
},
{
date: "2024-01-02",
time: 7.2,
},
{
date: "2024-01-03",
time: 8.1,
},
{
date: "2024-01-04",
time: 6.2,
},
{
date: "2024-01-05",
time: 5.2,
},
{
date: "2024-01-06",
time: 8.1,
},
{
date: "2024-01-07",
time: 7.0,
},
]}
margin={{
left: 0,
right: 0,
top: 0,
bottom: 0,
}}
>
<XAxis dataKey="date" hide />
<YAxis domain={["dataMin - 5", "dataMax + 2"]} hide />
<defs>
<linearGradient id="fillTime" x1="0" y1="0" x2="0" y2="1">
<stop
offset="5%"
stopColor="var(--color-time)"
stopOpacity={0.8}
/>
<stop
offset="95%"
stopColor="var(--color-time)"
stopOpacity={0.1}
/>
</linearGradient>
</defs>
<Area
dataKey="time"
type="natural"
fill="url(#fillTime)"
fillOpacity={0.4}
stroke="var(--color-time)"
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent hideLabel />}
formatter={(value) => (
<div className="flex min-w-[120px] items-center text-xs text-muted-foreground">
Time in bed
<div className="ml-auto flex items-baseline gap-0.5 font-mono font-medium tabular-nums text-foreground">
{value}
<span className="font-normal text-muted-foreground">
hr
</span>
</div>
</div>
)}
/>
</AreaChart>
</ChartContainer>
</CardContent>
</Card>
</div>
</div>
)
}
| shadcn-ui/ui/apps/www/__registry__/new-york/block/charts-01.tsx | {
"file_path": "shadcn-ui/ui/apps/www/__registry__/new-york/block/charts-01.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 19286
} | 76 |
import { Metadata } from "next"
import Link from "next/link"
import { Announcement } from "@/components/announcement"
import {
PageActions,
PageHeader,
PageHeaderDescription,
PageHeaderHeading,
} from "@/components/page-header"
import { Button } from "@/registry/new-york/ui/button"
export const metadata: Metadata = {
title: "Beautiful Charts",
description:
"Built using Recharts. Copy and paste into your apps. Open Source.",
}
export default function ChartsLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<div className="container relative">
<PageHeader>
<Announcement />
<PageHeaderHeading>Beautiful Charts</PageHeaderHeading>
<PageHeaderDescription>
Built using Recharts. Copy and paste into your apps. Open Source.
</PageHeaderDescription>
<PageActions>
<Button asChild size="sm">
<a href="#charts">Browse Charts</a>
</Button>
<Button asChild variant="ghost" size="sm">
<Link href="/docs/components/chart">Documentation</Link>
</Button>
</PageActions>
</PageHeader>
<section id="charts" className="scroll-mt-20">
{children}
</section>
</div>
)
}
| shadcn-ui/ui/apps/www/app/(app)/charts/layout.tsx | {
"file_path": "shadcn-ui/ui/apps/www/app/(app)/charts/layout.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 495
} | 77 |
import { ChevronDownIcon } from "@radix-ui/react-icons"
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/registry/new-york/ui/avatar"
import { Button } from "@/registry/new-york/ui/button"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/registry/new-york/ui/card"
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
} from "@/registry/new-york/ui/command"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/registry/new-york/ui/popover"
export function DemoTeamMembers() {
return (
<Card>
<CardHeader>
<CardTitle>Team Members</CardTitle>
<CardDescription>
Invite your team members to collaborate.
</CardDescription>
</CardHeader>
<CardContent className="grid gap-6">
<div className="flex items-center justify-between space-x-4">
<div className="flex items-center space-x-4">
<Avatar>
<AvatarImage src="/avatars/01.png" />
<AvatarFallback>OM</AvatarFallback>
</Avatar>
<div>
<p className="text-sm font-medium leading-none">Sofia Davis</p>
<p className="text-sm text-muted-foreground">[email protected]</p>
</div>
</div>
<Popover>
<PopoverTrigger asChild>
<Button variant="outline" className="ml-auto">
Owner{" "}
<ChevronDownIcon className="ml-2 h-4 w-4 text-muted-foreground" />
</Button>
</PopoverTrigger>
<PopoverContent className="p-0" align="end">
<Command>
<CommandInput placeholder="Select new role..." />
<CommandList>
<CommandEmpty>No roles found.</CommandEmpty>
<CommandGroup>
<CommandItem className="teamaspace-y-1 flex flex-col items-start px-4 py-2">
<p>Viewer</p>
<p className="text-sm text-muted-foreground">
Can view and comment.
</p>
</CommandItem>
<CommandItem className="teamaspace-y-1 flex flex-col items-start px-4 py-2">
<p>Developer</p>
<p className="text-sm text-muted-foreground">
Can view, comment and edit.
</p>
</CommandItem>
<CommandItem className="teamaspace-y-1 flex flex-col items-start px-4 py-2">
<p>Billing</p>
<p className="text-sm text-muted-foreground">
Can view, comment and manage billing.
</p>
</CommandItem>
<CommandItem className="teamaspace-y-1 flex flex-col items-start px-4 py-2">
<p>Owner</p>
<p className="text-sm text-muted-foreground">
Admin-level access to all resources.
</p>
</CommandItem>
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
</div>
<div className="flex items-center justify-between space-x-4">
<div className="flex items-center space-x-4">
<Avatar>
<AvatarImage src="/avatars/02.png" />
<AvatarFallback>JL</AvatarFallback>
</Avatar>
<div>
<p className="text-sm font-medium leading-none">Jackson Lee</p>
<p className="text-sm text-muted-foreground">[email protected]</p>
</div>
</div>
<Popover>
<PopoverTrigger asChild>
<Button variant="outline" className="ml-auto">
Member{" "}
<ChevronDownIcon className="ml-2 h-4 w-4 text-muted-foreground" />
</Button>
</PopoverTrigger>
<PopoverContent className="p-0" align="end">
<Command>
<CommandInput placeholder="Select new role..." />
<CommandList>
<CommandEmpty>No roles found.</CommandEmpty>
<CommandGroup className="p-1.5">
<CommandItem className="teamaspace-y-1 flex flex-col items-start px-4 py-2">
<p>Viewer</p>
<p className="text-sm text-muted-foreground">
Can view and comment.
</p>
</CommandItem>
<CommandItem className="teamaspace-y-1 flex flex-col items-start px-4 py-2">
<p>Developer</p>
<p className="text-sm text-muted-foreground">
Can view, comment and edit.
</p>
</CommandItem>
<CommandItem className="teamaspace-y-1 flex flex-col items-start px-4 py-2">
<p>Billing</p>
<p className="text-sm text-muted-foreground">
Can view, comment and manage billing.
</p>
</CommandItem>
<CommandItem className="teamaspace-y-1 flex flex-col items-start px-4 py-2">
<p>Owner</p>
<p className="text-sm text-muted-foreground">
Admin-level access to all resources.
</p>
</CommandItem>
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
</div>
</CardContent>
</Card>
)
}
| shadcn-ui/ui/apps/www/app/(app)/examples/cards/components/team-members.tsx | {
"file_path": "shadcn-ui/ui/apps/www/app/(app)/examples/cards/components/team-members.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 3226
} | 78 |
import { Separator } from "@/registry/new-york/ui/separator"
import { DisplayForm } from "@/app/(app)/examples/forms/display/display-form"
export default function SettingsDisplayPage() {
return (
<div className="space-y-6">
<div>
<h3 className="text-lg font-medium">Display</h3>
<p className="text-sm text-muted-foreground">
Turn items on or off to control what's displayed in the app.
</p>
</div>
<Separator />
<DisplayForm />
</div>
)
}
| shadcn-ui/ui/apps/www/app/(app)/examples/forms/display/page.tsx | {
"file_path": "shadcn-ui/ui/apps/www/app/(app)/examples/forms/display/page.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 217
} | 79 |
import {
Menubar,
MenubarCheckboxItem,
MenubarContent,
MenubarItem,
MenubarLabel,
MenubarMenu,
MenubarRadioGroup,
MenubarRadioItem,
MenubarSeparator,
MenubarShortcut,
MenubarSub,
MenubarSubContent,
MenubarSubTrigger,
MenubarTrigger,
} from "@/registry/new-york/ui/menubar"
export function Menu() {
return (
<Menubar className="rounded-none border-b border-none px-2 lg:px-4">
<MenubarMenu>
<MenubarTrigger className="font-bold">Music</MenubarTrigger>
<MenubarContent>
<MenubarItem>About Music</MenubarItem>
<MenubarSeparator />
<MenubarItem>
Preferences... <MenubarShortcut>,</MenubarShortcut>
</MenubarItem>
<MenubarSeparator />
<MenubarItem>
Hide Music... <MenubarShortcut>H</MenubarShortcut>
</MenubarItem>
<MenubarItem>
Hide Others... <MenubarShortcut>H</MenubarShortcut>
</MenubarItem>
<MenubarShortcut />
<MenubarItem>
Quit Music <MenubarShortcut>Q</MenubarShortcut>
</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger className="relative">File</MenubarTrigger>
<MenubarContent>
<MenubarSub>
<MenubarSubTrigger>New</MenubarSubTrigger>
<MenubarSubContent className="w-[230px]">
<MenubarItem>
Playlist <MenubarShortcut>N</MenubarShortcut>
</MenubarItem>
<MenubarItem disabled>
Playlist from Selection <MenubarShortcut>N</MenubarShortcut>
</MenubarItem>
<MenubarItem>
Smart Playlist... <MenubarShortcut>N</MenubarShortcut>
</MenubarItem>
<MenubarItem>Playlist Folder</MenubarItem>
<MenubarItem disabled>Genius Playlist</MenubarItem>
</MenubarSubContent>
</MenubarSub>
<MenubarItem>
Open Stream URL... <MenubarShortcut>U</MenubarShortcut>
</MenubarItem>
<MenubarItem>
Close Window <MenubarShortcut>W</MenubarShortcut>
</MenubarItem>
<MenubarSeparator />
<MenubarSub>
<MenubarSubTrigger>Library</MenubarSubTrigger>
<MenubarSubContent>
<MenubarItem>Update Cloud Library</MenubarItem>
<MenubarItem>Update Genius</MenubarItem>
<MenubarSeparator />
<MenubarItem>Organize Library...</MenubarItem>
<MenubarItem>Export Library...</MenubarItem>
<MenubarSeparator />
<MenubarItem>Import Playlist...</MenubarItem>
<MenubarItem disabled>Export Playlist...</MenubarItem>
<MenubarItem>Show Duplicate Items</MenubarItem>
<MenubarSeparator />
<MenubarItem>Get Album Artwork</MenubarItem>
<MenubarItem disabled>Get Track Names</MenubarItem>
</MenubarSubContent>
</MenubarSub>
<MenubarItem>
Import... <MenubarShortcut>O</MenubarShortcut>
</MenubarItem>
<MenubarItem disabled>Burn Playlist to Disc...</MenubarItem>
<MenubarSeparator />
<MenubarItem>
Show in Finder <MenubarShortcut>R</MenubarShortcut>{" "}
</MenubarItem>
<MenubarItem>Convert</MenubarItem>
<MenubarSeparator />
<MenubarItem>Page Setup...</MenubarItem>
<MenubarItem disabled>
Print... <MenubarShortcut>P</MenubarShortcut>
</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>Edit</MenubarTrigger>
<MenubarContent>
<MenubarItem disabled>
Undo <MenubarShortcut>Z</MenubarShortcut>
</MenubarItem>
<MenubarItem disabled>
Redo <MenubarShortcut>Z</MenubarShortcut>
</MenubarItem>
<MenubarSeparator />
<MenubarItem disabled>
Cut <MenubarShortcut>X</MenubarShortcut>
</MenubarItem>
<MenubarItem disabled>
Copy <MenubarShortcut>C</MenubarShortcut>
</MenubarItem>
<MenubarItem disabled>
Paste <MenubarShortcut>V</MenubarShortcut>
</MenubarItem>
<MenubarSeparator />
<MenubarItem>
Select All <MenubarShortcut>A</MenubarShortcut>
</MenubarItem>
<MenubarItem disabled>
Deselect All <MenubarShortcut>A</MenubarShortcut>
</MenubarItem>
<MenubarSeparator />
<MenubarItem>
Smart Dictation...{" "}
<MenubarShortcut>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
className="h-4 w-4"
viewBox="0 0 24 24"
>
<path d="m12 8-9.04 9.06a2.82 2.82 0 1 0 3.98 3.98L16 12" />
<circle cx="17" cy="7" r="5" />
</svg>
</MenubarShortcut>
</MenubarItem>
<MenubarItem>
Emoji & Symbols{" "}
<MenubarShortcut>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
className="h-4 w-4"
viewBox="0 0 24 24"
>
<circle cx="12" cy="12" r="10" />
<path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" />
</svg>
</MenubarShortcut>
</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>View</MenubarTrigger>
<MenubarContent>
<MenubarCheckboxItem>Show Playing Next</MenubarCheckboxItem>
<MenubarCheckboxItem checked>Show Lyrics</MenubarCheckboxItem>
<MenubarSeparator />
<MenubarItem inset disabled>
Show Status Bar
</MenubarItem>
<MenubarSeparator />
<MenubarItem inset>Hide Sidebar</MenubarItem>
<MenubarItem disabled inset>
Enter Full Screen
</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger className="hidden md:block">Account</MenubarTrigger>
<MenubarContent forceMount>
<MenubarLabel inset>Switch Account</MenubarLabel>
<MenubarSeparator />
<MenubarRadioGroup value="benoit">
<MenubarRadioItem value="andy">Andy</MenubarRadioItem>
<MenubarRadioItem value="benoit">Benoit</MenubarRadioItem>
<MenubarRadioItem value="Luis">Luis</MenubarRadioItem>
</MenubarRadioGroup>
<MenubarSeparator />
<MenubarItem inset>Manage Family...</MenubarItem>
<MenubarSeparator />
<MenubarItem inset>Add Account...</MenubarItem>
</MenubarContent>
</MenubarMenu>
</Menubar>
)
}
| shadcn-ui/ui/apps/www/app/(app)/examples/music/components/menu.tsx | {
"file_path": "shadcn-ui/ui/apps/www/app/(app)/examples/music/components/menu.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 3979
} | 80 |
export interface Preset {
id: string
name: string
}
export const presets: Preset[] = [
{
id: "9cb0e66a-9937-465d-a188-2c4c4ae2401f",
name: "Grammatical Standard English",
},
{
id: "61eb0e32-2391-4cd3-adc3-66efe09bc0b7",
name: "Summarize for a 2nd grader",
},
{
id: "a4e1fa51-f4ce-4e45-892c-224030a00bdd",
name: "Text to command",
},
{
id: "cc198b13-4933-43aa-977e-dcd95fa30770",
name: "Q&A",
},
{
id: "adfa95be-a575-45fd-a9ef-ea45386c64de",
name: "English to other languages",
},
{
id: "c569a06a-0bd6-43a7-adf9-bf68c09e7a79",
name: "Parse unstructured data",
},
{
id: "15ccc0d7-f37a-4f0a-8163-a37e162877dc",
name: "Classification",
},
{
id: "4641ef41-1c0f-421d-b4b2-70fe431081f3",
name: "Natural language to Python",
},
{
id: "48d34082-72f3-4a1b-a14d-f15aca4f57a0",
name: "Explain code",
},
{
id: "dfd42fd5-0394-4810-92c6-cc907d3bfd1a",
name: "Chat",
},
]
| shadcn-ui/ui/apps/www/app/(app)/examples/playground/data/presets.ts | {
"file_path": "shadcn-ui/ui/apps/www/app/(app)/examples/playground/data/presets.ts",
"repo_id": "shadcn-ui/ui",
"token_count": 537
} | 81 |
import { SiteFooter } from "@/components/site-footer"
import { SiteHeader } from "@/components/site-header"
interface AppLayoutProps {
children: React.ReactNode
}
export default function AppLayout({ children }: AppLayoutProps) {
return (
<>
<SiteHeader />
<main className="flex-1">{children}</main>
<SiteFooter />
</>
)
}
| shadcn-ui/ui/apps/www/app/(app)/layout.tsx | {
"file_path": "shadcn-ui/ui/apps/www/app/(app)/layout.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 133
} | 82 |
"use client"
import * as React from "react"
import { ImperativePanelHandle } from "react-resizable-panels"
import { cn } from "@/lib/utils"
import { useConfig } from "@/hooks/use-config"
import { useLiftMode } from "@/hooks/use-lift-mode"
import { BlockToolbar } from "@/components/block-toolbar"
import { Icons } from "@/components/icons"
import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from "@/registry/new-york/ui/resizable"
import { Tabs, TabsContent } from "@/registry/new-york/ui/tabs"
import { Block } from "@/registry/schema"
export function BlockPreview({
block,
}: {
block: Block & { hasLiftMode: boolean }
}) {
const [config] = useConfig()
const { isLiftMode } = useLiftMode(block.name)
const [isLoading, setIsLoading] = React.useState(true)
const ref = React.useRef<ImperativePanelHandle>(null)
if (config.style !== block.style) {
return null
}
return (
<Tabs
id={block.name}
defaultValue="preview"
className="relative grid w-full scroll-m-20 gap-4"
style={
{
"--container-height": block.container?.height,
} as React.CSSProperties
}
>
<BlockToolbar block={block} resizablePanelRef={ref} />
<TabsContent
value="preview"
className="relative after:absolute after:inset-0 after:right-3 after:z-0 after:rounded-lg after:bg-muted"
>
<ResizablePanelGroup direction="horizontal" className="relative z-10">
<ResizablePanel
ref={ref}
className={cn(
"relative rounded-lg border bg-background",
isLiftMode ? "border-border/50" : "border-border"
)}
defaultSize={100}
minSize={30}
>
{isLoading ? (
<div className="absolute inset-0 z-10 flex h-[--container-height] w-full items-center justify-center gap-2 bg-background text-sm text-muted-foreground">
<Icons.spinner className="h-4 w-4 animate-spin" />
Loading...
</div>
) : null}
<iframe
src={`/blocks/${block.style}/${block.name}`}
height={block.container?.height ?? 450}
className="chunk-mode relative z-20 w-full bg-background"
onLoad={() => {
setIsLoading(false)
}}
allowTransparency
/>
</ResizablePanel>
<ResizableHandle
className={cn(
"relative hidden w-3 bg-transparent p-0 after:absolute after:right-0 after:top-1/2 after:h-8 after:w-[6px] after:-translate-y-1/2 after:translate-x-[-1px] after:rounded-full after:bg-border after:transition-all after:hover:h-10 sm:block",
isLiftMode && "invisible"
)}
/>
<ResizablePanel defaultSize={0} minSize={0} />
</ResizablePanelGroup>
</TabsContent>
<TabsContent value="code">
<div
data-rehype-pretty-code-fragment
dangerouslySetInnerHTML={{ __html: block.highlightedCode }}
className="w-full overflow-hidden rounded-md [&_pre]:my-0 [&_pre]:h-[--container-height] [&_pre]:overflow-auto [&_pre]:whitespace-break-spaces [&_pre]:p-6 [&_pre]:font-mono [&_pre]:text-sm [&_pre]:leading-relaxed"
/>
</TabsContent>
</Tabs>
)
}
| shadcn-ui/ui/apps/www/components/block-preview.tsx | {
"file_path": "shadcn-ui/ui/apps/www/components/block-preview.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1530
} | 83 |
"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
import { CodeBlockWrapper } from "@/components/code-block-wrapper"
interface ComponentSourceProps extends React.HTMLAttributes<HTMLDivElement> {
src: string
}
export function ComponentSource({
children,
className,
...props
}: ComponentSourceProps) {
return (
<CodeBlockWrapper
expandButtonTitle="Expand"
className={cn("my-6 overflow-hidden rounded-md", className)}
>
{children}
</CodeBlockWrapper>
)
}
| shadcn-ui/ui/apps/www/components/component-source.tsx | {
"file_path": "shadcn-ui/ui/apps/www/components/component-source.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 182
} | 84 |
import { siteConfig } from "@/config/site"
export function SiteFooter() {
return (
<footer className="py-6 md:px-8 md:py-0">
<div className="container flex flex-col items-center justify-between gap-4 md:h-24 md:flex-row">
<p className="text-balance text-center text-sm leading-loose text-muted-foreground md:text-left">
Built by{" "}
<a
href={siteConfig.links.twitter}
target="_blank"
rel="noreferrer"
className="font-medium underline underline-offset-4"
>
shadcn
</a>
. The source code is available on{" "}
<a
href={siteConfig.links.github}
target="_blank"
rel="noreferrer"
className="font-medium underline underline-offset-4"
>
GitHub
</a>
.
</p>
</div>
</footer>
)
}
| shadcn-ui/ui/apps/www/components/site-footer.tsx | {
"file_path": "shadcn-ui/ui/apps/www/components/site-footer.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 472
} | 85 |
"use server"
import { promises as fs } from "fs"
import { tmpdir } from "os"
import path from "path"
import { Index } from "@/__registry__"
import { Project, ScriptKind, SourceFile, SyntaxKind } from "ts-morph"
import { z } from "zod"
import { highlightCode } from "@/lib/highlight-code"
import { Style } from "@/registry/registry-styles"
import { BlockChunk, blockSchema, registryEntrySchema } from "@/registry/schema"
const DEFAULT_BLOCKS_STYLE = "default" satisfies Style["name"]
const project = new Project({
compilerOptions: {},
})
export async function getAllBlockIds(
style: Style["name"] = DEFAULT_BLOCKS_STYLE
) {
const blocks = await _getAllBlocks(style)
return blocks.map((block) => block.name)
}
export async function getBlock(
name: string,
style: Style["name"] = DEFAULT_BLOCKS_STYLE
) {
const entry = Index[style][name]
const content = await _getBlockContent(name, style)
const chunks = await Promise.all(
entry.chunks?.map(async (chunk: BlockChunk) => {
const code = await readFile(chunk.file)
const tempFile = await createTempSourceFile(`${chunk.name}.tsx`)
const sourceFile = project.createSourceFile(tempFile, code, {
scriptKind: ScriptKind.TSX,
})
sourceFile
.getDescendantsOfKind(SyntaxKind.JsxOpeningElement)
.filter((node) => {
return node.getAttribute("x-chunk") !== undefined
})
?.map((component) => {
component
.getAttribute("x-chunk")
?.asKind(SyntaxKind.JsxAttribute)
?.remove()
})
return {
...chunk,
code: sourceFile
.getText()
.replaceAll(`@/registry/${style}/`, "@/components/"),
}
})
)
return blockSchema.parse({
style,
highlightedCode: content.code ? await highlightCode(content.code) : "",
...entry,
...content,
chunks,
type: "registry:block",
})
}
async function _getAllBlocks(style: Style["name"] = DEFAULT_BLOCKS_STYLE) {
const index = z.record(registryEntrySchema).parse(Index[style])
return Object.values(index).filter((block) => block.type === "registry:block")
}
async function _getBlockCode(
name: string,
style: Style["name"] = DEFAULT_BLOCKS_STYLE
) {
const entry = Index[style][name]
if (!entry) {
console.error(`Block ${name} not found in style ${style}`)
return ""
}
const block = registryEntrySchema.parse(entry)
if (!block.source) {
return ""
}
return await readFile(block.source)
}
async function readFile(source: string) {
const filepath = path.join(process.cwd(), source)
return await fs.readFile(filepath, "utf-8")
}
async function createTempSourceFile(filename: string) {
const dir = await fs.mkdtemp(path.join(tmpdir(), "codex-"))
return path.join(dir, filename)
}
async function _getBlockContent(name: string, style: Style["name"]) {
const raw = await _getBlockCode(name, style)
const tempFile = await createTempSourceFile(`${name}.tsx`)
const sourceFile = project.createSourceFile(tempFile, raw, {
scriptKind: ScriptKind.TSX,
})
// Extract meta.
const iframeHeight = _extractVariable(sourceFile, "iframeHeight")
const containerClassName = _extractVariable(sourceFile, "containerClassName")
// Format the code.
let code = sourceFile.getText()
code = code.replaceAll(`@/registry/${style}/`, "@/components/")
code = code.replaceAll("export default", "export")
return {
code,
container: {
height: iframeHeight,
className: containerClassName,
},
}
}
function _extractVariable(sourceFile: SourceFile, name: string) {
const variable = sourceFile.getVariableDeclaration(name)
if (!variable) {
return null
}
const value = variable
.getInitializerIfKindOrThrow(SyntaxKind.StringLiteral)
.getLiteralValue()
variable.remove()
return value
}
| shadcn-ui/ui/apps/www/lib/blocks.ts | {
"file_path": "shadcn-ui/ui/apps/www/lib/blocks.ts",
"repo_id": "shadcn-ui/ui",
"token_count": 1420
} | 86 |
import Link from "next/link"
import { Button } from "@/registry/default/ui/button"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/registry/default/ui/card"
import { Input } from "@/registry/default/ui/input"
import { Label } from "@/registry/default/ui/label"
export const description =
"A sign up form with first name, last name, email and password inside a card. There's an option to sign up with GitHub and a link to login if you already have an account"
export const iframeHeight = "600px"
export const containerClassName =
"w-full h-screen flex items-center justify-center px-4"
export default function LoginForm() {
return (
<Card className="mx-auto max-w-sm">
<CardHeader>
<CardTitle className="text-xl">Sign Up</CardTitle>
<CardDescription>
Enter your information to create an account
</CardDescription>
</CardHeader>
<CardContent>
<div className="grid gap-4">
<div className="grid grid-cols-2 gap-4">
<div className="grid gap-2">
<Label htmlFor="first-name">First name</Label>
<Input id="first-name" placeholder="Max" required />
</div>
<div className="grid gap-2">
<Label htmlFor="last-name">Last name</Label>
<Input id="last-name" placeholder="Robinson" required />
</div>
</div>
<div className="grid gap-2">
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
placeholder="[email protected]"
required
/>
</div>
<div className="grid gap-2">
<Label htmlFor="password">Password</Label>
<Input id="password" type="password" />
</div>
<Button type="submit" className="w-full">
Create an account
</Button>
<Button variant="outline" className="w-full">
Sign up with GitHub
</Button>
</div>
<div className="mt-4 text-center text-sm">
Already have an account?{" "}
<Link href="#" className="underline">
Sign in
</Link>
</div>
</CardContent>
</Card>
)
}
| shadcn-ui/ui/apps/www/registry/default/block/authentication-03.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/block/authentication-03.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1034
} | 87 |
"use client"
import { TrendingUp } from "lucide-react"
import { Bar, BarChart, CartesianGrid, LabelList, XAxis, YAxis } from "recharts"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/default/ui/card"
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/registry/default/ui/chart"
export const description = "A bar chart with a custom label"
const chartData = [
{ month: "January", desktop: 186, mobile: 80 },
{ month: "February", desktop: 305, mobile: 200 },
{ month: "March", desktop: 237, mobile: 120 },
{ month: "April", desktop: 73, mobile: 190 },
{ month: "May", desktop: 209, mobile: 130 },
{ month: "June", desktop: 214, mobile: 140 },
]
const chartConfig = {
desktop: {
label: "Desktop",
color: "hsl(var(--chart-1))",
},
mobile: {
label: "Mobile",
color: "hsl(var(--chart-2))",
},
label: {
color: "hsl(var(--background))",
},
} satisfies ChartConfig
export default function Component() {
return (
<Card>
<CardHeader>
<CardTitle>Bar Chart - Custom Label</CardTitle>
<CardDescription>January - June 2024</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={chartConfig}>
<BarChart
accessibilityLayer
data={chartData}
layout="vertical"
margin={{
right: 16,
}}
>
<CartesianGrid horizontal={false} />
<YAxis
dataKey="month"
type="category"
tickLine={false}
tickMargin={10}
axisLine={false}
tickFormatter={(value) => value.slice(0, 3)}
hide
/>
<XAxis dataKey="desktop" type="number" hide />
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator="line" />}
/>
<Bar
dataKey="desktop"
layout="vertical"
fill="var(--color-desktop)"
radius={4}
>
<LabelList
dataKey="month"
position="insideLeft"
offset={8}
className="fill-[--color-label]"
fontSize={12}
/>
<LabelList
dataKey="desktop"
position="right"
offset={8}
className="fill-foreground"
fontSize={12}
/>
</Bar>
</BarChart>
</ChartContainer>
</CardContent>
<CardFooter className="flex-col items-start gap-2 text-sm">
<div className="flex gap-2 font-medium leading-none">
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
</div>
<div className="leading-none text-muted-foreground">
Showing total visitors for the last 6 months
</div>
</CardFooter>
</Card>
)
}
| shadcn-ui/ui/apps/www/registry/default/block/chart-bar-label-custom.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/block/chart-bar-label-custom.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1489
} | 88 |
"use client"
import { TrendingUp } from "lucide-react"
import { PolarAngleAxis, PolarGrid, Radar, RadarChart } from "recharts"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/default/ui/card"
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/registry/default/ui/chart"
export const description = "A radar chart with a custom grid"
const chartData = [
{ month: "January", desktop: 186 },
{ month: "February", desktop: 305 },
{ month: "March", desktop: 237 },
{ month: "April", desktop: 273 },
{ month: "May", desktop: 209 },
{ month: "June", desktop: 214 },
]
const chartConfig = {
desktop: {
label: "Desktop",
color: "hsl(var(--chart-1))",
},
} satisfies ChartConfig
export default function Component() {
return (
<Card>
<CardHeader className="items-center pb-4">
<CardTitle>Radar Chart - Grid Custom</CardTitle>
<CardDescription>
Showing total visitors for the last 6 months
</CardDescription>
</CardHeader>
<CardContent className="pb-0">
<ChartContainer
config={chartConfig}
className="mx-auto aspect-square max-h-[250px]"
>
<RadarChart data={chartData}>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent hideLabel />}
/>
<PolarGrid radialLines={false} polarRadius={[90]} strokeWidth={1} />
<PolarAngleAxis dataKey="month" />
<Radar
dataKey="desktop"
fill="var(--color-desktop)"
fillOpacity={0.6}
/>
</RadarChart>
</ChartContainer>
</CardContent>
<CardFooter className="flex-col gap-2 text-sm">
<div className="flex items-center gap-2 font-medium leading-none">
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
</div>
<div className="flex items-center gap-2 leading-none text-muted-foreground">
January - June 2024
</div>
</CardFooter>
</Card>
)
}
| shadcn-ui/ui/apps/www/registry/default/block/chart-radar-grid-custom.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/block/chart-radar-grid-custom.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 922
} | 89 |
"use client"
import { Button } from "@/registry/default/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/default/ui/card"
import { Checkbox } from "@/registry/default/ui/checkbox"
import { Input } from "@/registry/default/ui/input"
export default function Component() {
return (
<Card x-chunk="dashboard-04-chunk-2">
<CardHeader>
<CardTitle>Plugins Directory</CardTitle>
<CardDescription>
The directory within your project, in which your plugins are located.
</CardDescription>
</CardHeader>
<CardContent>
<form className="flex flex-col gap-4">
<Input placeholder="Project Name" defaultValue="/content/plugins" />
<div className="flex items-center space-x-2">
<Checkbox id="include" defaultChecked />
<label
htmlFor="include"
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
>
Allow administrators to change the directory.
</label>
</div>
</form>
</CardContent>
<CardFooter className="border-t px-6 py-4">
<Button>Save</Button>
</CardFooter>
</Card>
)
}
| shadcn-ui/ui/apps/www/registry/default/block/dashboard-04-chunk-2.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/block/dashboard-04-chunk-2.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 552
} | 90 |
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/registry/default/ui/alert-dialog"
import { Button } from "@/registry/default/ui/button"
export default function AlertDialogDemo() {
return (
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Show Dialog</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete your
account and remove your data from our servers.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/alert-dialog-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/alert-dialog-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 393
} | 91 |
import { Button } from "@/registry/default/ui/button"
export default function ButtonGhost() {
return <Button variant="ghost">Ghost</Button>
}
| shadcn-ui/ui/apps/www/registry/default/example/button-ghost.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/button-ghost.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 41
} | 92 |
"use client"
import { Icons } from "@/components/icons"
import { Button } from "@/registry/default/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/default/ui/card"
import { Input } from "@/registry/default/ui/input"
import { Label } from "@/registry/default/ui/label"
export function CardsCreateAccount() {
return (
<Card>
<CardHeader className="space-y-1">
<CardTitle className="text-2xl">Create an account</CardTitle>
<CardDescription>
Enter your email below to create your account
</CardDescription>
</CardHeader>
<CardContent className="grid gap-4">
<div className="grid grid-cols-2 gap-6">
<Button variant="outline">
<Icons.gitHub className="mr-2 h-4 w-4" />
Github
</Button>
<Button variant="outline">
<Icons.google className="mr-2 h-4 w-4" />
Google
</Button>
</div>
<div className="relative">
<div className="absolute inset-0 flex items-center">
<span className="w-full border-t" />
</div>
<div className="relative flex justify-center text-xs uppercase">
<span className="bg-background px-2 text-muted-foreground">
Or continue with
</span>
</div>
</div>
<div className="grid gap-2">
<Label htmlFor="email">Email</Label>
<Input id="email" type="email" placeholder="[email protected]" />
</div>
<div className="grid gap-2">
<Label htmlFor="password">Password</Label>
<Input id="password" type="password" />
</div>
</CardContent>
<CardFooter>
<Button className="w-full">Create account</Button>
</CardFooter>
</Card>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/cards/create-account.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/cards/create-account.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 845
} | 93 |
"use client"
import { Bar, BarChart, CartesianGrid } from "recharts"
import { ChartConfig, ChartContainer } from "@/registry/default/ui/chart"
const chartData = [
{ month: "January", desktop: 186, mobile: 80 },
{ month: "February", desktop: 305, mobile: 200 },
{ month: "March", desktop: 237, mobile: 120 },
{ month: "April", desktop: 73, mobile: 190 },
{ month: "May", desktop: 209, mobile: 130 },
{ month: "June", desktop: 214, mobile: 140 },
]
const chartConfig = {
desktop: {
label: "Desktop",
color: "#2563eb",
},
mobile: {
label: "Mobile",
color: "#60a5fa",
},
} satisfies ChartConfig
export default function Component() {
return (
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
<BarChart accessibilityLayer data={chartData}>
<CartesianGrid vertical={false} />
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
</BarChart>
</ChartContainer>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/chart-bar-demo-grid.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/chart-bar-demo-grid.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 373
} | 94 |
import {
Calculator,
Calendar,
CreditCard,
Settings,
Smile,
User,
} from "lucide-react"
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
CommandShortcut,
} from "@/registry/default/ui/command"
export default function CommandDemo() {
return (
<Command className="rounded-lg border shadow-md md:min-w-[450px]">
<CommandInput placeholder="Type a command or search..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Suggestions">
<CommandItem>
<Calendar className="mr-2 h-4 w-4" />
<span>Calendar</span>
</CommandItem>
<CommandItem>
<Smile className="mr-2 h-4 w-4" />
<span>Search Emoji</span>
</CommandItem>
<CommandItem disabled>
<Calculator className="mr-2 h-4 w-4" />
<span>Calculator</span>
</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Settings">
<CommandItem>
<User className="mr-2 h-4 w-4" />
<span>Profile</span>
<CommandShortcut>P</CommandShortcut>
</CommandItem>
<CommandItem>
<CreditCard className="mr-2 h-4 w-4" />
<span>Billing</span>
<CommandShortcut>B</CommandShortcut>
</CommandItem>
<CommandItem>
<Settings className="mr-2 h-4 w-4" />
<span>Settings</span>
<CommandShortcut>S</CommandShortcut>
</CommandItem>
</CommandGroup>
</CommandList>
</Command>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/command-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/command-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 808
} | 95 |
import { Input } from "@/registry/default/ui/input"
export default function InputDemo() {
return <Input type="email" placeholder="Email" />
}
| shadcn-ui/ui/apps/www/registry/default/example/input-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/input-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 43
} | 96 |
import {
Pagination,
PaginationContent,
PaginationEllipsis,
PaginationItem,
PaginationLink,
PaginationNext,
PaginationPrevious,
} from "@/registry/default/ui/pagination"
export default function PaginationDemo() {
return (
<Pagination>
<PaginationContent>
<PaginationItem>
<PaginationPrevious href="#" />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#">1</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" isActive>
2
</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationLink href="#">3</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationEllipsis />
</PaginationItem>
<PaginationItem>
<PaginationNext href="#" />
</PaginationItem>
</PaginationContent>
</Pagination>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/pagination-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/pagination-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 448
} | 97 |
"use client"
import { Button } from "@/registry/default/ui/button"
import { Input } from "@/registry/default/ui/input"
import { Label } from "@/registry/default/ui/label"
import {
Sheet,
SheetClose,
SheetContent,
SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/registry/default/ui/sheet"
const SHEET_SIDES = ["top", "right", "bottom", "left"] as const
type SheetSide = (typeof SHEET_SIDES)[number]
export default function SheetSide() {
return (
<div className="grid grid-cols-2 gap-2">
{SHEET_SIDES.map((side) => (
<Sheet key={side}>
<SheetTrigger asChild>
<Button variant="outline">{side}</Button>
</SheetTrigger>
<SheetContent side={side}>
<SheetHeader>
<SheetTitle>Edit profile</SheetTitle>
<SheetDescription>
Make changes to your profile here. Click save when you're done.
</SheetDescription>
</SheetHeader>
<div className="grid gap-4 py-4">
<div className="grid grid-cols-4 items-center gap-4">
<Label htmlFor="name" className="text-right">
Name
</Label>
<Input id="name" value="Pedro Duarte" className="col-span-3" />
</div>
<div className="grid grid-cols-4 items-center gap-4">
<Label htmlFor="username" className="text-right">
Username
</Label>
<Input id="username" value="@peduarte" className="col-span-3" />
</div>
</div>
<SheetFooter>
<SheetClose asChild>
<Button type="submit">Save changes</Button>
</SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>
))}
</div>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/sheet-side.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/sheet-side.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 931
} | 98 |
"use client"
import { useToast } from "@/registry/default/hooks/use-toast"
import { Button } from "@/registry/default/ui/button"
import { ToastAction } from "@/registry/default/ui/toast"
export default function ToastDestructive() {
const { toast } = useToast()
return (
<Button
variant="outline"
onClick={() => {
toast({
variant: "destructive",
title: "Uh oh! Something went wrong.",
description: "There was a problem with your request.",
action: <ToastAction altText="Try again">Try again</ToastAction>,
})
}}
>
Show Toast
</Button>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/toast-destructive.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/toast-destructive.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 257
} | 99 |
import { Button } from "@/registry/default/ui/button"
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/registry/default/ui/tooltip"
export default function TooltipDemo() {
return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button variant="outline">Hover</Button>
</TooltipTrigger>
<TooltipContent>
<p>Add to library</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/tooltip-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/tooltip-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 211
} | 100 |
"use client"
import { GripVertical } from "lucide-react"
import * as ResizablePrimitive from "react-resizable-panels"
import { cn } from "@/lib/utils"
const ResizablePanelGroup = ({
className,
...props
}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (
<ResizablePrimitive.PanelGroup
className={cn(
"flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
className
)}
{...props}
/>
)
const ResizablePanel = ResizablePrimitive.Panel
const ResizableHandle = ({
withHandle,
className,
...props
}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
withHandle?: boolean
}) => (
<ResizablePrimitive.PanelResizeHandle
className={cn(
"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
className
)}
{...props}
>
{withHandle && (
<div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border">
<GripVertical className="h-2.5 w-2.5" />
</div>
)}
</ResizablePrimitive.PanelResizeHandle>
)
export { ResizablePanelGroup, ResizablePanel, ResizableHandle }
| shadcn-ui/ui/apps/www/registry/default/ui/resizable.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/ui/resizable.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 626
} | 101 |
"use client"
import * as React from "react"
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
import { cn } from "@/lib/utils"
const TooltipProvider = TooltipPrimitive.Provider
const Tooltip = TooltipPrimitive.Root
const TooltipTrigger = TooltipPrimitive.Trigger
const TooltipContent = React.forwardRef<
React.ElementRef<typeof TooltipPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
>(({ className, sideOffset = 4, ...props }, ref) => (
<TooltipPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={cn(
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className
)}
{...props}
/>
))
TooltipContent.displayName = TooltipPrimitive.Content.displayName
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
| shadcn-ui/ui/apps/www/registry/default/ui/tooltip.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/ui/tooltip.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 408
} | 102 |
"use client"
import { TrendingUp } from "lucide-react"
import { CartesianGrid, LabelList, Line, LineChart, XAxis } from "recharts"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/new-york/ui/card"
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/registry/new-york/ui/chart"
export const description = "A line chart with a label"
const chartData = [
{ month: "January", desktop: 186, mobile: 80 },
{ month: "February", desktop: 305, mobile: 200 },
{ month: "March", desktop: 237, mobile: 120 },
{ month: "April", desktop: 73, mobile: 190 },
{ month: "May", desktop: 209, mobile: 130 },
{ month: "June", desktop: 214, mobile: 140 },
]
const chartConfig = {
desktop: {
label: "Desktop",
color: "hsl(var(--chart-1))",
},
mobile: {
label: "Mobile",
color: "hsl(var(--chart-2))",
},
} satisfies ChartConfig
export default function Component() {
return (
<Card>
<CardHeader>
<CardTitle>Line Chart - Label</CardTitle>
<CardDescription>January - June 2024</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={chartConfig}>
<LineChart
accessibilityLayer
data={chartData}
margin={{
top: 20,
left: 12,
right: 12,
}}
>
<CartesianGrid vertical={false} />
<XAxis
dataKey="month"
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator="line" />}
/>
<Line
dataKey="desktop"
type="natural"
stroke="var(--color-desktop)"
strokeWidth={2}
dot={{
fill: "var(--color-desktop)",
}}
activeDot={{
r: 6,
}}
>
<LabelList
position="top"
offset={12}
className="fill-foreground"
fontSize={12}
/>
</Line>
</LineChart>
</ChartContainer>
</CardContent>
<CardFooter className="flex-col items-start gap-2 text-sm">
<div className="flex gap-2 font-medium leading-none">
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
</div>
<div className="leading-none text-muted-foreground">
Showing total visitors for the last 6 months
</div>
</CardFooter>
</Card>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/block/chart-line-label.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/block/chart-line-label.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1374
} | 103 |
"use client"
import { Bar, BarChart, LabelList, XAxis, YAxis } from "recharts"
import { Card, CardContent, CardFooter } from "@/registry/new-york//ui/card"
import { ChartContainer } from "@/registry/new-york//ui/chart"
import { Separator } from "@/registry/new-york//ui/separator"
export default function Component() {
return (
<Card className="max-w-xs" x-chunk="charts-01-chunk-4">
<CardContent className="flex gap-4 p-4 pb-2">
<ChartContainer
config={{
move: {
label: "Move",
color: "hsl(var(--chart-1))",
},
stand: {
label: "Stand",
color: "hsl(var(--chart-2))",
},
exercise: {
label: "Exercise",
color: "hsl(var(--chart-3))",
},
}}
className="h-[140px] w-full"
>
<BarChart
margin={{
left: 0,
right: 0,
top: 0,
bottom: 10,
}}
data={[
{
activity: "stand",
value: (8 / 12) * 100,
label: "8/12 hr",
fill: "var(--color-stand)",
},
{
activity: "exercise",
value: (46 / 60) * 100,
label: "46/60 min",
fill: "var(--color-exercise)",
},
{
activity: "move",
value: (245 / 360) * 100,
label: "245/360 kcal",
fill: "var(--color-move)",
},
]}
layout="vertical"
barSize={32}
barGap={2}
>
<XAxis type="number" dataKey="value" hide />
<YAxis
dataKey="activity"
type="category"
tickLine={false}
tickMargin={4}
axisLine={false}
className="capitalize"
/>
<Bar dataKey="value" radius={5}>
<LabelList
position="insideLeft"
dataKey="label"
fill="white"
offset={8}
fontSize={12}
/>
</Bar>
</BarChart>
</ChartContainer>
</CardContent>
<CardFooter className="flex flex-row border-t p-4">
<div className="flex w-full items-center gap-2">
<div className="grid flex-1 auto-rows-min gap-0.5">
<div className="text-xs text-muted-foreground">Move</div>
<div className="flex items-baseline gap-1 text-2xl font-bold tabular-nums leading-none">
562
<span className="text-sm font-normal text-muted-foreground">
kcal
</span>
</div>
</div>
<Separator orientation="vertical" className="mx-2 h-10 w-px" />
<div className="grid flex-1 auto-rows-min gap-0.5">
<div className="text-xs text-muted-foreground">Exercise</div>
<div className="flex items-baseline gap-1 text-2xl font-bold tabular-nums leading-none">
73
<span className="text-sm font-normal text-muted-foreground">
min
</span>
</div>
</div>
<Separator orientation="vertical" className="mx-2 h-10 w-px" />
<div className="grid flex-1 auto-rows-min gap-0.5">
<div className="text-xs text-muted-foreground">Stand</div>
<div className="flex items-baseline gap-1 text-2xl font-bold tabular-nums leading-none">
14
<span className="text-sm font-normal text-muted-foreground">
hr
</span>
</div>
</div>
</div>
</CardFooter>
</Card>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/block/charts-01-chunk-4.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/block/charts-01-chunk-4.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 2222
} | 104 |
"use client"
import { CornerDownLeft, Mic, Paperclip } from "lucide-react"
import { Button } from "@/registry/new-york/ui/button"
import { Label } from "@/registry/new-york/ui/label"
import { Textarea } from "@/registry/new-york/ui/textarea"
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/registry/new-york/ui/tooltip"
export default function Component() {
return (
<form
className="relative overflow-hidden rounded-lg border bg-background focus-within:ring-1 focus-within:ring-ring"
x-chunk="dashboard-03-chunk-1"
>
<Label htmlFor="message" className="sr-only">
Message
</Label>
<Textarea
id="message"
placeholder="Type your message here..."
className="min-h-12 resize-none border-0 p-3 shadow-none focus-visible:ring-0"
/>
<div className="flex items-center p-3 pt-0">
<Tooltip>
<TooltipTrigger asChild>
<Button variant="ghost" size="icon">
<Paperclip className="size-4" />
<span className="sr-only">Attach file</span>
</Button>
</TooltipTrigger>
<TooltipContent side="top">Attach File</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Button variant="ghost" size="icon">
<Mic className="size-4" />
<span className="sr-only">Use Microphone</span>
</Button>
</TooltipTrigger>
<TooltipContent side="top">Use Microphone</TooltipContent>
</Tooltip>
<Button type="submit" size="sm" className="ml-auto gap-1.5">
Send Message
<CornerDownLeft className="size-3.5" />
</Button>
</div>
</form>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/block/dashboard-03-chunk-1.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/block/dashboard-03-chunk-1.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 789
} | 105 |
"use client"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/registry/new-york/ui/card"
import { Input } from "@/registry/new-york/ui/input"
import { Label } from "@/registry/new-york/ui/label"
import { Textarea } from "@/registry/new-york/ui/textarea"
export default function Component() {
return (
<Card x-chunk="dashboard-07-chunk-0">
<CardHeader>
<CardTitle>Product Details</CardTitle>
<CardDescription>
Lipsum dolor sit amet, consectetur adipiscing elit
</CardDescription>
</CardHeader>
<CardContent>
<div className="grid gap-6">
<div className="grid gap-3">
<Label htmlFor="name">Name</Label>
<Input
id="name"
type="text"
className="w-full"
defaultValue="Gamer Gear Pro Controller"
/>
</div>
<div className="grid gap-3">
<Label htmlFor="description">Description</Label>
<Textarea
id="description"
defaultValue="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam auctor, nisl nec ultricies ultricies, nunc nisl ultricies nunc, nec ultricies nunc nisl nec nunc."
className="min-h-32"
/>
</div>
</div>
</CardContent>
</Card>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/block/dashboard-07-chunk-0.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/block/dashboard-07-chunk-0.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 658
} | 106 |
"use client"
import * as React from "react"
export function useSidebar() {
const [state, setState] = React.useState<"closed" | "open">("open")
return {
open: state === "open",
onOpenChange: (open: boolean) => setState(open ? "open" : "closed"),
}
}
| shadcn-ui/ui/apps/www/registry/new-york/block/sidebar-01/hooks/use-sidebar.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/block/sidebar-01/hooks/use-sidebar.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 95
} | 107 |
import Link from "next/link"
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/registry/new-york/ui/breadcrumb"
export default function BreadcrumbWithCustomSeparator() {
return (
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink>
<Link href="/">Home</Link>
</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink>
<Link href="/components">Components</Link>
</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/breadcrumb-link.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/breadcrumb-link.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 410
} | 108 |
import * as React from "react"
import { Button } from "@/registry/new-york/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/new-york/ui/card"
import { Input } from "@/registry/new-york/ui/input"
import { Label } from "@/registry/new-york/ui/label"
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/registry/new-york/ui/select"
export default function CardWithForm() {
return (
<Card className="w-[350px]">
<CardHeader>
<CardTitle>Create project</CardTitle>
<CardDescription>Deploy your new project in one-click.</CardDescription>
</CardHeader>
<CardContent>
<form>
<div className="grid w-full items-center gap-4">
<div className="flex flex-col space-y-1.5">
<Label htmlFor="name">Name</Label>
<Input id="name" placeholder="Name of your project" />
</div>
<div className="flex flex-col space-y-1.5">
<Label htmlFor="framework">Framework</Label>
<Select>
<SelectTrigger id="framework">
<SelectValue placeholder="Select" />
</SelectTrigger>
<SelectContent position="popper">
<SelectItem value="next">Next.js</SelectItem>
<SelectItem value="sveltekit">SvelteKit</SelectItem>
<SelectItem value="astro">Astro</SelectItem>
<SelectItem value="nuxt">Nuxt.js</SelectItem>
</SelectContent>
</Select>
</div>
</div>
</form>
</CardContent>
<CardFooter className="flex justify-between">
<Button variant="outline">Cancel</Button>
<Button>Deploy</Button>
</CardFooter>
</Card>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/card-with-form.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/card-with-form.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 861
} | 109 |
import * as React from "react"
import { Card, CardContent } from "@/registry/new-york/ui/card"
import {
Carousel,
CarouselContent,
CarouselItem,
CarouselNext,
CarouselPrevious,
} from "@/registry/new-york/ui/carousel"
export default function CarouselOrientation() {
return (
<Carousel
opts={{
align: "start",
}}
orientation="vertical"
className="w-full max-w-xs"
>
<CarouselContent className="-mt-1 h-[200px]">
{Array.from({ length: 5 }).map((_, index) => (
<CarouselItem key={index} className="pt-1 md:basis-1/2">
<div className="p-1">
<Card>
<CardContent className="flex items-center justify-center p-6">
<span className="text-3xl font-semibold">{index + 1}</span>
</CardContent>
</Card>
</div>
</CarouselItem>
))}
</CarouselContent>
<CarouselPrevious />
<CarouselNext />
</Carousel>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/carousel-orientation.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/carousel-orientation.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 488
} | 110 |
"use client"
import * as React from "react"
import { CaretSortIcon, CheckIcon } from "@radix-ui/react-icons"
import { cn } from "@/lib/utils"
import { Button } from "@/registry/new-york/ui/button"
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
} from "@/registry/new-york/ui/command"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/registry/new-york/ui/popover"
const frameworks = [
{
value: "next.js",
label: "Next.js",
},
{
value: "sveltekit",
label: "SvelteKit",
},
{
value: "nuxt.js",
label: "Nuxt.js",
},
{
value: "remix",
label: "Remix",
},
{
value: "astro",
label: "Astro",
},
]
export default function ComboboxDemo() {
const [open, setOpen] = React.useState(false)
const [value, setValue] = React.useState("")
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
role="combobox"
aria-expanded={open}
className="w-[200px] justify-between"
>
{value
? frameworks.find((framework) => framework.value === value)?.label
: "Select framework..."}
<CaretSortIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-[200px] p-0">
<Command>
<CommandInput placeholder="Search framework..." className="h-9" />
<CommandList>
<CommandEmpty>No framework found.</CommandEmpty>
<CommandGroup>
{frameworks.map((framework) => (
<CommandItem
key={framework.value}
value={framework.value}
onSelect={(currentValue) => {
setValue(currentValue === value ? "" : currentValue)
setOpen(false)
}}
>
{framework.label}
<CheckIcon
className={cn(
"ml-auto h-4 w-4",
value === framework.value ? "opacity-100" : "opacity-0"
)}
/>
</CommandItem>
))}
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/combobox-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/combobox-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1202
} | 111 |
import * as React from "react"
import { cn } from "@/lib/utils"
import { useMediaQuery } from "@/hooks/use-media-query"
import { Button } from "@/registry/new-york/ui/button"
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/registry/new-york/ui/dialog"
import {
Drawer,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/registry/new-york/ui/drawer"
import { Input } from "@/registry/new-york/ui/input"
import { Label } from "@/registry/new-york/ui/label"
export default function DrawerDialogDemo() {
const [open, setOpen] = React.useState(false)
const isDesktop = useMediaQuery("(min-width: 768px)")
if (isDesktop) {
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<Button variant="outline">Edit Profile</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>
Make changes to your profile here. Click save when you're done.
</DialogDescription>
</DialogHeader>
<ProfileForm />
</DialogContent>
</Dialog>
)
}
return (
<Drawer open={open} onOpenChange={setOpen}>
<DrawerTrigger asChild>
<Button variant="outline">Edit Profile</Button>
</DrawerTrigger>
<DrawerContent>
<DrawerHeader className="text-left">
<DrawerTitle>Edit profile</DrawerTitle>
<DrawerDescription>
Make changes to your profile here. Click save when you're done.
</DrawerDescription>
</DrawerHeader>
<ProfileForm className="px-4" />
<DrawerFooter className="pt-2">
<DrawerClose asChild>
<Button variant="outline">Cancel</Button>
</DrawerClose>
</DrawerFooter>
</DrawerContent>
</Drawer>
)
}
function ProfileForm({ className }: React.ComponentProps<"form">) {
return (
<form className={cn("grid items-start gap-4", className)}>
<div className="grid gap-2">
<Label htmlFor="email">Email</Label>
<Input type="email" id="email" defaultValue="[email protected]" />
</div>
<div className="grid gap-2">
<Label htmlFor="username">Username</Label>
<Input id="username" defaultValue="@shadcn" />
</div>
<Button type="submit">Save changes</Button>
</form>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/drawer-dialog.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/drawer-dialog.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1074
} | 112 |
import { Input } from "@/registry/new-york/ui/input"
import { Label } from "@/registry/new-york/ui/label"
export default function InputWithText() {
return (
<div className="grid w-full max-w-sm items-center gap-1.5">
<Label htmlFor="email-2">Email</Label>
<Input type="email" id="email-2" placeholder="Email" />
<p className="text-sm text-muted-foreground">Enter your email address.</p>
</div>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/input-with-text.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/input-with-text.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 164
} | 113 |
import * as React from "react"
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectTrigger,
SelectValue,
} from "@/registry/new-york/ui/select"
export default function SelectDemo() {
return (
<Select>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder="Select a fruit" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectLabel>Fruits</SelectLabel>
<SelectItem value="apple">Apple</SelectItem>
<SelectItem value="banana">Banana</SelectItem>
<SelectItem value="blueberry">Blueberry</SelectItem>
<SelectItem value="grapes">Grapes</SelectItem>
<SelectItem value="pineapple">Pineapple</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/select-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/select-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 328
} | 114 |
"use client"
import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import { z } from "zod"
import { toast } from "@/registry/new-york/hooks/use-toast"
import { Button } from "@/registry/new-york/ui/button"
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/registry/new-york/ui/form"
import { Textarea } from "@/registry/new-york/ui/textarea"
const FormSchema = z.object({
bio: z
.string()
.min(10, {
message: "Bio must be at least 10 characters.",
})
.max(160, {
message: "Bio must not be longer than 30 characters.",
}),
})
export default function TextareaForm() {
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
})
function onSubmit(data: z.infer<typeof FormSchema>) {
toast({
title: "You submitted the following values:",
description: (
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
</pre>
),
})
}
return (
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="w-2/3 space-y-6">
<FormField
control={form.control}
name="bio"
render={({ field }) => (
<FormItem>
<FormLabel>Bio</FormLabel>
<FormControl>
<Textarea
placeholder="Tell us a little bit about yourself"
className="resize-none"
{...field}
/>
</FormControl>
<FormDescription>
You can <span>@mention</span> other users and organizations.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<Button type="submit">Submit</Button>
</form>
</Form>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/textarea-form.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/textarea-form.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 913
} | 115 |
export default function TypographyMuted() {
return (
<p className="text-sm text-muted-foreground">Enter your email address.</p>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/typography-muted.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/typography-muted.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 46
} | 116 |
import * as React from "react"
import { cn } from "@/lib/utils"
export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, ...props }, ref) => {
return (
<textarea
className={cn(
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
className
)}
ref={ref}
{...props}
/>
)
}
)
Textarea.displayName = "Textarea"
export { Textarea }
| shadcn-ui/ui/apps/www/registry/new-york/ui/textarea.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/ui/textarea.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 285
} | 117 |