text
stringlengths 21
253k
| id
stringlengths 25
123
| metadata
dict | __index_level_0__
int64 0
181
|
---|---|---|---|
"use client"
import { Checkbox } from "@/registry/default/ui/checkbox"
export default function CheckboxDemo() {
return (
<div className="flex items-center space-x-2">
<Checkbox id="terms" />
<label
htmlFor="terms"
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
>
Accept terms and conditions
</label>
</div>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/checkbox-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/checkbox-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 173
} | 126 |
"use client"
import { zodResolver } from "@hookform/resolvers/zod"
import { format } from "date-fns"
import { CalendarIcon } from "lucide-react"
import { useForm } from "react-hook-form"
import { z } from "zod"
import { cn } from "@/lib/utils"
import { toast } from "@/registry/default/hooks/use-toast"
import { Button } from "@/registry/default/ui/button"
import { Calendar } from "@/registry/default/ui/calendar"
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/registry/default/ui/form"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/registry/default/ui/popover"
const FormSchema = z.object({
dob: z.date({
required_error: "A date of birth is required.",
}),
})
export default function DatePickerForm() {
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="space-y-8">
<FormField
control={form.control}
name="dob"
render={({ field }) => (
<FormItem className="flex flex-col">
<FormLabel>Date of birth</FormLabel>
<Popover>
<PopoverTrigger asChild>
<FormControl>
<Button
variant={"outline"}
className={cn(
"w-[240px] pl-3 text-left font-normal",
!field.value && "text-muted-foreground"
)}
>
{field.value ? (
format(field.value, "PPP")
) : (
<span>Pick a date</span>
)}
<CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
</Button>
</FormControl>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
mode="single"
selected={field.value}
onSelect={field.onChange}
disabled={(date) =>
date > new Date() || date < new Date("1900-01-01")
}
initialFocus
/>
</PopoverContent>
</Popover>
<FormDescription>
Your date of birth is used to calculate your age.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<Button type="submit">Submit</Button>
</form>
</Form>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/date-picker-form.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/date-picker-form.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1592
} | 127 |
import {
InputOTP,
InputOTPGroup,
InputOTPSeparator,
InputOTPSlot,
} from "@/registry/default/ui/input-otp"
export default function InputOTPDemo() {
return (
<InputOTP maxLength={6}>
<InputOTPGroup>
<InputOTPSlot index={0} />
<InputOTPSlot index={1} />
<InputOTPSlot index={2} />
</InputOTPGroup>
<InputOTPSeparator />
<InputOTPGroup>
<InputOTPSlot index={3} />
<InputOTPSlot index={4} />
<InputOTPSlot index={5} />
</InputOTPGroup>
</InputOTP>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/input-otp-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/input-otp-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 262
} | 128 |
import { Label } from "@/registry/default/ui/label"
import { Switch } from "@/registry/default/ui/switch"
export default function SwitchDemo() {
return (
<div className="flex items-center space-x-2">
<Switch id="airplane-mode" />
<Label htmlFor="airplane-mode">Airplane Mode</Label>
</div>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/switch-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/switch-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 117
} | 129 |
import { Underline } from "lucide-react"
import { Toggle } from "@/registry/default/ui/toggle"
export default function ToggleDisabled() {
return (
<Toggle aria-label="Toggle underline" disabled>
<Underline className="h-4 w-4" />
</Toggle>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/toggle-disabled.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/toggle-disabled.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 98
} | 130 |
export default function TypographyH3() {
return (
<h3 className="scroll-m-20 text-2xl font-semibold tracking-tight">
The Joke Tax
</h3>
)
}
| shadcn-ui/ui/apps/www/registry/default/example/typography-h3.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/example/typography-h3.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 66
} | 131 |
"use client"
import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
const AspectRatio = AspectRatioPrimitive.Root
export { AspectRatio }
| shadcn-ui/ui/apps/www/registry/default/ui/aspect-ratio.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/ui/aspect-ratio.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 56
} | 132 |
"use client"
import * as React from "react"
import * as LabelPrimitive from "@radix-ui/react-label"
import { Slot } from "@radix-ui/react-slot"
import {
Controller,
ControllerProps,
FieldPath,
FieldValues,
FormProvider,
useFormContext,
} from "react-hook-form"
import { cn } from "@/lib/utils"
import { Label } from "@/registry/default/ui/label"
const Form = FormProvider
type FormFieldContextValue<
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
> = {
name: TName
}
const FormFieldContext = React.createContext<FormFieldContextValue>(
{} as FormFieldContextValue
)
const FormField = <
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
>({
...props
}: ControllerProps<TFieldValues, TName>) => {
return (
<FormFieldContext.Provider value={{ name: props.name }}>
<Controller {...props} />
</FormFieldContext.Provider>
)
}
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,
}
}
type FormItemContextValue = {
id: string
}
const FormItemContext = React.createContext<FormItemContextValue>(
{} as FormItemContextValue
)
const FormItem = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => {
const id = React.useId()
return (
<FormItemContext.Provider value={{ id }}>
<div ref={ref} className={cn("space-y-2", className)} {...props} />
</FormItemContext.Provider>
)
})
FormItem.displayName = "FormItem"
const FormLabel = React.forwardRef<
React.ElementRef<typeof LabelPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
>(({ className, ...props }, ref) => {
const { error, formItemId } = useFormField()
return (
<Label
ref={ref}
className={cn(error && "text-destructive", className)}
htmlFor={formItemId}
{...props}
/>
)
})
FormLabel.displayName = "FormLabel"
const FormControl = React.forwardRef<
React.ElementRef<typeof Slot>,
React.ComponentPropsWithoutRef<typeof Slot>
>(({ ...props }, ref) => {
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
return (
<Slot
ref={ref}
id={formItemId}
aria-describedby={
!error
? `${formDescriptionId}`
: `${formDescriptionId} ${formMessageId}`
}
aria-invalid={!!error}
{...props}
/>
)
})
FormControl.displayName = "FormControl"
const FormDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => {
const { formDescriptionId } = useFormField()
return (
<p
ref={ref}
id={formDescriptionId}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
)
})
FormDescription.displayName = "FormDescription"
const FormMessage = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, children, ...props }, ref) => {
const { error, formMessageId } = useFormField()
const body = error ? String(error?.message) : children
if (!body) {
return null
}
return (
<p
ref={ref}
id={formMessageId}
className={cn("text-sm font-medium text-destructive", className)}
{...props}
>
{body}
</p>
)
})
FormMessage.displayName = "FormMessage"
export {
useFormField,
Form,
FormItem,
FormLabel,
FormControl,
FormDescription,
FormMessage,
FormField,
}
| shadcn-ui/ui/apps/www/registry/default/ui/form.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/default/ui/form.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1472
} | 133 |
"use client"
import { Button } from "@/registry/new-york/ui/button"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/registry/new-york/ui/card"
export default function Component() {
return (
<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>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/block/dashboard-07-chunk-5.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/block/dashboard-07-chunk-5.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 281
} | 134 |
import { ExclamationTriangleIcon } from "@radix-ui/react-icons"
import {
Alert,
AlertDescription,
AlertTitle,
} from "@/registry/new-york/ui/alert"
export default function AlertDestructive() {
return (
<Alert variant="destructive">
<ExclamationTriangleIcon className="h-4 w-4" />
<AlertTitle>Error</AlertTitle>
<AlertDescription>
Your session has expired. Please log in again.
</AlertDescription>
</Alert>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/alert-destructive.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/alert-destructive.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 169
} | 135 |
import { Button } from "@/registry/new-york/ui/button"
export default function ButtonDestructive() {
return <Button variant="destructive">Destructive</Button>
}
| shadcn-ui/ui/apps/www/registry/new-york/example/button-destructive.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/button-destructive.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 49
} | 136 |
"use client"
import { Icons } from "@/components/icons"
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"
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-card 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/new-york/example/cards/create-account.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/cards/create-account.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 857
} | 137 |
import {
CalendarIcon,
EnvelopeClosedIcon,
FaceIcon,
GearIcon,
PersonIcon,
RocketIcon,
} from "@radix-ui/react-icons"
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
CommandShortcut,
} from "@/registry/new-york/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>
<CalendarIcon className="mr-2 h-4 w-4" />
<span>Calendar</span>
</CommandItem>
<CommandItem>
<FaceIcon className="mr-2 h-4 w-4" />
<span>Search Emoji</span>
</CommandItem>
<CommandItem disabled>
<RocketIcon className="mr-2 h-4 w-4" />
<span>Launch</span>
</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Settings">
<CommandItem>
<PersonIcon className="mr-2 h-4 w-4" />
<span>Profile</span>
<CommandShortcut>P</CommandShortcut>
</CommandItem>
<CommandItem>
<EnvelopeClosedIcon className="mr-2 h-4 w-4" />
<span>Mail</span>
<CommandShortcut>B</CommandShortcut>
</CommandItem>
<CommandItem>
<GearIcon className="mr-2 h-4 w-4" />
<span>Settings</span>
<CommandShortcut>S</CommandShortcut>
</CommandItem>
</CommandGroup>
</CommandList>
</Command>
)
}
| shadcn-ui/ui/apps/www/registry/new-york/example/command-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/command-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 826
} | 138 |
import { Input } from "@/registry/new-york/ui/input"
export default function InputDemo() {
return <Input type="email" placeholder="Email" />
}
| shadcn-ui/ui/apps/www/registry/new-york/example/input-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/input-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 46
} | 139 |
"use client"
import { Button } from "@/registry/new-york/ui/button"
import { Input } from "@/registry/new-york/ui/input"
import { Label } from "@/registry/new-york/ui/label"
import {
Sheet,
SheetClose,
SheetContent,
SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/registry/new-york/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/new-york/example/sheet-side.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/sheet-side.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 943
} | 140 |
"use client"
import { useToast } from "@/registry/new-york/hooks/use-toast"
import { Button } from "@/registry/new-york/ui/button"
import { ToastAction } from "@/registry/new-york/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/new-york/example/toast-destructive.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/toast-destructive.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 266
} | 141 |
import { Button } from "@/registry/new-york/ui/button"
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/registry/new-york/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/new-york/example/tooltip-demo.tsx | {
"file_path": "shadcn-ui/ui/apps/www/registry/new-york/example/tooltip-demo.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 217
} | 142 |
import path from "path"
import fs from "fs-extra"
import { type PackageJson } from "type-fest"
export function getPackageInfo() {
const packageJsonPath = path.join("package.json")
return fs.readJSONSync(packageJsonPath) as PackageJson
}
| shadcn-ui/ui/packages/cli/src/utils/get-package-info.ts | {
"file_path": "shadcn-ui/ui/packages/cli/src/utils/get-package-info.ts",
"repo_id": "shadcn-ui/ui",
"token_count": 75
} | 143 |
body {
background-color: red;
}
| shadcn-ui/ui/packages/cli/test/fixtures/next-pages/styles/other.css | {
"file_path": "shadcn-ui/ui/packages/cli/test/fixtures/next-pages/styles/other.css",
"repo_id": "shadcn-ui/ui",
"token_count": 13
} | 144 |
import path from "path"
import { expect, test } from "vitest"
import { getConfig, getRawConfig } from "../../src/utils/get-config"
test("get raw config", async () => {
expect(
await getRawConfig(path.resolve(__dirname, "../fixtures/config-none"))
).toEqual(null)
expect(
await getRawConfig(path.resolve(__dirname, "../fixtures/config-partial"))
).toEqual({
style: "default",
tailwind: {
config: "./tailwind.config.ts",
css: "./src/assets/css/tailwind.css",
baseColor: "neutral",
cssVariables: false,
},
rsc: false,
tsx: true,
aliases: {
components: "@/components",
utils: "@/lib/utils",
},
})
expect(
getRawConfig(path.resolve(__dirname, "../fixtures/config-invalid"))
).rejects.toThrowError()
})
test("get config", async () => {
expect(
await getConfig(path.resolve(__dirname, "../fixtures/config-none"))
).toEqual(null)
expect(
getConfig(path.resolve(__dirname, "../fixtures/config-invalid"))
).rejects.toThrowError()
expect(
await getConfig(path.resolve(__dirname, "../fixtures/config-partial"))
).toEqual({
style: "default",
tailwind: {
config: "./tailwind.config.ts",
css: "./src/assets/css/tailwind.css",
baseColor: "neutral",
cssVariables: false,
},
rsc: false,
tsx: true,
aliases: {
components: "@/components",
utils: "@/lib/utils",
},
resolvedPaths: {
tailwindConfig: path.resolve(
__dirname,
"../fixtures/config-partial",
"tailwind.config.ts"
),
tailwindCss: path.resolve(
__dirname,
"../fixtures/config-partial",
"./src/assets/css/tailwind.css"
),
components: path.resolve(
__dirname,
"../fixtures/config-partial",
"./components"
),
utils: path.resolve(
__dirname,
"../fixtures/config-partial",
"./lib/utils"
),
ui: path.resolve(__dirname, "../fixtures/config-partial", "./components"),
},
})
expect(
await getConfig(path.resolve(__dirname, "../fixtures/config-full"))
).toEqual({
style: "new-york",
rsc: false,
tsx: true,
tailwind: {
config: "tailwind.config.ts",
baseColor: "zinc",
css: "src/app/globals.css",
cssVariables: true,
prefix: "tw-",
},
aliases: {
components: "~/components",
utils: "~/lib/utils",
},
resolvedPaths: {
tailwindConfig: path.resolve(
__dirname,
"../fixtures/config-full",
"tailwind.config.ts"
),
tailwindCss: path.resolve(
__dirname,
"../fixtures/config-full",
"./src/app/globals.css"
),
components: path.resolve(
__dirname,
"../fixtures/config-full",
"./src/components"
),
ui: path.resolve(
__dirname,
"../fixtures/config-full",
"./src/components"
),
utils: path.resolve(
__dirname,
"../fixtures/config-full",
"./src/lib/utils"
),
},
})
expect(
await getConfig(path.resolve(__dirname, "../fixtures/config-jsx"))
).toEqual({
style: "default",
tailwind: {
config: "./tailwind.config.js",
css: "./src/assets/css/tailwind.css",
baseColor: "neutral",
cssVariables: false,
},
rsc: false,
tsx: false,
aliases: {
components: "@/components",
utils: "@/lib/utils",
},
resolvedPaths: {
tailwindConfig: path.resolve(
__dirname,
"../fixtures/config-jsx",
"tailwind.config.js"
),
tailwindCss: path.resolve(
__dirname,
"../fixtures/config-jsx",
"./src/assets/css/tailwind.css"
),
components: path.resolve(
__dirname,
"../fixtures/config-jsx",
"./components"
),
ui: path.resolve(__dirname, "../fixtures/config-jsx", "./components"),
utils: path.resolve(__dirname, "../fixtures/config-jsx", "./lib/utils"),
},
})
})
| shadcn-ui/ui/packages/cli/test/utils/get-config.test.ts | {
"file_path": "shadcn-ui/ui/packages/cli/test/utils/get-config.test.ts",
"repo_id": "shadcn-ui/ui",
"token_count": 1931
} | 145 |
import { detect } from "@antfu/ni"
export async function getPackageManager(
targetDir: string,
{ withFallback }: { withFallback?: boolean } = {
withFallback: false,
}
): Promise<"yarn" | "pnpm" | "bun" | "npm"> {
const packageManager = await detect({ programmatic: true, cwd: targetDir })
if (packageManager === "yarn@berry") return "yarn"
if (packageManager === "pnpm@6") return "pnpm"
if (packageManager === "bun") return "bun"
if (!withFallback) {
return packageManager ?? "npm"
}
// Fallback to user agent if not detected.
const userAgent = process.env.npm_config_user_agent || ""
if (userAgent.startsWith("yarn")) {
return "yarn"
}
if (userAgent.startsWith("pnpm")) {
return "pnpm"
}
if (userAgent.startsWith("bun")) {
return "bun"
}
return "npm"
}
export async function getPackageRunner(cwd: string) {
const packageManager = await getPackageManager(cwd)
if (packageManager === "pnpm") return "pnpm dlx"
if (packageManager === "bun") return "bunx"
return "npx"
}
| shadcn-ui/ui/packages/shadcn/src/utils/get-package-manager.ts | {
"file_path": "shadcn-ui/ui/packages/shadcn/src/utils/get-package-manager.ts",
"repo_id": "shadcn-ui/ui",
"token_count": 374
} | 146 |
import fs from "fs/promises"
import path from "path"
import { Config } from "@/src/utils/get-config"
import { getRegistryItem } from "@/src/utils/registry"
export async function updateAppIndex(component: string, config: Config) {
const indexPath = path.join(config.resolvedPaths.cwd, "app/page.tsx")
if (!(await fs.stat(indexPath)).isFile()) {
return
}
const registryItem = await getRegistryItem(component, config.style)
if (
!registryItem?.meta?.importSpecifier ||
!registryItem?.meta?.moduleSpecifier
) {
return
}
// Overwrite the index file with the new import.
const content = `import { ${registryItem?.meta?.importSpecifier} } from "${registryItem.meta.moduleSpecifier}"\n\nexport default function Page() {\n return <${registryItem?.meta?.importSpecifier} />\n}`
await fs.writeFile(indexPath, content, "utf8")
}
| shadcn-ui/ui/packages/shadcn/src/utils/update-app-index.ts | {
"file_path": "shadcn-ui/ui/packages/shadcn/src/utils/update-app-index.ts",
"repo_id": "shadcn-ui/ui",
"token_count": 289
} | 147 |
/** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig
| shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/next-app/next.config.ts | {
"file_path": "shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/next-app/next.config.ts",
"repo_id": "shadcn-ui/ui",
"token_count": 28
} | 148 |
/node_modules
*.log
.DS_Store
.env
/.cache
/public/build
/build
| shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/remix-indie-stack/.dockerignore | {
"file_path": "shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/remix-indie-stack/.dockerignore",
"repo_id": "shadcn-ui/ui",
"token_count": 27
} | 149 |
# base node image
FROM node:18-bullseye-slim as base
# set for base and all layer that inherit from it
ENV NODE_ENV production
# Install openssl for Prisma
RUN apt-get update && apt-get install -y openssl sqlite3
# Install all node_modules, including dev dependencies
FROM base as deps
WORKDIR /myapp
ADD package.json .npmrc ./
RUN npm install --include=dev
# Setup production node_modules
FROM base as production-deps
WORKDIR /myapp
COPY --from=deps /myapp/node_modules /myapp/node_modules
ADD package.json .npmrc ./
RUN npm prune --omit=dev
# Build the app
FROM base as build
WORKDIR /myapp
COPY --from=deps /myapp/node_modules /myapp/node_modules
ADD prisma .
RUN npx prisma generate
ADD . .
RUN npm run build
# Finally, build the production image with minimal footprint
FROM base
ENV DATABASE_URL=file:/data/sqlite.db
ENV PORT="8080"
ENV NODE_ENV="production"
# add shortcut for connecting to database CLI
RUN echo "#!/bin/sh\nset -x\nsqlite3 \$DATABASE_URL" > /usr/local/bin/database-cli && chmod +x /usr/local/bin/database-cli
WORKDIR /myapp
COPY --from=production-deps /myapp/node_modules /myapp/node_modules
COPY --from=build /myapp/node_modules/.prisma /myapp/node_modules/.prisma
COPY --from=build /myapp/build /myapp/build
COPY --from=build /myapp/public /myapp/public
COPY --from=build /myapp/package.json /myapp/package.json
COPY --from=build /myapp/start.sh /myapp/start.sh
COPY --from=build /myapp/prisma /myapp/prisma
ENTRYPOINT [ "./start.sh" ]
| shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/remix-indie-stack/Dockerfile | {
"file_path": "shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/remix-indie-stack/Dockerfile",
"repo_id": "shadcn-ui/ui",
"token_count": 548
} | 150 |
import type { ActionFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { Form, useActionData } from "@remix-run/react";
import { useEffect, useRef } from "react";
import { createNote } from "~/models/note.server";
import { requireUserId } from "~/session.server";
export const action = async ({ request }: ActionFunctionArgs) => {
const userId = await requireUserId(request);
const formData = await request.formData();
const title = formData.get("title");
const body = formData.get("body");
if (typeof title !== "string" || title.length === 0) {
return json(
{ errors: { body: null, title: "Title is required" } },
{ status: 400 },
);
}
if (typeof body !== "string" || body.length === 0) {
return json(
{ errors: { body: "Body is required", title: null } },
{ status: 400 },
);
}
const note = await createNote({ body, title, userId });
return redirect(`/notes/${note.id}`);
};
export default function NewNotePage() {
const actionData = useActionData<typeof action>();
const titleRef = useRef<HTMLInputElement>(null);
const bodyRef = useRef<HTMLTextAreaElement>(null);
useEffect(() => {
if (actionData?.errors?.title) {
titleRef.current?.focus();
} else if (actionData?.errors?.body) {
bodyRef.current?.focus();
}
}, [actionData]);
return (
<Form
method="post"
style={{
display: "flex",
flexDirection: "column",
gap: 8,
width: "100%",
}}
>
<div>
<label className="flex w-full flex-col gap-1">
<span>Title: </span>
<input
ref={titleRef}
name="title"
className="flex-1 rounded-md border-2 border-blue-500 px-3 text-lg leading-loose"
aria-invalid={actionData?.errors?.title ? true : undefined}
aria-errormessage={
actionData?.errors?.title ? "title-error" : undefined
}
/>
</label>
{actionData?.errors?.title ? (
<div className="pt-1 text-red-700" id="title-error">
{actionData.errors.title}
</div>
) : null}
</div>
<div>
<label className="flex w-full flex-col gap-1">
<span>Body: </span>
<textarea
ref={bodyRef}
name="body"
rows={8}
className="w-full flex-1 rounded-md border-2 border-blue-500 px-3 py-2 text-lg leading-6"
aria-invalid={actionData?.errors?.body ? true : undefined}
aria-errormessage={
actionData?.errors?.body ? "body-error" : undefined
}
/>
</label>
{actionData?.errors?.body ? (
<div className="pt-1 text-red-700" id="body-error">
{actionData.errors.body}
</div>
) : null}
</div>
<div className="text-right">
<button
type="submit"
className="rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600 focus:bg-blue-400"
>
Save
</button>
</div>
</Form>
);
}
| shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/notes.new.tsx | {
"file_path": "shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/notes.new.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1436
} | 151 |
app = "indie-stack-template"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
swap_size_mb = 512
[experimental]
allowed_public_ports = []
auto_rollback = true
cmd = "start.sh"
entrypoint = "sh"
[mounts]
source = "data"
destination = "/data"
[[services]]
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
handlers = ["http"]
port = 80
force_https = true
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
[[services.http_checks]]
interval = "10s"
grace_period = "5s"
method = "get"
path = "/healthcheck"
protocol = "http"
timeout = "2s"
tls_skip_verify = false
[services.http_checks.headers]
| shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/remix-indie-stack/fly.toml | {
"file_path": "shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/remix-indie-stack/fly.toml",
"repo_id": "shadcn-ui/ui",
"token_count": 379
} | 152 |
#!/bin/sh -ex
# This file is how Fly starts the server (configured in fly.toml). Before starting
# the server though, we need to run any prisma migrations that haven't yet been
# run, which is why this file exists in the first place.
# Learn more: https://community.fly.io/t/sqlite-not-getting-setup-properly/4386
npx prisma migrate deploy
npm run start
| shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/remix-indie-stack/start.sh | {
"file_path": "shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/remix-indie-stack/start.sh",
"repo_id": "shadcn-ui/ui",
"token_count": 108
} | 153 |
import { type NextPage } from "next";
import Head from "next/head";
import Link from "next/link";
const Home: NextPage = () => {
return (
<>
<Head>
<title>Create T3 App</title>
<meta name="description" content="Generated by create-t3-app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className="flex min-h-screen flex-col items-center justify-center bg-gradient-to-b from-[#2e026d] to-[#15162c]">
<div className="container flex flex-col items-center justify-center gap-12 px-4 py-16 ">
<h1 className="text-5xl font-extrabold tracking-tight text-white sm:text-[5rem]">
Create <span className="text-[hsl(280,100%,70%)]">T3</span> App
</h1>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 md:gap-8">
<Link
className="flex max-w-xs flex-col gap-4 rounded-xl bg-white/10 p-4 text-white hover:bg-white/20"
href="https://create.t3.gg/en/usage/first-steps"
target="_blank"
>
<h3 className="text-2xl font-bold">First Steps </h3>
<div className="text-lg">
Just the basics - Everything you need to know to set up your
database and authentication.
</div>
</Link>
<Link
className="flex max-w-xs flex-col gap-4 rounded-xl bg-white/10 p-4 text-white hover:bg-white/20"
href="https://create.t3.gg/en/introduction"
target="_blank"
>
<h3 className="text-2xl font-bold">Documentation </h3>
<div className="text-lg">
Learn more about Create T3 App, the libraries it uses, and how
to deploy it.
</div>
</Link>
</div>
</div>
</main>
</>
);
};
export default Home;
| shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/t3-pages/src/pages/index.tsx | {
"file_path": "shadcn-ui/ui/packages/shadcn/test/fixtures/frameworks/t3-pages/src/pages/index.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 945
} | 154 |
export type SiteConfig = typeof siteConfig
export const siteConfig = {
name: "Next.js",
description:
"Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.",
mainNav: [
{
title: "Home",
href: "/",
},
],
links: {
twitter: "https://twitter.com/shadcn",
github: "https://github.com/shadcn/ui",
docs: "https://ui.shadcn.com",
},
}
| shadcn-ui/ui/templates/next-template/config/site.ts | {
"file_path": "shadcn-ui/ui/templates/next-template/config/site.ts",
"repo_id": "shadcn-ui/ui",
"token_count": 162
} | 155 |
"use client"
import React from "react"
import { Button } from "@/components/ui/button"
import { Badge } from "@/components/ui/badge"
import { Card, CardDescription, CardTitle } from "@/components/ui/card"
import { Icons } from "@/components/icons"
import AdBanner from "@/components/ad-banner"
import { BellRing, ClipboardList, Flag, Folder, StickyNote, Trophy } from "lucide-react"
import CreateNewComponent from "@/components/easyui/create-new"
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"
import { RotateCcw } from "lucide-react"
import { CopyIcon } from "@radix-ui/react-icons"
const actionItems = [
{
link: "https://easyui.pro",
icon: <Folder />,
name: "Project",
},
{
link: "/task",
icon: <ClipboardList />,
name: "Task",
},
{
link: "/note",
icon: <StickyNote />,
name: "Note",
},
{
link: "/goal",
icon: <Trophy />,
name: "Goal",
},
{
link: "/milestone",
icon: <Flag />,
name: "Milestone",
},
{
link: "/reminder",
icon: <BellRing />,
name: "Reminder",
},
];
function CreateNewComponentt() {
const [key, setKey] = React.useState(0); // State to trigger re-render
return (
<div className="flex flex-wrap justify-start gap-4 pb-10 max-w-full min-w-full px-0 lg:px-20">
<div className="w-full sm:w-1/2 p-2 mt-3 space-y-4 lg:mt-5 md:lg-5">
<CardTitle className="text-3xl tracking-tight leading-7">Create New</CardTitle>
<CardDescription className="text-balance text-lg text-muted-foreground">
A popup card that displays multiple choices.
</CardDescription>
</div>
<Tabs defaultValue="preview" className="relative mr-auto w-full">
<div className="flex items-center justify-between pb-3">
<TabsList className="w-full justify-start rounded-none bg-transparent p-0">
<TabsTrigger value="preview" className="relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold text-muted-foreground shadow-none transition-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none">
Preview
</TabsTrigger>
<TabsTrigger value="code" className="relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold text-muted-foreground shadow-none transition-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none">
Code
</TabsTrigger>
</TabsList>
</div>
<TabsContent value="preview" className="relative rounded-md" key={key}>
<div className="flex items-center justify-center max-w-full mx-auto px-4 py-0.5 border rounded-lg h-[400px]">
<Button onClick={() => setKey((prev) => prev + 1)} className="absolute right-0 top-0 z-10 ml-4 flex items-center rounded-lg px-3 py-1" variant="ghost">
<RotateCcw size={16} />
</Button>
<CreateNewComponent actions={actionItems} />
</div>
</TabsContent>
<TabsContent value="code">
<div className="flex flex-col space-y-4 ml-3 lg:ml-4 md:lg-3">
<h2 className="font-semibold mt-12 scroll-m-20 border-b pb-2 text-2xl tracking-tight first:mt-0 leading-7">
Installation
</h2>
<p className="font-semibold mt-5 tracking-tight leading-7">Step 1: Copy and paste the following code into your components.</p>
<div className="w-full rounded-md [&_pre]:my-0 [&_pre]:max-h-[350px] [&_pre]:overflow-auto relative bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 font-sm">
<button onClick={() => {
const codeElement = document.getElementById('codeBlock');
const codeToCopy = codeElement ? codeElement.textContent : '';
// @ts-ignore
navigator.clipboard.writeText(codeToCopy).then(() => {
alert('Code copied to clipboard!');
});
}}
className="absolute right-0 top-0 z-10 m-4 flex items-center rounded-lg px-3 py-1 text-white" title="Copy code to clipboard">
{/* <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
<path strokeLinecap="round" strokeLinejoin="round" d="M8 5C6.895 5 6 5.895 6 7v10c0 1.105.895 2 2 2h8c1.105 0 2-.895 2-2V7c0-1.105-.895-2-2-2H8zm0 0V3c0-1.105.895-2 2-2h4c1.105 0 2 .895 2 2v2m-6 4h4" />
</svg> */}
<CopyIcon className="text-black hover:text-gray-400 active:text-blue-700 h-4 dark:text-white" style={{ backdropFilter: 'blur(20px)' }} />
</button>
<pre className="ml-2 py-2 pb-2 pl-2 font-sm min-h-[600px] lg:min-h-[600px] sm:min-h-[300px]"><code id="codeBlock" className="text-left language-js text-sm ">
{`"use client"
import React from "react"
import {
AnimatePresence,
MotionConfig,
motion,
type Transition,
} from "framer-motion"
import { Plus, X } from "lucide-react"
const transition: Transition = { type: "spring", bounce: 0, duration: 0.4 }
const Context = React.createContext<{
status: string
setStatus: React.Dispatch<React.SetStateAction<string>>
}>({ status: "", setStatus: () => null })
interface ActionItem {
link: string
icon: React.ReactNode
name: string
}
interface InnerContentProps {
actions: ActionItem[]
}
function InnerContent({ actions }: InnerContentProps) {
const ctx = React.useContext(Context)
const isOpen = ctx.status === "open"
const isHovered = ctx.status === "hovered"
return (
<AnimatePresence>
{isOpen || isHovered ? (
<motion.div
layoutId="container"
style={{ borderRadius: 22 }}
className="dark:bg-gray-900 bg-[#f7f6ef] tracking-tight text-[#6b6967] shadow-mixed ring-2 ring-black/[8%] dark:bg-black dark:text-white dark:border dark:border-gray-800"
>
<div className="flex w-full items-center justify-between py-2.5 pl-5 pr-2.5">
<motion.span layoutId="label" className="relative">
Create New
</motion.span>
<div className="relative">
<AnimatePresence>
{isHovered && (
<motion.p
initial={{ opacity: 0, x: 10 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: 10 }}
className="absolute -left-11 top-0.5 text-sm text-[#6b6967]/70"
>
Close
</motion.p>
)}
</AnimatePresence>
<motion.button
layout
onClick={() => ctx.setStatus("idle")}
initial={{ opacity: 0, x: -20, y: 10 }}
animate={{ opacity: 1, x: 0, y: 0 }}
exit={{ opacity: 0, x: -20, y: 10 }}
transition={{ ...transition, delay: 0.15 }}
whileTap={{
scale: 0.9,
transition: { ...transition, duration: 0.2 },
}}
onHoverStart={() => ctx.setStatus("hovered")}
onHoverEnd={() => ctx.setStatus("open")}
className="size-6 flex items-center justify-center rounded-full bg-[#b8b6af] dark:bg-transparent"
>
<X
strokeWidth={4}
className="size-4 text-tight text-[#fafafa]"
/>
</motion.button>
</div>
</div>
<motion.div
initial={{ opacity: 0 }}
animate={
isHovered
? { opacity: 1, scaleX: 0.95, scaleY: 0.92 }
: { opacity: 1 }
}
exit={{ opacity: 0 }}
className="flex flex-col gap-2.5 rounded-[22px] bg-[#fafafa] p-2.5 shadow-[0_-3px_3px_-1.5px_rgba(0,0,0,0.08)] ring-1 ring-black/[8%] dark:bg-black dark:text-white dark:border dark:border-gray-800"
>
<div className="grid grid-cols-3 gap-2.5 text-[#b8b6af]">
{actions.map((item, index) => (
<button
key={index}
onClick={() => {
window.open(item.link, "_blank")
ctx.setStatus("idle")
}}
className="size-24 grid cursor-pointer place-items-center rounded-2xl bg-[#fefefe] transition duration-500 ease-in-out hover:bg-[#f6f4f0] dark:hover:bg-gray-700 hover:duration-200 active:scale-90 dark:bg-black dark:shadow-xl dark:text-white dark:border dark:border-gray-900"
>
<div className="flex flex-col items-center gap-2">
{item.icon}
<p className="text-[#6b6967]">{item.name}</p>
</div>
</button>
))}
</div>
</motion.div>
</motion.div>
) : (
<motion.button
layoutId="container"
onClick={() => ctx.setStatus("open")}
whileTap={{ scale: 0.95 }}
style={{ borderRadius: 22 }}
className="flex items-center gap-1.5 bg-[#fafafa] px-5 py-2.5 tracking-tight text-[#202020] shadow-mixed ring-1 ring-black/[8%] transition-[box-shadow,background-color] hover:bg-[#e0deda] active:shadow-none dark:bg-black dark:text-white dark:border dark:border-gray-700 dark:hover:bg-gray-800"
>
<Plus strokeWidth={1} />
Create New
</motion.button>
)}
</AnimatePresence>
)
}`}
</code></pre>
</div>
</div>
<div className="flex flex-col space-y-4 ml-3 lg:ml-4 md:lg-3">
<p className="font-semibold mt-5 tracking-tight leading-7">Step 2: Update the import paths and run this code.</p>
<div className="w-full rounded-md [&_pre]:my-0 [&_pre]:max-h-[350px] [&_pre]:overflow-auto relative bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700">
<button onClick={() => {
const codeElement = document.getElementById('codeBlock2');
const copycode2 = codeElement ? codeElement.textContent : '';
if (copycode2) {
navigator.clipboard.writeText(copycode2).then(() => {
alert('Code copied to clipboard!');
});
}
}}
className="absolute right-0 top-0 z-10 m-4 flex items-center rounded-lg bg-transparent px-3 py-1 text-white" title="Copy code to clipboard">
<CopyIcon className="text-black hover:text-gray-400 active:text-blue-700 h-4 dark:text-white" />
</button>
<pre className="ml-2 py-2 pb-2 pl-2 font-sm"><code id="codeBlock2" className="text-left language-js text-sm">
{`import React from "react";
import CreateNewComponent from "../components/easyui/create-new";
import { Folder, ClipboardList, StickyNote, Trophy, Flag, BellRing } from "lucide-react";
const actionItems = [
{
link: "https://easyui.pro",
icon: <Folder />,
name: "Project",
},
{
link: "/task",
icon: <ClipboardList />,
name: "Task",
},
{
link: "/note",
icon: <StickyNote />,
name: "Note",
},
{
link: "/goal",
icon: <Trophy />,
name: "Goal",
},
{
link: "/milestone",
icon: <Flag />,
name: "Milestone",
},
{
link: "/reminder",
icon: <BellRing />,
name: "Reminder",
},
];
function HomePage() {
return (
<div>
<CreateNewComponent actions={actionItems} />
</div>
);
}
export default HomePage;
`}
{/* </div> */}
</code></pre>
</div>
</div>
<div className="mt-5 px-4 ml-3 lg:ml-1 md:lg-3">
<h2 className="text-2xl font-semibold mb-5 tracking-tight leading-7 border-b dark:border-gray-700 pb-2 scroll-m-20">Props</h2>
<table className="min-w-full table-auto border-collapse border border-gray-300 dark:border-gray-700">
<thead>
<tr className="bg-gray-100 dark:bg-gray-900">
<th className="border border-gray-300 px-4 py-2 text-left dark:border-gray-700">Prop Name</th>
<th className="border border-gray-300 px-4 py-2 text-left dark:border-gray-700">Type</th>
<th className="border border-gray-300 px-4 py-2 text-left dark:border-gray-700">Description</th>
<th className="border border-gray-300 px-4 py-2 text-left dark:border-gray-700">Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">actions</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">ActionItem[]</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">Array of actions containing link, icon, and name.</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">None</td>
</tr>
<tr>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">status</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">string</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">The current status of the component.</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">idle</td>
</tr>
<tr>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">setStatus</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">React.Dispatch<React.SetStateAction<string>></td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">Function to set the status of the component.</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">null</td>
</tr>
</tbody>
</table>
</div>
</TabsContent>
</Tabs>
<div className="py-10 ml-3">
<h2 className="font-heading mt-12 scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0">Credits</h2>
<p className="leading-7 [&:not(:first-child)]:mt-6 tracking tight">Credit to <a href="https://github.com/vaunblu/lab/blob/main/src/app/create-new/page.tsx" className="underline italic font-semibold" target="_blank" rel="noopener noreferrer">@vaunblu</a> for the inspiration behind this component.</p>
</div>
</div>
)
}
export default CreateNewComponentt
| DarkInventor/easy-ui/app/(docs)/create-new-component/page.tsx | {
"file_path": "DarkInventor/easy-ui/app/(docs)/create-new-component/page.tsx",
"repo_id": "DarkInventor/easy-ui",
"token_count": 7259
} | 0 |
"use client"
import React from "react"
import { Button } from "@/components/ui/button"
import { Badge } from "@/components/ui/badge"
import { Card, CardDescription, CardTitle } from "@/components/ui/card"
import { Icons } from "@/components/icons"
import AdBanner from "@/components/ad-banner"
import { BellRing, ClipboardList, Command, Flag, Folder, StickyNote, Trophy } from "lucide-react"
import CreateNewComponent from "@/components/easyui/create-new"
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"
import { RotateCcw } from "lucide-react"
import { CopyIcon } from "@radix-ui/react-icons"
import LaunchPad from "@/components/easyui/launchpad"
import KeyButton from "@/components/easyui/key-button"
import SparkleButton from "@/components/easyui/sparkle-button"
import SearchCommand from "@/components/easyui/search-command"
function SearchCommandComponent() {
const tagsData = [
{ tag: 'React', url: 'https://reactjs.org/' },
{ tag: 'Next.js', url: 'https://nextjs.org/' },
{ tag: 'Tailwind', url: 'https://tailwindcss.com/' },
{ tag: 'TypeScript', url: 'https://www.typescriptlang.org/' },
{ tag: 'JavaScript', url: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript' },
{ tag: 'Vue.js', url: 'https://vuejs.org/' },
{ tag: 'Angular', url: 'https://angular.io/' },
{ tag: 'Svelte', url: 'https://svelte.dev/' },
{ tag: 'Node.js', url: 'https://nodejs.org/' },
{ tag: 'GraphQL', url: 'https://graphql.org/' },
];
const [key, setKey] = React.useState(0); // State to trigger re-render
return (
<div className="flex flex-wrap justify-start gap-4 pb-10 max-w-full min-w-full px-0 lg:px-20">
<div className="w-full sm:w-1/2 p-2 mt-3 space-y-4 lg:mt-5 md:lg-5">
<CardTitle className="text-3xl tracking-tight leading-7">Command Search</CardTitle>
<CardDescription className="text-balance text-lg text-muted-foreground">Click <Command className="inline h-4 w-4"/>K to use.</CardDescription>
</div>
<Tabs defaultValue="preview" className="relative mr-auto w-full">
<div className="flex items-center justify-between pb-3">
<TabsList className="w-full justify-start rounded-none bg-transparent p-0">
<TabsTrigger value="preview" className="relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold text-muted-foreground shadow-none transition-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none">
Preview
</TabsTrigger>
<TabsTrigger value="code" className="relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold text-muted-foreground shadow-none transition-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none">
Code
</TabsTrigger>
</TabsList>
</div>
<TabsContent value="preview" className="relative rounded-md" key={key}>
<div className="flex items-center justify-center max-w-full mx-auto px-4 py-0.5 border rounded-lg h-[400px]">
<Button onClick={() => setKey((prev) => prev + 1)} className="absolute right-0 top-0 z-10 ml-4 flex items-center rounded-lg px-3 py-1" variant="ghost">
<RotateCcw size={16} />
</Button>
<span className="text-balance text-lg text-muted-foreground">Press <Command className="inline h-4 w-4"/>+K to preview.</span>
<SearchCommand tagsData={tagsData} />
</div>
</TabsContent>
<TabsContent value="code">
<div className="flex flex-col space-y-4 ml-3 lg:ml-4 md:lg-3 z-0">
<h2 className="font-semibold mt-12 scroll-m-20 border-b pb-2 text-2xl tracking-tight first:mt-0 leading-7">
Installation
</h2>
<p className="font-semibold mt-5 tracking-tight leading-7">Step 1: Copy and paste the following code into your<span className="font-normal italic"> components/key-button.tsx</span></p>
<div className="w-full rounded-md [&_pre]:my-0 [&_pre]:max-h-[350px] [&_pre]:overflow-auto relative bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 font-sm">
<button onClick={() => {
const codeElement = document.getElementById('codeBlock');
const codeToCopy = codeElement ? codeElement.textContent : '';
// @ts-ignore
navigator.clipboard.writeText(codeToCopy).then(() => {
alert('Code copied to clipboard!');
});
}}
className="absolute right-0 top-0 z-10 m-4 flex items-center rounded-lg px-3 py-1 text-white" title="Copy code to clipboard">
{/* <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2">
<path strokeLinecap="round" strokeLinejoin="round" d="M8 5C6.895 5 6 5.895 6 7v10c0 1.105.895 2 2 2h8c1.105 0 2-.895 2-2V7c0-1.105-.895-2-2-2H8zm0 0V3c0-1.105.895-2 2-2h4c1.105 0 2 .895 2 2v2m-6 4h4" />
</svg> */}
<CopyIcon className="text-black hover:text-gray-400 active:text-blue-700 h-4 dark:text-white" style={{ backdropFilter: 'blur(20px)' }} />
</button>
<pre className="ml-2 py-2 pb-2 pl-2 font-sm min-h-[600px] lg:min-h-[600px] sm:min-h-[300px]"><code id="codeBlock" className="text-left language-js text-sm ">
{`"use client"
import * as React from "react"
import { AnimatePresence, motion } from "framer-motion"
import {
ChevronDownIcon,
ChevronUpIcon,
CommandIcon,
HashIcon,
RotateCcwIcon,
XIcon,
} from "lucide-react"
import { Button } from "@/components/ui/button"
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
} from "@/components/ui/command"
type Page = "main" | "tags" | "parent"
type TagData = {
tag: string
url: string
}
type FullFeaturedCommandPaletteProps = {
tagsData: TagData[]
}
export default function SearchCommand({
tagsData,
}: FullFeaturedCommandPaletteProps) {
const [open, setOpen] = React.useState(false)
const [search, setSearch] = React.useState("")
const [theme] = React.useState<"light" | "dark">("light")
const [currentPage, setCurrentPage] = React.useState<Page>("main")
const [selectedTags, setSelectedTags] = React.useState<string[]>([])
const [navigationIndex, setNavigationIndex] = React.useState(-1)
React.useEffect(() => {
const down = (e: KeyboardEvent) => {
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
e.preventDefault()
setOpen((open) => !open)
}
}
document.addEventListener("keydown", down)
return () => document.removeEventListener("keydown", down)
}, [])
const filteredTags = tagsData
? tagsData.filter(({ tag }) =>
tag.toLowerCase().includes(search.toLowerCase())
)
: []
const handleTagSelect = (tag: string) => {
setSelectedTags((prev) =>
prev.includes(tag) ? prev.filter((t) => t !== tag) : [...prev, tag]
)
}
const handleNavigate = (direction: "up" | "down") => {
setNavigationIndex((prev) => {
if (direction === "up") {
return prev > 0 ? prev - 1 : filteredTags.length - 1
} else {
return prev < filteredTags.length - 1 ? prev + 1 : 0
}
})
}
if (!open) {
return null
}
return (
<div className="fixed top-20 py-10 lg:py-20 px-4 left-0 right-0 h-auto flex items-center justify-center transition-colors duration-300 bg-transparent pointer-events-none dark:bg-transparent ">
<div className="pointer-events-auto">
<motion.div
initial={false}
animate={
open ? { scale: 1, opacity: 1 } : { scale: 0.95, opacity: 0 }
}
transition={{ type: "spring", bounce: 0, duration: 0.3 }}
className="relative max-w-sm px-4 lg:w-full md:w-full lg:max-w-3xl md:max-w-xl"
>
<Command className="rounded-xl shadow-lg backdrop-blur-xl bg-transparent dark:border-gray-900 dark:border text-black dark:text-gray-100 leading-7 tracking-tight ">
<div className="flex items-center border-b border-1 border-gray-200 dark:border-gray-700 px-3">
<CommandInput
placeholder="Type a command or search"
value={search}
onValueChange={setSearch}
className="flex h-14 w-[650px] rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-gray-500 dark:placeholder:text-gray-400 disabled:cursor-not-allowed disabled:opacity-50 tracking-tight leading-7"
/>
<kbd className="hidden sm:inline-flex h-8 select-none items-center gap-1 rounded p-2 ml-[-20px] mr-2 font-mono text-[12px] font-medium bg-gray-200 dark:bg-gray-900 text-black dark:text-gray-300">
{/* K */}
<CommandIcon className="h-3 w-3 bg-transparent text-black dark:text-white" />
K
</kbd>
</div>
<CommandList className="max-h-[400px] overflow-y-auto overflow-x-hidden p-2">
<CommandEmpty className="py-6 text-center">
<HashIcon className="w-12 h-12 mx-auto mb-4 text-gray-600 dark:text-gray-400" />
<h3 className="text-lg font-semibold mb-1">No tags found</h3>
<p className="text-sm mb-4 text-gray-600 dark:text-gray-400">
"{search}" did not match any tags currently used in
projects. Please try again or create a new tag.
</p>
<Button
variant="outline"
className="bg-white hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700"
onClick={() => setSearch("")}
>
Clear search
</Button>
</CommandEmpty>
<CommandGroup
className="text-gray-500 font-bold tracking-tight leading-7 "
heading="Tags"
>
<AnimatePresence>
{filteredTags.map(({ tag, url }, index) => (
<motion.div
key={tag}
initial={{ opacity: 0, y: -10 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -10 }}
transition={{
type: "spring",
stiffness: 300,
damping: 30,
}}
className="font-normal text-md"
onClick={() => (window.location.href = url)}
>
<CommandItem
className={\`px-2 py-2 rounded-lg cursor-pointer \${
index === navigationIndex
? "bg-black/10 dark:bg-white/20 text-gray-700 dark:text-white"
: ""
} hover:bg-black/5 dark:hover:bg-white/10 text-black dark:text-gray-300 transition-colors\`}
>
<a
href={url}
className={
selectedTags.includes(tag) ? "font-bold" : ""
}
target="_blank"
rel="noreferrer"
>
{tag}
</a>
</CommandItem>
</motion.div>
))}
</AnimatePresence>
</CommandGroup>
</CommandList>
<div className="flex flex-wrap items-center justify-between gap-2 border-t px-2 py-2 text-sm border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400">
<div className="flex flex-wrap items-center gap-2">
<Button
variant="ghost"
size="icon"
className="h-8 w-8"
onClick={() => setCurrentPage("tags")}
>
<HashIcon className="h-4 w-4" />
</Button>
<span className="hidden sm:block">tags</span>
<Button
variant="ghost"
size="icon"
className="h-8 w-8 hover:bg-gray-100 dark:hover:bg-gray-700"
onClick={() => handleNavigate("up")}
>
<ChevronUpIcon className="h-4 w-4" />
</Button>
<Button
variant="ghost"
size="icon"
className="h-8 w-8 hover:bg-gray-100 dark:hover:bg-gray-700"
onClick={() => handleNavigate("down")}
>
<ChevronDownIcon className="h-4 w-4" />
</Button>
<span className="hidden sm:block">navigate</span>
</div>
<div className="flex flex-wrap items-center gap-2">
<Button
variant="ghost"
size="icon"
className="h-8 w-8 hover:bg-gray-100 dark:hover:bg-gray-700"
onClick={() => {
setSearch("")
setSelectedTags([])
setNavigationIndex(-1)
}}
>
<RotateCcwIcon className="h-4 w-4" />
</Button>
<span className="hidden sm:block">reset</span>
<Button
variant="ghost"
size="icon"
className="h-8 w-8 hover:bg-gray-100 dark:hover:bg-gray-700"
onClick={() => setOpen(false)}
>
<XIcon className="h-4 w-4" />
</Button>
<span className="hidden sm:block mr-2">close</span>
</div>
</div>
</Command>
</motion.div>
</div>
</div>
)
}
`}
</code></pre>
</div>
</div>
<div className="flex flex-col space-y-4 ml-3 lg:ml-4 md:lg-3">
<p className="font-semibold mt-5 tracking-tight leading-7">Step 2: Update the import paths and run this code.</p>
<div className="w-full rounded-md [&_pre]:my-0 [&_pre]:max-h-[350px] [&_pre]:overflow-auto relative bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700">
<button onClick={() => {
const codeElement = document.getElementById('codeBlock2');
const copycode2 = codeElement ? codeElement.textContent : '';
if (copycode2) {
navigator.clipboard.writeText(copycode2).then(() => {
alert('Code copied to clipboard!');
});
}
}}
className="absolute right-0 top-0 z-10 m-4 flex items-center rounded-lg bg-transparent px-3 py-1 text-white" title="Copy code to clipboard">
<CopyIcon className="text-black hover:text-gray-400 active:text-blue-700 h-4 dark:text-white" />
</button>
<pre className="ml-2 py-2 pb-2 pl-2 font-sm"><code id="codeBlock2" className="text-left language-js text-sm">
{`import SearchCommand from '@/components/easyui/search-command'
import React from 'react'
function Home() {
const tagsData = [
{ tag: 'React', url: 'https://reactjs.org/' },
{ tag: 'Next.js', url: 'https://nextjs.org/' },
{ tag: 'Tailwind', url: 'https://tailwindcss.com/' },
{ tag: 'TypeScript', url: 'https://www.typescriptlang.org/' },
{ tag: 'JavaScript', url: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript' },
{ tag: 'Vue.js', url: 'https://vuejs.org/' },
{ tag: 'Angular', url: 'https://angular.io/' },
{ tag: 'Svelte', url: 'https://svelte.dev/' },
{ tag: 'Node.js', url: 'https://nodejs.org/' },
{ tag: 'GraphQL', url: 'https://graphql.org/' },
];
return (
<SearchCommand tagsData={tagsData} />
)
}
export default Home;
`}
{/* </div> */}
</code></pre>
</div>
</div>
{/* <div className="mt-5 px-4 ml-3 lg:ml-1 md:lg-3"> */}
{/* <h2 className="text-2xl font-semibold mb-5 tracking-tight leading-7 border-b dark:border-gray-700 pb-2 scroll-m-20">Props</h2>
<table className="min-w-full table-auto border-collapse border border-gray-300 dark:border-gray-700">
<thead>
<tr className="bg-gray-100 dark:bg-gray-900">
<th className="border border-gray-300 px-4 py-2 dark:border-gray-700">Prop Name</th>
<th className="border border-gray-300 px-4 py-2 dark:border-gray-700">Type</th>
<th className="border border-gray-300 px-4 py-2 dark:border-gray-700">Description</th>
<th className="border border-gray-300 px-4 py-2 dark:border-gray-700">Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">id</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">Number</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">
Unique identifier for each application.
</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">-</td>
</tr>
<tr>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">name</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">String</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">
Name of the application.
</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">-</td>
</tr>
<tr>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">icon</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">String</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">
URL or path to the application's icon image.
</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">-</td>
</tr>
<tr>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">category</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">String</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">
Category to which the application belongs.
</td>
<td className="border border-gray-300 px-4 py-2 dark:border-gray-700">-</td>
</tr>
</tbody>
</table> */}
{/* </div> */}
</TabsContent>
</Tabs>
{/* <div className="py-10 ml-3">
<h2 className="font-heading mt-12 scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0">Credits</h2>
<p className="leading-7 [&:not(:first-child)]:mt-6 tracking tight">Credit to <a href="https://github.com/vaunblu/lab/blob/main/src/app/create-new/page.tsx" className="underline italic font-semibold" target="_blank" rel="noopener noreferrer">@vaunblu</a> for the inspiration behind this component.</p>
</div> */}
</div>
)
}
export default SearchCommandComponent
| DarkInventor/easy-ui/app/(docs)/search-command-component/page.tsx | {
"file_path": "DarkInventor/easy-ui/app/(docs)/search-command-component/page.tsx",
"repo_id": "DarkInventor/easy-ui",
"token_count": 9758
} | 1 |
import { cn } from "@/lib/utils";
import Marquee from "@/components/magicui/marquee";
const reviews = [
{
name: "Marcello Fonseca",
username: "@Marcello Fonseca",
body: "Very Nice!! ",
img: "https://media.licdn.com/dms/image/v2/D4E03AQFs2UszxjYiLQ/profile-displayphoto-shrink_100_100/profile-displayphoto-shrink_100_100/0/1722223533843?e=1732147200&v=beta&t=EhjU82qlg6aYz0IcPFV53T_hdRP3vzaKJUy-_FVZwqo",
link: "https://www.linkedin.com/feed/update/urn:li:ugcPost:7211502593452216320?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7211502593452216320%2C7211504229494984705%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287211504229494984705%2Curn%3Ali%3AugcPost%3A7211502593452216320%29",
},
{
name: "Sayed Suliman",
username: "@Sayed Suliman",
body: "Can't wait! ",
img: "https://media.licdn.com/dms/image/v2/D5603AQGnQm6vP_Jpfg/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1719313252960?e=1732147200&v=beta&t=jA5hp5ca1-AlVB9RxfTyM9EFZkqtBtEPEDo5_6gbGDM",
link: "https://www.linkedin.com/feed/update/urn:li:ugcPost:7211502593452216320?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7211502593452216320%2C7211524681336553473%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287211524681336553473%2Curn%3Ali%3AugcPost%3A7211502593452216320%29",
},
{
name: "Danny Chen",
username: "@Danny Chen",
body: "That is smooth like butter ",
img: "https://media.licdn.com/dms/image/v2/D4D03AQGjpcwBbDxD2w/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1723423682467?e=1729728000&v=beta&t=iYyx1uSH30Xrpu118my_gyhUnHAjBqwXPPx8y_N4sSU",
link: "https://www.linkedin.com/feed/update/urn:li:ugcPost:7211502593452216320?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7211502593452216320%2C7211509809668366336%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287211509809668366336%2Curn%3Ali%3AugcPost%3A7211502593452216320%29",
},
{
name: "Dally R",
username: "@Dally R",
body: "Great job! Love this.",
img: "https://media.licdn.com/dms/image/v2/D4D35AQEl_EU_CVGi_w/profile-framedphoto-shrink_400_400/profile-framedphoto-shrink_400_400/0/1711663894244?e=1727028000&v=beta&t=nStMuhE6nNOJwEMpLcGSZCXpCDdIgEycwvDoijDnYRU",
link: "https://www.linkedin.com/feed/update/urn:li:ugcPost:7210915776176791555?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7210915776176791555%2C7211017051711111169%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287211017051711111169%2Curn%3Ali%3AugcPost%3A7210915776176791555%29",
},
{
name: "Jerome Renard",
username: "@Jerome Renard",
body: "Looking really good!",
img: "https://media.licdn.com/dms/image/v2/D5603AQFJ_EY-hgejfQ/profile-displayphoto-shrink_100_100/profile-displayphoto-shrink_100_100/0/1711319351530?e=1732147200&v=beta&t=qryI-WkZA4PDq0cSYpfPQTlPFqdxkLad41KOimd2mls",
link: "https://www.linkedin.com/feed/update/urn:li:ugcPost:7210915776176791555?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7210915776176791555%2C7211032199658102784%29&replyUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7210915776176791555%2C7211032581247537153%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287211032199658102784%2Curn%3Ali%3AugcPost%3A7210915776176791555%29&dashReplyUrn=urn%3Ali%3Afsd_comment%3A%287211032581247537153%2Curn%3Ali%3AugcPost%3A7210915776176791555%29",
},
];
const firstRow = reviews.slice(0, reviews.length / 2);
const secondRow = reviews.slice(reviews.length / 2);
const ReviewCard = ({
img,
name,
username,
body,
link,
}: {
img: string;
name: string;
username: string;
body: string;
link: string;
}) => {
return (
<a href={link} target="_blank" rel="noopener noreferrer">
<figure
className={cn(
"relative w-64 cursor-pointer overflow-hidden rounded-xl border p-4",
// light styles
"border-gray-950/[.1] bg-gray-950/[.01] hover:bg-gray-950/[.05]",
// dark styles
"dark:border-gray-50/[.1] dark:bg-gray-50/[.10] dark:hover:bg-gray-50/[.15]",
)}
>
<div className="flex flex-row items-center gap-2">
<img className="rounded-full" width="32" height="32" alt="" src={img} />
<div className="flex flex-col">
<figcaption className="text-sm font-medium dark:text-white">
{name}
</figcaption>
<p className="text-xs font-medium dark:text-white/40">{username}</p>
</div>
</div>
<blockquote className="mt-2 text-sm">{body}</blockquote>
</figure>
</a>
);
};
const MarqueeDemo = () => {
return (
<div className="relative mt-0 flex size-full flex-col items-center justify-center overflow-hidden rounded-lg pb-5">
<div className="mx-auto flex max-w-full flex-col items-center space-y-4 pt-0 text-center">
<h2 className="font-heading text-3xl leading-[1.1] sm:text-3xl md:text-3xl font-bold sm:max-w-[85%] max-w-[85%] lg:max-w-[100%] md:max-w-[100%]">
Don't take our word for it
</h2>
<p className="text-muted-foreground sm:max-w-[85%] max-w-[85%] lg:max-w-[100%] md:max-w-[100%] pb-10 leading-normal sm:text-lg sm:leading-7">
Hear what <span className="font-bold">real people</span> have to say about us.
</p>
</div>
<Marquee pauseOnHover className="[--duration:20s]">
{firstRow.map((review) => (
<ReviewCard key={review.username} {...review} />
))}
</Marquee>
<Marquee reverse pauseOnHover className="[--duration:20s]">
{secondRow.map((review) => (
<ReviewCard key={review.username} {...review} />
))}
</Marquee>
<div className="pointer-events-none absolute inset-y-0 left-0 h-full w-[1.2%] bg-gradient-to-r from-background"></div>
<div className="pointer-events-none absolute inset-y-0 right-0 h-full w-[1.2%] bg-gradient-to-l from-background"></div>
</div>
);
};
export default MarqueeDemo;
| DarkInventor/easy-ui/app/testimonials/page.tsx | {
"file_path": "DarkInventor/easy-ui/app/testimonials/page.tsx",
"repo_id": "DarkInventor/easy-ui",
"token_count": 2906
} | 2 |
import Image from "next/image"
import { useMDXComponent } from "next-contentlayer/hooks"
import { cn } from "@/lib/utils"
import { Callout } from "./callout"
import MdxCard from "./mdx-card"
const components = {
h1: ({ className = "", ...props }) => (
<h1
className={cn(
"mt-2 scroll-m-20 text-4xl font-bold tracking-tight",
className
)}
{...props}
/>
),
h2: ({ className = "", ...props }) => (
<h2
className={cn(
"mt-10 scroll-m-20 border-b pb-1 text-3xl font-semibold tracking-tight first:mt-0",
className
)}
{...props}
/>
),
h3: ({ className = "", ...props }) => (
<h3
className={cn(
"mt-8 scroll-m-20 text-2xl font-semibold tracking-tight",
className
)}
{...props}
/>
),
h4: ({ className = "", ...props }) => (
<h4
className={cn(
"mt-8 scroll-m-20 text-xl font-semibold tracking-tight",
className
)}
{...props}
/>
),
h5: ({ className = "", ...props }) => (
<h5
className={cn(
"mt-8 scroll-m-20 text-lg font-semibold tracking-tight",
className
)}
{...props}
/>
),
h6: ({ className = "", ...props }) => (
<h6
className={cn(
"mt-8 scroll-m-20 text-base font-semibold tracking-tight",
className
)}
{...props}
/>
),
a: ({ className = "", ...props }) => (
<a
className={cn("font-medium underline underline-offset-4", className)}
{...props}
/>
),
p: ({ className = "", ...props }) => (
<p
className={cn("leading-7 [&:not(:first-child)]:mt-6", className)}
{...props}
/>
),
ul: ({ className = "", ...props }) => (
<ul className={cn("my-6 ml-6 list-disc", className)} {...props} />
),
ol: ({ className = "", ...props }) => (
<ol className={cn("my-6 ml-6 list-decimal", className)} {...props} />
),
li: ({ className = "", ...props }) => (
<li className={cn("mt-2", className)} {...props} />
),
blockquote: ({ className = "", ...props }) => (
<blockquote
className={cn(
"[&>*]:text-muted-foreground mt-6 border-l-2 pl-6 italic",
className
)}
{...props}
/>
),
img: ({
className = "",
alt = "",
...props
}: {
className?: string
alt?: string
[prop: string]: any
}) => (
// eslint-disable-next-line @next/next/no-img-element
<img className={cn("rounded-md border", className)} alt={alt} {...props} />
),
hr: ({ ...props }) => <hr className="my-4 md:my-8" {...props} />,
table: ({ className = "", ...props }) => (
<div className="my-6 w-full overflow-y-auto">
<table className={cn("w-full", className)} {...props} />
</div>
),
tr: ({ className = "", ...props }) => (
<tr
className={cn("m-0 border-t p-0 even:bg-muted", className)}
{...props}
/>
),
th: ({ className = "", ...props }) => (
<th
className={cn(
"border px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right",
className
)}
{...props}
/>
),
td: ({
className = "",
...props
}: {
className?: string
[prop: string]: any
}) => (
<td
className={cn(
"border px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right",
className
)}
{...props}
/>
),
pre: ({ className = "", ...props }) => (
<pre
className={cn(
"mb-4 mt-6 overflow-x-auto rounded-lg border bg-black py-4",
className
)}
{...props}
/>
),
code: ({ className = "", ...props }) => (
<code
className={cn(
"relative rounded border px-[0.3rem] py-[0.2rem] font-mono text-sm",
className
)}
{...props}
/>
),
Image,
Callout,
Card: MdxCard,
}
interface MdxProps {
code: string
}
export function Mdx({ code }: MdxProps) {
const Component = useMDXComponent(code)
return (
<div className="mdx">
<Component components={components} />
</div>
)
}
export { MdxCard } | DarkInventor/easy-ui/components/mdx-components.tsx | {
"file_path": "DarkInventor/easy-ui/components/mdx-components.tsx",
"repo_id": "DarkInventor/easy-ui",
"token_count": 1956
} | 3 |
// import remarkGfm from 'remark-gfm'
import createMDX from '@next/mdx'
// With this:
import { withContentlayer } from "next-contentlayer";
const nextConfig = {
reactStrictMode: true,
experimental: {
appDir: true,
},
pageExtensions: ['js', 'jsx', 'mdx', 'ts', 'tsx'],
images: {
domains: ['dev-to-uploads.s3.amazonaws.com'],
},
}
const withMDX = createMDX({
options: {
remarkPlugins: [],
rehypePlugins: [],
},
})
export default withContentlayer(nextConfig);
| DarkInventor/easy-ui/next.config.mjs | {
"file_path": "DarkInventor/easy-ui/next.config.mjs",
"repo_id": "DarkInventor/easy-ui",
"token_count": 191
} | 4 |
import { siteUrls } from "@/config/urls";
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={siteUrls.socials.twitter}
target="_blank"
rel="noreferrer"
className="font-medium underline underline-offset-4"
>
alifarooq
</a>
. The source code is available on{" "}
<a
href={siteUrls.socials.github}
target="_blank"
rel="noreferrer"
className="font-medium underline underline-offset-4"
>
GitHub
</a>
.
</p>
</div>
</footer>
);
}
| alifarooq9/rapidlaunch/apps/www/src/app/(app)/_components/site-footer.tsx | {
"file_path": "alifarooq9/rapidlaunch/apps/www/src/app/(app)/_components/site-footer.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 729
} | 5 |
"use client"
import { useTheme } from "next-themes"
import { Toaster as Sonner } from "sonner"
type ToasterProps = React.ComponentProps<typeof Sonner>
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "system" } = useTheme()
return (
<Sonner
theme={theme as ToasterProps["theme"]}
className="toaster group"
toastOptions={{
classNames: {
toast:
"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
description: "group-[.toast]:text-muted-foreground",
actionButton:
"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
cancelButton:
"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
},
}}
{...props}
/>
)
}
export { Toaster }
| alifarooq9/rapidlaunch/apps/www/src/components/ui/sonner.tsx | {
"file_path": "alifarooq9/rapidlaunch/apps/www/src/components/ui/sonner.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 384
} | 6 |
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import * as schema from "./schema";
const globalForDb = globalThis as unknown as {
conn: postgres.Sql | undefined;
};
const conn = globalForDb.conn ?? postgres(process.env.DATABASE_URL!);
if (process.env.NODE_ENV !== "production") globalForDb.conn = conn;
export const db = drizzle(conn, { schema });
| alifarooq9/rapidlaunch/packages/db/src/index.ts | {
"file_path": "alifarooq9/rapidlaunch/packages/db/src/index.ts",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 133
} | 7 |
# Since the ".env" file is gitignored, you can use the ".env.example" file to
# build a new ".env" file when you clone the repo. Keep this file up-to-date
# when you add new variables to `.env`.
# This file will be committed to version control, so make sure not to have any
# secrets in it. If you are cloning this repo, create a copy of this file named
# ".env" and populate it with your secrets.
# When adding additional environment variables, the schema in "/src/env.js"
# should be updated accordingly.
# Drizzle
DATABASE_URL="postgresql://postgres:password@localhost:5432/demo"
# Next Auth
# You can generate a new secret on the command line with:
# openssl rand -base64 32
# https://next-auth.js.org/configuration/options#secret
NEXTAUTH_SECRET=""
NEXTAUTH_URL="http://localhost:3000"
# Next Auth Google Provider secrets
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
# Next Auth Github Provider secrets
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
# Resend Api key
RESEND_API_KEY=""
# Uploadthing keys
UPLOADTHING_SECRET=""
UPLOADTHING_ID=""
# LemonSqueezy keys
LEMONSQUEEZY_API_KEY=""
LEMONSQUEEZY_STORE_ID=""
LEMONSQUEEZY_WEBHOOK_SECRET=""
# Posthog
NEXT_PUBLIC_POSTHOG_KEY=""
NEXT_PUBLIC_POSTHOG_HOST="" | alifarooq9/rapidlaunch/starterkits/saas/.env.example | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/.env.example",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 417
} | 8 |
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
* for Docker builds.
*/
await import("./src/env.js");
import createMDX from "fumadocs-mdx/config";
const withMDX = createMDX({
mdxOptions: {
lastModifiedTime: "git",
},
});
/** @type {import('next').NextConfig} */
const nextConfig = {
// Optionally, add any other Next.js config below
experimental: {
optimizePackageImports: ["lucide-react"],
},
images: {
remotePatterns: [{ hostname: "fakeimg.pl" }, { hostname: "utfs.io" }],
},
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
async rewrites() {
return [
{
source: "/ingest/static/:path*",
destination: "https://us-assets.i.posthog.com/static/:path*",
},
{
source: "/ingest/:path*",
destination: "https://us.i.posthog.com/:path*",
},
];
},
// This is required to support PostHog trailing slash API requests
skipTrailingSlashRedirect: true,
};
export default withMDX(nextConfig);
| alifarooq9/rapidlaunch/starterkits/saas/next.config.mjs | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/next.config.mjs",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 546
} | 9 |
import React from "react";
import { AppLayoutShell } from "@/app/(app)/_components/layout-shell";
import { sidebarConfig } from "@/config/sidebar";
type AppLayoutProps = {
children: React.ReactNode;
};
export default function UserLayout({ children }: AppLayoutProps) {
// these are the ids of the sidebar nav items to not included in the sidebar specifically @get ids from the sidebar config
const sideNavRemoveIds: string[] = [sidebarConfig.navIds.admin];
return (
<AppLayoutShell sideNavRemoveIds={sideNavRemoveIds}>
{children}
</AppLayoutShell>
);
}
| alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/(user)/layout.tsx | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/(user)/layout.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 204
} | 10 |
"use client";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { useEffect, useState } from "react";
type ShareInviteLinkProps = {
inviteLink: string;
};
export function ShareInviteLink({ inviteLink }: ShareInviteLinkProps) {
const [isPending, setIsPending] = useState(false);
const [isCopied, setIsCopied] = useState(false);
const copyLink = async () => {
setIsPending(true);
await navigator.clipboard.writeText(inviteLink);
setIsCopied(true);
setIsPending(false);
};
useEffect(() => {
let timeout: NodeJS.Timeout;
if (isCopied) {
timeout = setTimeout(() => {
setIsCopied(false);
}, 3000);
}
return () => {
clearTimeout(timeout);
};
}, [isCopied]);
return (
<div className="flex gap-4 md:flex-row md:items-center md:justify-between">
<div className="flex w-full space-x-2">
<Input value={inviteLink} readOnly />
<Button
disabled={isPending}
variant="secondary"
className="shrink-0"
onClick={copyLink}
>
{isCopied ? "Copied" : "Copy Link"}
</Button>
</div>
</div>
);
}
| alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/(user)/org/members/invite/_components/share-invite-link.tsx | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/(user)/org/members/invite/_components/share-invite-link.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 693
} | 11 |
export const profileSettingsPageConfig = {
title: "Profile Settings",
description:
"Here you can manage all the settings related to your profile, such as your name, profile picture, and more!",
} as const;
| alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/(user)/profile/settings/_constants/page-config.ts | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/(user)/profile/settings/_constants/page-config.ts",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 62
} | 12 |
"use client";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import { cn, setOrgCookie } from "@/lib/utils";
import { CheckIcon, PlusCircledIcon } from "@radix-ui/react-icons";
import { Fragment, useState } from "react";
import { CreateOrgForm } from "@/app/(app)/_components/create-org-form";
import { type organizations } from "@/server/db/schema";
import { useAwaitableTransition } from "@/hooks/use-awaitable-transition";
import { useRouter } from "next/navigation";
import { switchOrgPendingState } from "@/app/(app)/_components/org-switch-loading";
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
} from "@/components/ui/command";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
export type UserOrgs = {
heading: string;
items: (typeof organizations.$inferSelect)[];
};
type OrgSelectDropdownProps = {
currentOrg: typeof organizations.$inferSelect;
userOrgs: UserOrgs[];
};
export function OrgSelectDropdown({
currentOrg,
userOrgs,
}: OrgSelectDropdownProps) {
const router = useRouter();
const isCollapsed = false;
const { setIsPending } = switchOrgPendingState();
const [, startAwaitableTransition] = useAwaitableTransition();
const onOrgChange = async (orgId: string) => {
setIsPending(true);
setOrgCookie(orgId);
await startAwaitableTransition(() => {
router.refresh();
});
setIsPending(false);
};
const [modalOpen, setModalOpen] = useState<boolean>(false);
const [popOpen, setPopOpen] = useState<boolean>(false);
return (
<Fragment>
<CreateOrgForm open={modalOpen} setOpen={setModalOpen} />
<Popover
modal={false}
open={popOpen}
onOpenChange={(o: boolean) => setPopOpen(o)}
>
<PopoverTrigger asChild role="combobox">
<Button
variant="outline"
className={cn(
"flex w-full justify-start gap-2 overflow-hidden p-2",
)}
aria-label="select organization"
>
<Avatar className="h-6 w-6">
<AvatarImage
src={currentOrg?.image ? currentOrg.image : ""}
/>
<AvatarFallback className="text-xs">
{currentOrg?.name?.charAt(0).toUpperCase()}
</AvatarFallback>
</Avatar>
{!isCollapsed && (
<span className="truncate">{currentOrg?.name}</span>
)}
<span className="sr-only">org select menu</span>
</Button>
</PopoverTrigger>
<PopoverContent className="z-50 w-60 p-0" align="start">
<Command>
<CommandList>
<CommandInput placeholder="Search team..." />
<CommandEmpty>No team found.</CommandEmpty>
{userOrgs.map((group, index) => (
<CommandGroup
heading={group.heading}
key={index}
>
{group.items.length > 0 ? (
group.items.map((org) => (
<CommandItem
key={org.id}
onSelect={async () => {
setPopOpen(false);
await onOrgChange(org.id);
}}
className="text-sm"
>
<Avatar className="mr-2 h-5 w-5">
<AvatarImage
src={org.image ?? ""}
alt={org.name}
/>
<AvatarFallback>
{org.name
.charAt(0)
.toUpperCase()}
</AvatarFallback>
</Avatar>
{org.name}
<CheckIcon
className={cn(
"ml-auto h-4 w-4",
currentOrg.id === org.id
? "opacity-100"
: "opacity-0",
)}
/>
</CommandItem>
))
) : (
<p className="px-2 text-xs font-light text-muted-foreground">
No organization found.
</p>
)}
</CommandGroup>
))}
</CommandList>
<CommandSeparator />
<CommandList>
<CommandGroup>
<CommandItem>
<button
onClick={() => setModalOpen(true)}
className="flex w-full cursor-pointer items-center justify-start gap-2"
>
<PlusCircledIcon className="h-4 w-4" />
<span className="font-medium">
Create Organization
</span>
</button>
</CommandItem>
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
</Fragment>
);
}
| alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/_components/org-select-dropdown.tsx | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/_components/org-select-dropdown.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 4711
} | 13 |
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Badge } from "@/components/ui/badge";
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { type getAllPaginatedFeedbacksQuery } from "@/server/actions/feedback/queries";
type FeedbackDetailsProps = Awaited<
ReturnType<typeof getAllPaginatedFeedbacksQuery>
>["data"][number];
export function FeedbackDetails(props: FeedbackDetailsProps) {
return (
<Dialog>
<DialogTrigger asChild>
<span className="cursor-pointer font-medium hover:underline">
{props.title}
</span>
</DialogTrigger>
<DialogContent className="max-h-screen overflow-auto">
<DialogHeader>
<DialogTitle>Feedback Details</DialogTitle>
<DialogDescription>
View the details of the feedback.
</DialogDescription>
</DialogHeader>
<div className="grid gap-4">
<div className="flex items-center gap-3">
<Avatar className="h-8 w-8">
<AvatarImage src={props.user.image ?? ""} />
<AvatarFallback className="text-xs">
{props.user.email.charAt(0).toUpperCase()}
</AvatarFallback>
</Avatar>
<div>
<p className="w-full truncate text-sm font-medium">
{props.user.name}
</p>
<p className="w-full truncate text-sm font-light text-muted-foreground">
{props.user.email}
</p>
</div>
</div>
<div className="flex flex-wrap items-center gap-2">
<Badge variant="outline" className="w-fit">
{props.label}
</Badge>
<Badge
variant={
props.status === "Open"
? "success"
: props.status === "In Progress"
? "info"
: "secondary"
}
className="w-fit"
>
{props.status}
</Badge>
</div>
<div className="grid gap-1">
<h3 className="font-semibold">{props.title}</h3>
<p className="text-sm">{props.message}</p>
</div>
</div>
</DialogContent>
</Dialog>
);
}
| alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/admin/feedbacks/_components/feedback-details.tsx | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/admin/feedbacks/_components/feedback-details.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 1867
} | 14 |
/**
* This file contains the page configuration for the users page.
* This is used to generate the page title and description.
*/
export const usersPageConfig = {
title: "Users",
description:
"View all users in your app. Perform actions such as creating new users, sending users login links, and more!",
} as const;
| alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/admin/users/_constants/page-config.ts | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/(app)/admin/users/_constants/page-config.ts",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 91
} | 15 |
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { Badge } from "@/components/ui/badge";
import { cn, isLinkActive } from "@/lib/utils";
import { navigation } from "@/config/header";
import { buttonVariants } from "@/components/ui/button";
/**
* For adding a new navigation item:
*
* - Add a new object to the headerNav array in the webConfig object in the nav.ts file located /config/web.ts.
*/
export function WebHeaderNav() {
const pathname = usePathname();
return (
<nav className="flex items-center justify-center">
<ul className="flex items-center">
{navigation.map((item) => (
<li key={item.id}>
<Link
href={item.href}
className={cn(
buttonVariants({ variant: "link" }),
isLinkActive(item.href, pathname)
? "font-semibold"
: "font-medium",
)}
>
<span>{item.label}</span>
{item.badge && (
<Badge
variant="outline"
size="sm"
className="ml-1"
>
{item.badge}
</Badge>
)}
</Link>
</li>
))}
</ul>
</nav>
);
}
| alifarooq9/rapidlaunch/starterkits/saas/src/app/(web)/_components/header-nav.tsx | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/(web)/_components/header-nav.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 1060
} | 16 |
import {
WebPageHeader,
WebPageWrapper,
} from "@/app/(web)/_components/general-components";
import { buttonVariants } from "@/components/ui/button";
import {
Card,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { type SupportInfo, supportInfos } from "@/config/support";
import { ArrowRightIcon } from "lucide-react";
import Link from "next/link";
import { type Metadata } from "next";
import { supportPageConfig } from "@/app/(web)/support/_constants/page-config";
export const metadata: Metadata = {
title: supportPageConfig.title,
description: supportPageConfig.description,
};
export default function ContactPage() {
return (
<WebPageWrapper>
<WebPageHeader
title={supportPageConfig.title}
badge="Get in touch with us"
>
<p>
If you have any questions or need help, feel free to reach
out to us.
</p>
</WebPageHeader>
<div className="grid max-w-4xl grid-cols-1 gap-5 sm:grid-cols-2">
{supportInfos.map((supportInfo) => (
<SupportCard key={supportInfo.title} {...supportInfo} />
))}
</div>
</WebPageWrapper>
);
}
function SupportCard({
buttonHref,
buttonText,
description,
title,
email,
}: SupportInfo) {
return (
<Card>
<CardHeader className="flex h-full flex-col items-start justify-between gap-3">
<div className="flex flex-col gap-2">
<CardTitle>{title}</CardTitle>
<CardDescription>{description}</CardDescription>
{email && <p className="text-base text-primary">{email}</p>}
</div>
<Link
href={buttonHref}
className={buttonVariants({
className:
"w-fit gap-1 transition-all duration-300 ease-in-out hover:gap-3",
variant: "secondary",
})}
>
<span>{buttonText}</span>
<ArrowRightIcon className="h-4 w-4" />
</Link>
</CardHeader>
</Card>
);
}
| alifarooq9/rapidlaunch/starterkits/saas/src/app/(web)/support/page.tsx | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/(web)/support/page.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 1174
} | 17 |
import { Skeleton } from "@/components/ui/skeleton";
export default function OrgRequestPageLoading() {
return (
<div className="container flex min-h-screen flex-col items-center justify-center">
<Skeleton className="h-52 w-screen max-w-sm" />
</div>
);
}
| alifarooq9/rapidlaunch/starterkits/saas/src/app/invite/org/[orgId]/loading.tsx | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/app/invite/org/[orgId]/loading.tsx",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 114
} | 18 |
// export all organization related config here
export const orgConfig = {
cookieName: "rapidlaunch:current-organization",
} as const;
| alifarooq9/rapidlaunch/starterkits/saas/src/config/organization.ts | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/config/organization.ts",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 38
} | 19 |
"use server";
import { db } from "@/server/db";
import { feedback } from "@/server/db/schema";
import { adminProcedure, protectedProcedure } from "@/server/procedures";
import { unstable_noStore as noStore } from "next/cache";
import { asc, count, desc, eq, ilike, inArray, or } from "drizzle-orm";
import { z } from "zod";
/**
* get all feedback
* @returns all feedback
*/
export async function getUserFeedbacksQuery() {
const { user } = await protectedProcedure();
return await db.query.feedback.findMany({
orderBy: desc(feedback.createdAt),
where: eq(feedback.userId, user.id),
});
}
/**
* get all feedback
* @returns all feedback
* (admin only)
*/
const panginatedFeedbackPropsSchema = z.object({
page: z.coerce.number().default(1),
per_page: z.coerce.number().default(10),
sort: z.string().optional(),
title: z.string().optional(),
label: z.string().optional(),
status: z.string().optional(),
operator: z.string().optional(),
});
type GetPaginatedFeedbackQueryProps = z.infer<
typeof panginatedFeedbackPropsSchema
>;
export async function getAllPaginatedFeedbacksQuery(
input: GetPaginatedFeedbackQueryProps,
) {
noStore();
await adminProcedure();
const offset = (input.page - 1) * input.per_page;
const [column, order] = (input.sort?.split(".") as [
keyof typeof feedback.$inferSelect | undefined,
"asc" | "desc" | undefined,
]) ?? ["title", "desc"];
const labels =
(input.label?.split(".") as (typeof feedback.$inferSelect.label)[]) ??
[];
const statuses =
(input.status?.split(".") as (typeof feedback.$inferSelect.status)[]) ??
[];
const { data, total } = await db.transaction(async (tx) => {
const data = await tx.query.feedback.findMany({
orderBy:
column && column in feedback
? order === "asc"
? asc(feedback[column])
: desc(feedback[column])
: desc(feedback.createdAt),
offset,
limit: input.per_page,
where: or(
input.title
? ilike(feedback.title, `%${input.title}%`)
: undefined,
labels.length > 0 ? inArray(feedback.label, labels) : undefined,
statuses.length > 0
? inArray(feedback.status, statuses)
: undefined,
),
with: {
user: {
columns: {
id: true,
name: true,
email: true,
image: true,
},
},
},
});
const total = await tx
.select({
count: count(),
})
.from(feedback)
.where(
or(
input.title
? ilike(feedback.title, `%${input.title}%`)
: undefined,
labels.length > 0
? inArray(feedback.label, labels)
: undefined,
statuses.length > 0
? inArray(feedback.status, statuses)
: undefined,
),
)
.execute()
.then((res) => res[0]?.count ?? 0);
return { data, total };
});
const pageCount = Math.ceil(total / input.per_page);
return { data, pageCount, total };
}
| alifarooq9/rapidlaunch/starterkits/saas/src/server/actions/feedback/queries.ts | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/server/actions/feedback/queries.ts",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 1826
} | 20 |
import { env } from "@/env";
import { Resend } from "resend";
// Create a new instance of Resend
export const resend = new Resend(env.RESEND_API_KEY);
| alifarooq9/rapidlaunch/starterkits/saas/src/server/resend.ts | {
"file_path": "alifarooq9/rapidlaunch/starterkits/saas/src/server/resend.ts",
"repo_id": "alifarooq9/rapidlaunch",
"token_count": 50
} | 21 |
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
import { NextResponse } from 'next/server';
import OpenAI from 'openai';
const s3Client = new S3Client({
region: process.env.NEXT_PUBLIC_AWS_S3_REGION,
credentials: {
accessKeyId: process.env.NEXT_PUBLIC_AWS_S3_ACCESS_KEY_ID,
secretAccessKey: process.env.NEXT_PUBLIC_AWS_S3_SECRET_ACCESS_KEY,
},
});
const openai = new OpenAI({
apiKey: process.env.NEXT_PUBLIC_OPENAI_API_KEY,
});
// -------------- OpenAI API call to get audio --------------
async function main(text, voice) {
const mp3 = await openai.audio.speech.create({
model: 'tts-1',
voice: voice,
input: text,
});
const buffer = Buffer.from(await mp3.arrayBuffer());
return buffer;
}
// -------------- Upload file to Amazon AWS S3 --------------
async function uploadFileToS3(file, fileName, userId) {
const fileBuffer = file;
const params = {
Bucket: process.env.NEXT_PUBLIC_AWS_S3_BUCKET_NAME,
Key: `${userId}/${fileName}`,
Body: fileBuffer,
ContentType: 'audio/mpeg',
};
const command = new PutObjectCommand(params);
await s3Client.send(command);
return fileName;
}
// -------------- POST function to get user ID and input --------------
export async function POST(request) {
try {
const formData = await request.formData();
const text = formData.get('text');
const userId = formData.get('userId');
const voice = formData.get('voice');
const filename = 'speech.mp3';
if (!text) {
return NextResponse.json({ error: 'Text is required.' }, { status: 400 });
}
// -------------- Buffer to manipulate binary --------------
const buffer = await main(text, voice);
const fileName = await uploadFileToS3(buffer, filename, userId);
return NextResponse.json({ success: true, buffer });
} catch (error) {
return NextResponse.json({ error });
}
}
| horizon-ui/shadcn-nextjs-boilerplate/app/api/s3-upload/route.js | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/app/api/s3-upload/route.js",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 660
} | 22 |
import { Card } from './ui/card';
import ReactMarkdown from 'react-markdown';
export default function MessageBox(props: { output: string }) {
const { output } = props;
return (
<Card className="mb-7 flex min-h-[564px] w-full min-w-fit rounded-lg border px-5 py-4 font-medium dark:border-zinc-800">
<ReactMarkdown className="font-medium dark:text-white">
{output ? output : 'Your generated response will appear here...'}
</ReactMarkdown>
</Card>
);
}
| horizon-ui/shadcn-nextjs-boilerplate/components/MessageBox.tsx | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/components/MessageBox.tsx",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 177
} | 23 |
import CardMenu from '@/components/card/CardMenu';
import { Button } from '@/components/ui/button';
import { Card } from '@/components/ui/card';
import { Checkbox } from '@/components/ui/checkbox';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow
} from '@/components/ui/table';
import {
PaginationState,
createColumnHelper,
useReactTable,
ColumnFiltersState,
getCoreRowModel,
getFilteredRowModel,
getFacetedRowModel,
getFacetedUniqueValues,
getFacetedMinMaxValues,
getPaginationRowModel,
getSortedRowModel,
flexRender
} from '@tanstack/react-table';
import React from 'react';
import { MdChevronLeft, MdChevronRight } from 'react-icons/md';
type RowObj = {
checked?: string;
email: string;
provider: string;
created: string;
lastsigned: string;
uuid: string;
menu?: string;
};
function CheckTable(props: { tableData: any }) {
const { tableData } = props;
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
[]
);
let defaultData = tableData;
const [globalFilter, setGlobalFilter] = React.useState('');
const createPages = (count: number) => {
let arrPageCount = [];
for (let i = 1; i <= count; i++) {
arrPageCount.push(i);
}
return arrPageCount;
};
const columns = [
columnHelper.accessor('checked', {
id: 'checked',
header: () => (
<div className="flex max-w-max items-center">
<Checkbox />
</div>
),
cell: (info: any) => (
<div className="flex max-w-max items-center">
<Checkbox defaultChecked={info.getValue()[1]} />
</div>
)
}),
columnHelper.accessor('email', {
id: 'email',
header: () => (
<p className="text-xs font-semibold text-zinc-500 dark:text-zinc-400">
EMAIL ADDRESS
</p>
),
cell: (info) => (
<p className="text-sm font-medium text-zinc-950 dark:text-white">
{info.getValue()}
</p>
)
}),
columnHelper.accessor('provider', {
id: 'provider',
header: () => (
<p className="text-xs font-semibold text-zinc-500 dark:text-zinc-400">
PROVIDER
</p>
),
cell: (info: any) => (
<div className="flex w-full items-center gap-[14px]">
<p className="text-sm font-medium text-zinc-950 dark:text-white">
{info.getValue()}
</p>
</div>
)
}),
columnHelper.accessor('created', {
id: 'created',
header: () => (
<p className="text-xs font-semibold text-zinc-500 dark:text-zinc-400">
CREATED
</p>
),
cell: (info: any) => (
<div className="flex w-full items-center gap-[14px]">
<p className="text-sm font-medium text-zinc-950 dark:text-white">
{info.getValue()}
</p>
</div>
)
}),
columnHelper.accessor('lastsigned', {
id: 'lastsigned',
header: () => (
<p className="text-xs font-semibold text-zinc-500 dark:text-zinc-400">
LAST SIGN IN
</p>
),
cell: (info) => (
<p className="text-sm font-medium text-zinc-950 dark:text-white">
{info.getValue()}
</p>
)
}),
columnHelper.accessor('uuid', {
id: 'uuid',
header: () => (
<p className="text-xs font-semibold text-zinc-500 dark:text-zinc-400">
USER UID
</p>
),
cell: (info) => (
<p className="text-sm font-medium text-zinc-950 dark:text-white">
{info.getValue()}
</p>
)
}),
columnHelper.accessor('menu', {
id: 'menu',
header: () => (
<p className="text-xs font-semibold text-zinc-500 dark:text-zinc-400"></p>
),
cell: (info) => <CardMenu vertical={true} />
})
]; // eslint-disable-next-line
const [data, setData] = React.useState(() => [...defaultData]);
const [{ pageIndex, pageSize }, setPagination] = React.useState<
PaginationState
>({
pageIndex: 0,
pageSize: 11
});
const pagination = React.useMemo(
() => ({
pageIndex,
pageSize
}),
[pageIndex, pageSize]
);
const table = useReactTable({
data,
columns,
state: {
columnFilters,
globalFilter,
pagination
},
onPaginationChange: setPagination,
onColumnFiltersChange: setColumnFilters,
onGlobalFilterChange: setGlobalFilter,
getCoreRowModel: getCoreRowModel(),
getFilteredRowModel: getFilteredRowModel(),
getSortedRowModel: getSortedRowModel(),
getPaginationRowModel: getPaginationRowModel(),
getFacetedRowModel: getFacetedRowModel(),
getFacetedUniqueValues: getFacetedUniqueValues(),
getFacetedMinMaxValues: getFacetedMinMaxValues(),
debugTable: true,
debugHeaders: true,
debugColumns: false
});
return (
<Card
className={
'h-full w-full border-zinc-200 p-0 dark:border-zinc-800 sm:overflow-auto'
}
>
<div className="overflow-x-scroll xl:overflow-x-hidden">
<Table className="w-full">
{table.getHeaderGroups().map((headerGroup) => (
<TableHeader
key={headerGroup.id}
className="border-b-[1px] border-zinc-200 p-6 dark:border-zinc-800"
>
<tr className="dark:border-zinc-800">
{headerGroup.headers.map((header) => {
return (
<TableHead
key={header.id}
colSpan={header.colSpan}
onClick={header.column.getToggleSortingHandler()}
className="cursor-pointer border-zinc-200 pl-5 pr-4 pt-2 text-start dark:border-zinc-800"
>
{flexRender(
header.column.columnDef.header,
header.getContext()
)}
{{
asc: '',
desc: ''
}[header.column.getIsSorted() as string] ?? null}
</TableHead>
);
})}{' '}
</tr>
</TableHeader>
))}
<TableBody>
{table
.getRowModel()
.rows.slice(0, 7)
.map((row) => {
return (
<TableRow
key={row.id}
className="px-6 dark:hover:bg-gray-900"
>
{row.getVisibleCells().map((cell) => {
return (
<TableCell
key={cell.id}
className="w-max border-b-[1px] border-zinc-200 py-5 pl-5 pr-4 dark:border-white/10"
>
{flexRender(
cell.column.columnDef.cell,
cell.getContext()
)}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
{/* pagination */}
<div className="mt-2 flex h-20 w-full items-center justify-between px-6">
{/* left side */}
<div className="flex items-center gap-3">
<p className="text-sm font-medium text-zinc-500 dark:text-zinc-400">
Showing 6 rows per page
</p>
</div>
{/* right side */}
<div className="flex items-center gap-2">
<Button
onClick={() => table.previousPage()}
disabled={!table.getCanPreviousPage()}
className={`flex items-center justify-center rounded-lg bg-transparent p-2 text-lg text-zinc-950 transition duration-200 hover:bg-transparent active:bg-transparent dark:text-white dark:hover:bg-transparent dark:active:bg-transparent`}
>
<MdChevronLeft />
</Button>
{/* {createPages(table.getPageCount()).map((pageNumber, index) => {
return (
<Button
className={`font-mediumflex p-0 items-center justify-center rounded-lg p-2 text-sm transition duration-200 ${
pageNumber === pageIndex + 1
? ''
: 'border border-zinc-200 bg-[transparent] dark:border-zinc-800 dark:text-white'
}`}
onClick={() => table.setPageIndex(pageNumber - 1)}
key={index}
>
{pageNumber}
</Button>
);
})} */}
<Button
onClick={() => table.nextPage()}
disabled={!table.getCanNextPage()}
className={`flex min-w-[34px] items-center justify-center rounded-lg bg-transparent p-2 text-lg text-zinc-950 transition duration-200 hover:bg-transparent active:bg-transparent dark:text-white dark:hover:bg-transparent dark:active:bg-transparent`}
>
<MdChevronRight />
</Button>
</div>
</div>
</div>
</Card>
);
}
export default CheckTable;
const columnHelper = createColumnHelper<RowObj>();
| horizon-ui/shadcn-nextjs-boilerplate/components/dashboard/main/cards/MainDashboardTable.tsx | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/components/dashboard/main/cards/MainDashboardTable.tsx",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 4666
} | 24 |
'use client';
/* eslint-disable */
import NavLink from '@/components/link/NavLink';
import { IRoute } from '@/types/types';
import { usePathname } from 'next/navigation';
import { PropsWithChildren, useCallback } from 'react';
interface SidebarLinksProps extends PropsWithChildren {
routes: IRoute[];
[x: string]: any;
}
export function SidebarLinks(props: SidebarLinksProps) {
const pathname = usePathname();
const { routes } = props;
// verifies if routeName is the one active (in browser input)
const activeRoute = useCallback(
(routeName: string) => {
return pathname?.includes(routeName);
},
[pathname]
);
const activeLayout = useCallback(
(routeName: string) => {
return pathname?.includes('/ai');
},
[pathname]
);
// this function creates the links and collapses that appear in the sidebar (left menu)
const createLinks = (routes: IRoute[]) => {
return routes.map((route, key) => {
if (route.disabled) {
return (
<div
key={key}
className={`flex w-full max-w-full cursor-not-allowed items-center justify-between rounded-lg py-3 pl-8 font-medium`}
>
<div className="w-full items-center justify-center">
<div className="flex w-full items-center justify-center">
<div
className={`text mr-3 mt-1.5 text-zinc-950 opacity-30 dark:text-white`}
>
{route.icon}
</div>
<p
className={`mr-auto text-sm text-zinc-950 opacity-30 dark:text-white`}
>
{route.name}
</p>
</div>
</div>
</div>
);
} else {
return (
<div key={key}>
<div
className={`flex w-full max-w-full items-center justify-between rounded-lg py-3 pl-8 ${
activeRoute(route.path.toLowerCase())
? 'bg-zinc-950 font-semibold text-white dark:bg-white dark:text-zinc-950'
: 'font-medium text-zinc-950 dark:text-zinc-400'
}`}
>
<NavLink
href={route.layout ? route.layout + route.path : route.path}
key={key}
styles={{ width: '100%' }}
>
<div className="w-full items-center justify-center">
<div className="flex w-full items-center justify-center">
<div
className={`text mr-3 mt-1.5 ${
activeRoute(route.path.toLowerCase())
? 'font-semibold text-white dark:text-zinc-950'
: 'text-zinc-950 dark:text-white'
} `}
>
{route.icon}
</div>
<p
className={`mr-auto text-sm ${
activeRoute(route.path.toLowerCase())
? 'font-semibold text-white dark:text-zinc-950'
: 'font-medium text-zinc-950 dark:text-zinc-400'
}`}
>
{route.name}
</p>
</div>
</div>
</NavLink>
</div>
</div>
);
}
});
};
// BRAND
return <>{createLinks(routes)}</>;
}
export default SidebarLinks;
| horizon-ui/shadcn-nextjs-boilerplate/components/sidebar/components/Links.tsx | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/components/sidebar/components/Links.tsx",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 1895
} | 25 |
type RowObj = {
checked?: string;
email: string;
provider: string;
created: string;
lastsigned: string;
uuid: string;
menu?: string;
};
const tableDataUserReports: RowObj[] = [
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:29',
lastsigned: '06 Nov, 2023 11:29',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Email',
created: '06 Nov, 2023 11:21',
lastsigned: '06 Nov, 2023 11:21',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
{
checked:'',
email: '[email protected]',
provider: 'Google',
created: '06 Nov, 2023 11:33',
lastsigned: '06 Nov, 2023 11:33',
uuid: 'f3f42fc419-ce32-49fc-92df...',
},
];
export default tableDataUserReports;
| horizon-ui/shadcn-nextjs-boilerplate/variables/tableDataUserReports.ts | {
"file_path": "horizon-ui/shadcn-nextjs-boilerplate/variables/tableDataUserReports.ts",
"repo_id": "horizon-ui/shadcn-nextjs-boilerplate",
"token_count": 2131
} | 26 |
import { defineConfig } from 'checkly';
import { EmailAlertChannel, Frequency } from 'checkly/constructs';
const sendDefaults = {
sendFailure: true,
sendRecovery: true,
sendDegraded: true,
};
// FIXME: Add your production URL
const productionURL = 'https://react-saas.com';
const emailChannel = new EmailAlertChannel('email-channel-1', {
// FIXME: add your own email address, Checkly will send you an email notification if a check fails
address: '[email protected]',
...sendDefaults,
});
export const config = defineConfig({
// FIXME: Add your own project name, logical ID, and repository URL
projectName: 'SaaS Boilerplate',
logicalId: 'nextjs-boilerplate',
repoUrl: 'https://github.com/ixartz/Next-js-Boilerplate',
checks: {
locations: ['us-east-1', 'eu-west-1'],
tags: ['website'],
runtimeId: '2024.02',
browserChecks: {
frequency: Frequency.EVERY_24H,
testMatch: '**/tests/e2e/**/*.check.e2e.ts',
alertChannels: [emailChannel],
},
playwrightConfig: {
use: {
baseURL: process.env.ENVIRONMENT_URL || productionURL,
extraHTTPHeaders: {
'x-vercel-protection-bypass': process.env.VERCEL_BYPASS_TOKEN,
},
},
},
},
cli: {
runLocation: 'eu-west-1',
reporters: ['list'],
},
});
export default config;
| ixartz/SaaS-Boilerplate/checkly.config.ts | {
"file_path": "ixartz/SaaS-Boilerplate/checkly.config.ts",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 512
} | 27 |
import { enUS, frFR } from '@clerk/localizations';
import { ClerkProvider } from '@clerk/nextjs';
import { AppConfig } from '@/utils/AppConfig';
export default function AuthLayout(props: {
children: React.ReactNode;
params: { locale: string };
}) {
let clerkLocale = enUS;
let signInUrl = '/sign-in';
let signUpUrl = '/sign-up';
let dashboardUrl = '/dashboard';
let afterSignOutUrl = '/';
if (props.params.locale === 'fr') {
clerkLocale = frFR;
}
if (props.params.locale !== AppConfig.defaultLocale) {
signInUrl = `/${props.params.locale}${signInUrl}`;
signUpUrl = `/${props.params.locale}${signUpUrl}`;
dashboardUrl = `/${props.params.locale}${dashboardUrl}`;
afterSignOutUrl = `/${props.params.locale}${afterSignOutUrl}`;
}
return (
<ClerkProvider
localization={clerkLocale}
signInUrl={signInUrl}
signUpUrl={signUpUrl}
signInFallbackRedirectUrl={dashboardUrl}
signUpFallbackRedirectUrl={dashboardUrl}
afterSignOutUrl={afterSignOutUrl}
>
{props.children}
</ClerkProvider>
);
}
| ixartz/SaaS-Boilerplate/src/app/[locale]/(auth)/layout.tsx | {
"file_path": "ixartz/SaaS-Boilerplate/src/app/[locale]/(auth)/layout.tsx",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 434
} | 28 |
import { cva } from 'class-variance-authority';
export const badgeVariants = cva(
'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
{
variants: {
variant: {
default:
'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
secondary:
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
destructive:
'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
outline: 'text-foreground',
},
},
defaultVariants: {
variant: 'default',
},
},
);
| ixartz/SaaS-Boilerplate/src/components/ui/badgeVariants.ts | {
"file_path": "ixartz/SaaS-Boilerplate/src/components/ui/badgeVariants.ts",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 304
} | 29 |
export const DashboardSection = (props: {
title: string;
description: string;
children: React.ReactNode;
}) => (
<div className="rounded-md bg-card p-5">
<div className="max-w-3xl">
<div className="text-lg font-semibold">{props.title}</div>
<div className="mb-4 text-sm font-medium text-muted-foreground">
{props.description}
</div>
{props.children}
</div>
</div>
);
| ixartz/SaaS-Boilerplate/src/features/dashboard/DashboardSection.tsx | {
"file_path": "ixartz/SaaS-Boilerplate/src/features/dashboard/DashboardSection.tsx",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 180
} | 30 |
import { createEnv } from '@t3-oss/env-nextjs';
import { z } from 'zod';
// Don't add NODE_ENV into T3 Env, it changes the tree-shaking behavior
export const Env = createEnv({
server: {
CLERK_SECRET_KEY: z.string().min(1),
DATABASE_URL: z.string().optional(),
LOGTAIL_SOURCE_TOKEN: z.string().optional(),
STRIPE_SECRET_KEY: z.string().min(1),
STRIPE_WEBHOOK_SECRET: z.string().min(1),
BILLING_PLAN_ENV: z.enum(['dev', 'test', 'prod']),
},
client: {
NEXT_PUBLIC_APP_URL: z.string().optional(),
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().min(1),
NEXT_PUBLIC_CLERK_SIGN_IN_URL: z.string().min(1),
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: z.string().min(1),
},
shared: {
NODE_ENV: z.enum(['test', 'development', 'production']).optional(),
},
// You need to destructure all the keys manually
runtimeEnv: {
CLERK_SECRET_KEY: process.env.CLERK_SECRET_KEY,
DATABASE_URL: process.env.DATABASE_URL,
LOGTAIL_SOURCE_TOKEN: process.env.LOGTAIL_SOURCE_TOKEN,
STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
STRIPE_WEBHOOK_SECRET: process.env.STRIPE_WEBHOOK_SECRET,
BILLING_PLAN_ENV: process.env.BILLING_PLAN_ENV,
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY:
process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,
NEXT_PUBLIC_CLERK_SIGN_IN_URL: process.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL,
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY:
process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY,
NODE_ENV: process.env.NODE_ENV,
},
});
| ixartz/SaaS-Boilerplate/src/libs/Env.ts | {
"file_path": "ixartz/SaaS-Boilerplate/src/libs/Env.ts",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 711
} | 31 |
import Link from 'next/link';
import { useTranslations } from 'next-intl';
import { LocaleSwitcher } from '@/components/LocaleSwitcher';
import { buttonVariants } from '@/components/ui/buttonVariants';
import { CenteredMenu } from '@/features/landing/CenteredMenu';
import { Section } from '@/features/landing/Section';
import { Logo } from './Logo';
export const Navbar = () => {
const t = useTranslations('Navbar');
return (
<Section className="px-3 py-6">
<CenteredMenu
logo={<Logo />}
rightMenu={(
<>
<li>
<LocaleSwitcher />
</li>
<li>
<Link href="/sign-in">{t('sign_in')}</Link>
</li>
<li>
<Link className={buttonVariants()} href="/sign-up">
{t('sign_up')}
</Link>
</li>
</>
)}
>
<li>
<Link href="/sign-up">{t('product')}</Link>
</li>
<li>
<Link href="/sign-up">{t('docs')}</Link>
</li>
<li>
<Link href="/sign-up">{t('blog')}</Link>
</li>
<li>
<Link href="/sign-up">{t('community')}</Link>
</li>
<li>
<Link href="/sign-up">{t('company')}</Link>
</li>
</CenteredMenu>
</Section>
);
};
| ixartz/SaaS-Boilerplate/src/templates/Navbar.tsx | {
"file_path": "ixartz/SaaS-Boilerplate/src/templates/Navbar.tsx",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 714
} | 32 |
import '@testing-library/jest-dom/vitest';
import failOnConsole from 'vitest-fail-on-console';
failOnConsole({
shouldFailOnDebug: true,
shouldFailOnError: true,
shouldFailOnInfo: true,
shouldFailOnLog: true,
shouldFailOnWarn: true,
});
// Set up environment variables for testing
process.env.BILLING_PLAN_ENV = 'test';
| ixartz/SaaS-Boilerplate/vitest-setup.ts | {
"file_path": "ixartz/SaaS-Boilerplate/vitest-setup.ts",
"repo_id": "ixartz/SaaS-Boilerplate",
"token_count": 115
} | 33 |
import { eventHandler, getQuery, setResponseHeader, createError } from 'h3';
import iconNodes from '../../data/iconNodes';
import createLucideIcon from 'lucide-react/src/createLucideIcon';
import { renderToString } from 'react-dom/server';
import { createElement } from 'react';
export default eventHandler((event) => {
const { params } = event.context;
const iconNode = iconNodes[params.iconName];
if (iconNode == null) {
const error = createError({
statusCode: 404,
message: `Icon "${params.iconName}" not found`,
});
return sendError(event, error);
}
const width = getQuery(event).width || undefined;
const height = getQuery(event).height || undefined;
const color = getQuery(event).color || undefined;
const strokeWidth = getQuery(event).strokeWidth || undefined;
const LucideIcon = createLucideIcon(params.iconName, iconNode);
const svg = Buffer.from(
renderToString(
createElement(LucideIcon, {
width,
height,
color: color ? `#${color}` : undefined,
strokeWidth,
}),
),
).toString('utf8');
defaultContentType(event, 'image/svg+xml');
setResponseHeader(event, 'Cache-Control', 'public,max-age=31536000');
setResponseHeader(event, 'Access-Control-Allow-Origin', '*');
return svg;
});
| lucide-icons/lucide/docs/.vitepress/api/icons/[iconName].get.ts | {
"file_path": "lucide-icons/lucide/docs/.vitepress/api/icons/[iconName].get.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 442
} | 34 |
import { bundledLanguages, type ThemeRegistration } from 'shikiji';
import { getHighlighter } from 'shikiji';
type CodeExampleType = {
title: string;
language: string;
code: string;
}[];
const getIconCodes = (): CodeExampleType => {
return [
{
language: 'js',
title: 'Vanilla',
code: `\
import { createIcons, icons } from 'lucide';
createIcons({ icons });
document.body.append('<i data-lucide="$Name"></i>');\
`,
},
{
language: 'tsx',
title: 'React',
code: `import { $PascalCase } from 'lucide-react';
const App = () => {
return (
<$PascalCase />
);
};
export default App;
`,
},
{
language: 'vue',
title: 'Vue',
code: `<script setup>
import { $PascalCase } from 'lucide-vue-next';
</script>
<template>
<$PascalCase />
</template>
`,
},
{
language: 'svelte',
title: 'Svelte',
code: `<script>
import { $PascalCase } from 'lucide-svelte';
</script>
<$PascalCase />
`,
},
{
language: 'tsx',
title: 'Preact',
code: `import { $PascalCase } from 'lucide-preact';
const App = () => {
return (
<$PascalCase />
);
};
export default App;
`,
},
{
language: 'tsx',
title: 'Solid',
code: `import { $PascalCase } from 'lucide-solid';
const App = () => {
return (
<$PascalCase />
);
};
export default App;
`,
},
{
language: 'tsx',
title: 'Angular',
code: `// app.module.ts
import { LucideAngularModule, $PascalCase } from 'lucide-angular';
@NgModule({
imports: [
LucideAngularModule.pick({ $PascalCase })
],
})
// app.component.html
<lucide-icon name="$Name"></lucide-icon>
`,
},
{
language: 'html',
title: 'Icon Font',
code: `<style>
@import ('~lucide-static/font/Lucide.css');
</style>
<div class="icon-$Name"></div>
`,
},
];
};
export type ThemeOptions =
| ThemeRegistration
| { light: ThemeRegistration; dark: ThemeRegistration };
const highLightCode = async (code: string, lang: string, active?: boolean) => {
const highlighter = await getHighlighter({
themes: ['github-light', 'github-dark'],
langs: Object.keys(bundledLanguages),
});
const highlightedCode = highlighter
.codeToHtml(code, {
lang,
themes: {
light: 'github-light',
dark: 'github-dark',
},
defaultColor: false,
})
.replace('shiki-themes', 'shiki-themes vp-code');
return `<div class="language-${lang} ${active ? 'active' : ''}">
<button title="Copy Code" class="copy"></button>
<span class="lang">${lang}</span>
${highlightedCode}
</div>`;
};
export default async function createCodeExamples() {
const codes = getIconCodes();
const codeExamplePromises = codes.map(async ({ title, language, code }, index) => {
const isFirst = index === 0;
const codeString = await highLightCode(code, language, isFirst);
return {
title,
language: language,
code: codeString,
};
});
return Promise.all(codeExamplePromises);
}
| lucide-icons/lucide/docs/.vitepress/lib/codeExamples/createCodeExamples.ts | {
"file_path": "lucide-icons/lucide/docs/.vitepress/lib/codeExamples/createCodeExamples.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 1259
} | 35 |
export default {
async load() {
const version = await fetch('https://api.github.com/repos/lucide-icons/lucide/releases/latest')
.then((res) => {
if (res.ok) {
const releaseData = res.json() as Promise<{ tag_name: string }>;
return releaseData;
}
return null;
})
.then((res) => res.tag_name);
return {
version,
};
},
};
| lucide-icons/lucide/docs/.vitepress/theme/components/home/HomeHeroBefore.data.ts | {
"file_path": "lucide-icons/lucide/docs/.vitepress/theme/components/home/HomeHeroBefore.data.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 187
} | 36 |
import { useFetch } from '@vueuse/core';
const useFetchCategories = () =>
useFetch<Record<string, string[]>>(
`${import.meta.env.DEV ? 'http://localhost:3000' : ''}/api/categories`,
{
immediate:
typeof window !== 'undefined' && new URLSearchParams(window.location.search).has('search'),
},
).json();
export default useFetchCategories;
| lucide-icons/lucide/docs/.vitepress/theme/composables/useFetchCategories.ts | {
"file_path": "lucide-icons/lucide/docs/.vitepress/theme/composables/useFetchCategories.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 139
} | 37 |
import { RollerCoaster } from "lucide-react";
function App() {
return (
<div className="app">
<RollerCoaster
size={96}
absoluteStrokeWidth={true}
/>
</div>
);
}
export default App; | lucide-icons/lucide/docs/guide/basics/examples/absolute-stroke-width-icon/App.js | {
"file_path": "lucide-icons/lucide/docs/guide/basics/examples/absolute-stroke-width-icon/App.js",
"repo_id": "lucide-icons/lucide",
"token_count": 99
} | 38 |
<svg width="35" height="32" viewBox="0 0 23 21" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.5 12.3a2 2 0 1 0 0-4.1 2 2 0 0 0 0 4Z" fill="#61DAFB"/>
<path d="M11.5 14.4c6 0 11-1.8 11-4.2 0-2.3-5-4.2-11-4.2s-11 2-11 4.2c0 2.4 5 4.2 11 4.2Z" stroke="#61DAFB"/>
<path d="M7.9 12.3c3 5.3 7 8.6 9.1 7.5 2-1.2 1.2-6.4-1.9-11.7C12.1 3 8.1-.5 6 .7 4 2 4.8 7.1 7.9 12.3Z" stroke="#61DAFB"/>
<path d="M7.9 8.1c-3 5.3-4 10.5-1.9 11.7 2 1.1 6.1-2.2 9.1-7.5 3-5.2 4-10.4 1.9-11.6C15-.5 10.9 3 7.9 8.1Z" stroke="#61DAFB"/>
</svg>
| lucide-icons/lucide/docs/public/framework-logos/react.svg | {
"file_path": "lucide-icons/lucide/docs/public/framework-logos/react.svg",
"repo_id": "lucide-icons/lucide",
"token_count": 329
} | 39 |
import fs from 'fs';
import path from 'path';
import { readSvgDirectory, toCamelCase } from '@lucide/helpers';
const currentDir = process.cwd();
const ICONS_DIR = path.resolve(currentDir, '../icons');
const icons = readSvgDirectory(ICONS_DIR, '.json');
const iconDetailsDirectory = path.resolve(currentDir, '.vitepress/data', 'iconDetails');
if (fs.existsSync(iconDetailsDirectory)) {
fs.rmSync(iconDetailsDirectory, { recursive: true, force: true });
}
if (!fs.existsSync(iconDetailsDirectory)) {
fs.mkdirSync(iconDetailsDirectory);
}
const indexFile = path.resolve(iconDetailsDirectory, `index.ts`);
const writeIconFiles = icons.map(async (iconFileName) => {
const iconName = path.basename(iconFileName, '.json');
const location = path.resolve(iconDetailsDirectory, `${iconName}.ts`);
const contents = `\
import iconNode from '../iconNodes/${iconName}.node.json'
import metaData from '../../../../icons/${iconName}.json'
import releaseData from '../releaseMetadata/${iconName}.json'
const { tags, categories, contributors, aliases } = metaData
const iconDetails = {
name: '${iconName}',
iconNode,
contributors,
tags,
categories,
aliases,
...releaseData,
}
export default iconDetails
`;
await fs.promises.writeFile(location, contents, 'utf-8');
await fs.promises.appendFile(
indexFile,
`export { default as ${toCamelCase(iconName)} } from './${iconName}';\n`,
'utf-8',
);
});
Promise.all(writeIconFiles)
.then(() => {
console.log('Successfully write', writeIconFiles.length, 'iconDetails files.');
})
.catch((error) => {
throw new Error(`Something went wrong generating iconNode files,\n ${error}`);
});
| lucide-icons/lucide/docs/scripts/writeIconDetails.mjs | {
"file_path": "lucide-icons/lucide/docs/scripts/writeIconDetails.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 555
} | 40 |
/**
* @param {string[]} filenames
* @returns {string}
*/
const filenamesToAjvOption = (filenames) => filenames.map((filename) => `-d ${filename}`).join(' ');
/** @satisfies {import('lint-staged').Config} */
const config = {
'icons/*.svg': [
'node ./scripts/optimizeStagedSvgs.mjs',
'node ./scripts/generateNextJSAliases.mjs',
],
'icons/*.json': (filenames) => [
`ajv --spec=draft2020 -s icon.schema.json ${filenamesToAjvOption(filenames)}`,
`prettier --write ${filenames.join(' ')}`,
],
'categories/*.json': (filenames) => [
`ajv --spec=draft2020 -s category.schema.json ${filenamesToAjvOption(filenames)}`,
`prettier --write ${filenames.join(' ')}`,
],
};
export default config;
| lucide-icons/lucide/lint-staged.config.mjs | {
"file_path": "lucide-icons/lucide/lint-staged.config.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 292
} | 41 |
import { ModuleWithProviders, NgModule, Optional } from '@angular/core';
import { LucideAngularComponent } from './lucide-angular.component';
import { LucideIcons } from '../icons/types';
import { LUCIDE_ICONS, LucideIconProvider } from './lucide-icon.provider';
import { Icons } from './icons.provider';
const legacyIconProviderFactory = (icons?: LucideIcons) => {
return new LucideIconProvider(icons ?? {});
};
@NgModule({
declarations: [LucideAngularComponent],
imports: [],
exports: [LucideAngularComponent],
})
export class LucideAngularModule {
static pick(icons: LucideIcons): ModuleWithProviders<LucideAngularModule> {
return {
ngModule: LucideAngularModule,
providers: [
{ provide: LUCIDE_ICONS, multi: true, useValue: new LucideIconProvider(icons) },
{
provide: LUCIDE_ICONS,
multi: true,
useFactory: legacyIconProviderFactory,
deps: [[new Optional(), Icons]],
},
],
};
}
}
| lucide-icons/lucide/packages/lucide-angular/src/lib/lucide-angular.module.ts | {
"file_path": "lucide-icons/lucide/packages/lucide-angular/src/lib/lucide-angular.module.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 370
} | 42 |
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [
react(),
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: './tests/setupVitest.js',
mockReset: true,
},
});
| lucide-icons/lucide/packages/lucide-react-native/vitest.config.mts | {
"file_path": "lucide-icons/lucide/packages/lucide-react-native/vitest.config.mts",
"repo_id": "lucide-icons/lucide",
"token_count": 106
} | 43 |
import { JSX } from 'solid-js/jsx-runtime';
export type IconNode = [elementName: keyof JSX.IntrinsicElements, attrs: Record<string, string>][];
export type SVGAttributes = Partial<JSX.SvgSVGAttributes<SVGSVGElement>>;
export interface LucideProps extends SVGAttributes {
key?: string | number;
color?: string;
size?: string | number;
strokeWidth?: string | number;
class?: string;
absoluteStrokeWidth?: boolean;
}
export type LucideIcon = (props: LucideProps) => JSX.Element;
| lucide-icons/lucide/packages/lucide-solid/src/types.ts | {
"file_path": "lucide-icons/lucide/packages/lucide-solid/src/types.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 160
} | 44 |
/* eslint-disable import/no-extraneous-dependencies */
import base64SVG from '@lucide/build-icons/utils/base64SVG.mjs';
export default ({ componentName, iconName, children, getSvg, deprecated, deprecationReason }) => {
let svgContents = getSvg();
const svgBase64 = base64SVG(svgContents);
svgContents = svgContents.replace(
'<svg',
`
<svg
class="lucide lucide-${iconName}"`,
);
return `
/**
* @name ${iconName}
* @description Lucide SVG string.
*
* @preview  - https://lucide.dev/icons/${iconName}
* @see https://lucide.dev/guide/packages/lucide-static - Documentation
*
* @returns {String}
* ${deprecated ? `@deprecated ${deprecationReason}` : ''}
*/
const ${componentName}: string = \`\
${svgContents}\
\`
export default ${componentName};
`;
};
| lucide-icons/lucide/packages/lucide-static/scripts/exportTemplate.mjs | {
"file_path": "lucide-icons/lucide/packages/lucide-static/scripts/exportTemplate.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 302
} | 45 |
import type { SVGAttributes, SvelteHTMLElements } from 'svelte/elements';
export type Attrs = SVGAttributes<SVGSVGElement>;
export type IconNode = [elementName: keyof SvelteHTMLElements, attrs: Attrs][];
export interface IconProps extends Attrs {
name?: string;
color?: string;
size?: number | string;
strokeWidth?: number | string;
absoluteStrokeWidth?: boolean;
class?: string;
iconNode?: IconNode;
}
export type IconEvents = {
[evt: string]: CustomEvent<any>;
};
export type IconSlots = {
default: {};
};
| lucide-icons/lucide/packages/lucide-svelte/src/types.ts | {
"file_path": "lucide-icons/lucide/packages/lucide-svelte/src/types.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 177
} | 46 |
import { h } from 'vue';
import type { FunctionalComponent } from 'vue';
import { IconNode, LucideProps } from './types';
import Icon from './Icon';
// Create interface extending SVGAttributes
/**
* Create a Lucide icon component
* @param {string} iconName
* @param {array} iconNode
* @returns {FunctionalComponent} LucideIcon
*/
const createLucideIcon =
(iconName: string, iconNode: IconNode): FunctionalComponent<LucideProps> =>
(props, { slots }) =>
h(
Icon,
{
...props,
iconNode,
name: iconName,
},
slots,
);
export default createLucideIcon;
| lucide-icons/lucide/packages/lucide-vue-next/src/createLucideIcon.ts | {
"file_path": "lucide-icons/lucide/packages/lucide-vue-next/src/createLucideIcon.ts",
"repo_id": "lucide-icons/lucide",
"token_count": 224
} | 47 |
import plugins, { replace } from '@lucide/rollup-plugins';
import pkg from './package.json' assert { type: 'json' };
const packageName = 'LucideVue';
const outputFileName = 'lucide-vue';
const outputDir = 'dist';
const inputs = ['src/lucide-vue.ts'];
const bundles = [
{
format: 'umd',
inputs,
outputDir,
minify: true,
},
{
format: 'umd',
inputs,
outputDir,
},
{
format: 'cjs',
inputs,
outputDir,
},
{
format: 'esm',
inputs,
outputDir,
preserveModules: true,
},
];
const configs = bundles
.map(({ inputs, outputDir, format, minify, preserveModules }) =>
inputs.map((input) => ({
input,
plugins: plugins({ pkg, minify }),
external: ['vue'],
output: {
name: packageName,
...(preserveModules
? {
dir: `${outputDir}/${format}`,
}
: {
file: `${outputDir}/${format}/${outputFileName}${minify ? '.min' : ''}.js`,
}),
format,
preserveModules,
preserveModulesRoot: 'src',
sourcemap: true,
globals: {
vue: 'vue',
},
},
})),
)
.flat();
export default configs;
| lucide-icons/lucide/packages/lucide-vue/rollup.config.mjs | {
"file_path": "lucide-icons/lucide/packages/lucide-vue/rollup.config.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 581
} | 48 |
/* eslint-disable import/no-extraneous-dependencies */
import base64SVG from '@lucide/build-icons/utils/base64SVG.mjs';
export default ({ componentName, iconName, children, getSvg, deprecated, deprecationReason }) => {
const svgContents = getSvg();
const svgBase64 = base64SVG(svgContents);
return `
import defaultAttributes from '../defaultAttributes';
import type { IconNode } from '../types';
/**
* @name ${iconName}
* @description Lucide SVG icon node.
*
* @preview  - https://lucide.dev/icons/${iconName}
* @see https://lucide.dev/guide/packages/lucide - Documentation
*
* @returns {Array}
* ${deprecated ? `@deprecated ${deprecationReason}` : ''}
*/
const ${componentName}: IconNode = [
'svg',
defaultAttributes,
${JSON.stringify(children)}
];
export default ${componentName};
`;
};
| lucide-icons/lucide/packages/lucide/scripts/exportTemplate.mjs | {
"file_path": "lucide-icons/lucide/packages/lucide/scripts/exportTemplate.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 289
} | 49 |
import path from 'path';
import categories from '../categories.json' assert { type: 'json' };
import {
mergeArrays,
writeFile,
readAllMetadata,
getCurrentDirPath,
} from '../tools/build-helpers/helpers.mjs';
const currentDir = getCurrentDirPath(import.meta.url);
const ICONS_DIR = path.resolve(currentDir, '../icons');
const icons = readAllMetadata(ICONS_DIR);
Object.keys(categories).forEach((categoryName) => {
categories[categoryName].forEach((iconName) => {
icons[iconName].categories = mergeArrays(icons[iconName].categories, [categoryName]);
});
});
Object.keys(icons).forEach((iconName) => {
const iconContent = JSON.stringify(icons[iconName], null, 2);
writeFile(iconContent, `${iconName}.json`, path.resolve(currentDir, '../icons'));
});
| lucide-icons/lucide/scripts/migrateCategoriesToIcons.mjs | {
"file_path": "lucide-icons/lucide/scripts/migrateCategoriesToIcons.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 254
} | 50 |
/* eslint-disable import/prefer-default-export */
/**
* Converts string to KebabCase
*
* @param {string} string
* @returns {string} A kebabized string
*/
export const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
| lucide-icons/lucide/tools/build-helpers/src/toKebabCase.mjs | {
"file_path": "lucide-icons/lucide/tools/build-helpers/src/toKebabCase.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 99
} | 51 |
export function deprecationReasonTemplate(
deprecationReason,
{ componentName, iconName, toBeRemovedInVersion },
) {
const removalNotice = toBeRemovedInVersion
? ` This ${deprecationReason.startsWith('icon') ? 'icon' : 'alias'} will be removed in ${toBeRemovedInVersion}`
: '';
switch (deprecationReason) {
case 'alias.typo':
return `Renamed because of typo, use {@link ${componentName}} instead.${removalNotice}`;
case 'alias.naming':
return `The name of this icon was changed because it didn't meet our guidelines anymore, use {@link ${componentName}} instead.${removalNotice}`;
case 'icon.brand':
return `Brand icons have been deprecated and are due to be removed, please refer to https://github.com/lucide-icons/lucide/issues/670. We recommend using https://simpleicons.org/?q=${iconName} instead.${removalNotice}`;
}
}
| lucide-icons/lucide/tools/build-icons/utils/deprecationReasonTemplate.mjs | {
"file_path": "lucide-icons/lucide/tools/build-icons/utils/deprecationReasonTemplate.mjs",
"repo_id": "lucide-icons/lucide",
"token_count": 279
} | 52 |
import {
Body,
Button,
Container,
Head,
Html,
Preview,
Section,
Tailwind,
Text,
} from "@react-email/components";
interface ThanksTemplateProps {
userName: string;
}
const ThanksTemp: React.FC<Readonly<ThanksTemplateProps>> = ({ userName }) => (
<Html>
<Head />
<Preview>Welcome to ChadNext.</Preview>
<Tailwind>
<Body className=" bg-gray-100">
<Container className="mx-auto my-10 bg-white">
<Section className="my-8">
<Text className="mx-10 text-lg font-bold">Hi {userName} ,</Text>
<Text className="mx-10 text-base">
Welcome to ChadNext. Now you can build your idea faster. You can
star the project on GitHub. That would be very helpful.
</Text>
<Section className="my-5 text-center">
<Button
className="bg-bg-white inline-block rounded-md bg-slate-900 px-6 py-3 text-base text-white"
href="https://github.com/moinulmoin/chadnext"
target="_blank"
rel="noopener noreferrer"
>
Star on GitHub
</Button>
</Section>
<Text className="mx-10 text-base font-light">Best,</Text>
<Text className="mx-10 text-base font-bold">ChadNext</Text>
</Section>
</Container>
</Body>
</Tailwind>
</Html>
);
export default ThanksTemp;
| moinulmoin/chadnext/emails/thanks.tsx | {
"file_path": "moinulmoin/chadnext/emails/thanks.tsx",
"repo_id": "moinulmoin/chadnext",
"token_count": 684
} | 53 |
"use server";
import ThanksTemp from "emails/thanks";
import VerificationTemp from "emails/verification";
import { nanoid } from "nanoid";
import { resend } from "~/lib/resend";
import { type SendOTPProps, type SendWelcomeEmailProps } from "~/types";
export const sendWelcomeEmail = async ({
toMail,
userName,
}: SendWelcomeEmailProps) => {
const subject = "Thanks for using ChadNext!";
const temp = ThanksTemp({ userName });
await resend.emails.send({
from: `ChadNext App <[email protected]>`,
to: toMail,
subject: subject,
headers: {
"X-Entity-Ref-ID": nanoid(),
},
react: temp,
text: "",
});
};
export const sendOTP = async ({ toMail, code, userName }: SendOTPProps) => {
const subject = "OTP for ChadNext";
const temp = VerificationTemp({ userName, code });
await resend.emails.send({
from: `ChadNext App <[email protected]>`,
to: toMail,
subject: subject,
headers: {
"X-Entity-Ref-ID": nanoid(),
},
react: temp,
text: "",
});
};
| moinulmoin/chadnext/src/actions/mail.ts | {
"file_path": "moinulmoin/chadnext/src/actions/mail.ts",
"repo_id": "moinulmoin/chadnext",
"token_count": 394
} | 54 |
"use client";
import { zodResolver } from "@hookform/resolvers/zod";
import { useState } from "react";
import { useForm } from "react-hook-form";
import * as z from "zod";
import Icons from "~/components/shared/icons";
import { Button } from "~/components/ui/button";
import { Card } from "~/components/ui/card";
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "~/components/ui/dialog";
import {
Form,
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "~/components/ui/form";
import { Input } from "~/components/ui/input";
import { toast } from "~/components/ui/use-toast";
import { FreePlanLimitError } from "~/lib/utils";
import { checkIfFreePlanLimitReached, createProject } from "./action";
export const projectSchema = z.object({
name: z.string().min(1, { message: "Please enter a project name." }),
domain: z.string().min(1, { message: "Please enter a project domain." }),
});
export type ProjectFormValues = z.infer<typeof projectSchema>;
export default function CreateProjectModal() {
const [isOpen, setIsOpen] = useState(false);
const form = useForm<ProjectFormValues>({
resolver: zodResolver(projectSchema),
defaultValues: {
name: "",
domain: "",
},
});
async function onSubmit(values: ProjectFormValues) {
try {
const limitReached = await checkIfFreePlanLimitReached();
if (limitReached) {
throw new FreePlanLimitError();
}
await createProject(values);
toast({
title: "Project created successfully.",
});
form.reset();
setIsOpen(false);
} catch (error) {
console.error({ error });
if (error instanceof FreePlanLimitError) {
return toast({
title: "Free plan limit reached. Please upgrade your plan.",
variant: "destructive",
});
}
return toast({
title: "Error creating project. Please try again.",
variant: "destructive",
});
}
}
return (
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogTrigger asChild>
<Card
role="button"
className="flex flex-col items-center justify-center gap-y-2.5 p-8 text-center hover:bg-accent"
>
<Button size="icon" variant="ghost">
<Icons.projectPlus className="h-8 w-8 " />
</Button>
<p className="text-xl font-medium ">Create a project</p>
</Card>
</DialogTrigger>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle>Create Project</DialogTitle>
</DialogHeader>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
<FormField
control={form.control}
name="name"
render={({ field }) => (
<FormItem>
<FormLabel>Name</FormLabel>
<FormControl>
<Input placeholder="XYZ" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="domain"
render={({ field }) => (
<FormItem>
<FormLabel>Domain</FormLabel>
<FormControl>
<Input placeholder="xyz.com" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<DialogFooter>
<Button disabled={form.formState.isSubmitting} type="submit">
{form.formState.isSubmitting && (
<Icons.spinner className={"mr-2 h-5 w-5 animate-spin"} />
)}
Create
</Button>
</DialogFooter>
</form>
</Form>
</DialogContent>
</Dialog>
);
}
| moinulmoin/chadnext/src/app/[locale]/dashboard/projects/create-project-modal.tsx | {
"file_path": "moinulmoin/chadnext/src/app/[locale]/dashboard/projects/create-project-modal.tsx",
"repo_id": "moinulmoin/chadnext",
"token_count": 1859
} | 55 |
import { type NextRequest } from "next/server";
import { z } from "zod";
import { validateRequest } from "~/actions/auth";
import { getUserSubscriptionPlan } from "~/actions/subscription";
import { siteConfig } from "~/config/site";
import { proPlan } from "~/config/subscription";
import { stripe } from "~/lib/stripe";
export async function GET(req: NextRequest) {
const locale = req.cookies.get("Next-Locale")?.value || "en";
const billingUrl = siteConfig(locale).url + "/dashboard/billing/";
try {
const { user, session } = await validateRequest();
if (!session) {
return new Response("Unauthorized", { status: 401 });
}
const subscriptionPlan = await getUserSubscriptionPlan(user.id);
// The user is on the pro plan.
// Create a portal session to manage subscription.
if (subscriptionPlan.isPro && subscriptionPlan.stripeCustomerId) {
const stripeSession = await stripe.billingPortal.sessions.create({
customer: subscriptionPlan.stripeCustomerId,
return_url: billingUrl,
});
return Response.json({ url: stripeSession.url });
}
// The user is on the free plan.
// Create a checkout session to upgrade.
const stripeSession = await stripe.checkout.sessions.create({
success_url: billingUrl,
cancel_url: billingUrl,
payment_method_types: ["card"],
mode: "subscription",
billing_address_collection: "auto",
customer_email: user.email,
line_items: [
{
price: proPlan.stripePriceId,
quantity: 1,
},
],
metadata: {
userId: user.id,
},
});
return new Response(JSON.stringify({ url: stripeSession.url }));
} catch (error) {
if (error instanceof z.ZodError) {
return new Response(JSON.stringify(error.issues), { status: 422 });
}
return new Response(null, { status: 500 });
}
}
| moinulmoin/chadnext/src/app/api/stripe/route.ts | {
"file_path": "moinulmoin/chadnext/src/app/api/stripe/route.ts",
"repo_id": "moinulmoin/chadnext",
"token_count": 689
} | 56 |
"use client";
import { useState } from "react";
import Icons from "~/components/shared/icons";
import { Button } from "~/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "~/components/ui/card";
import { toast } from "~/components/ui/use-toast";
import { cn, formatDate } from "~/lib/utils";
import { type UserSubscriptionPlan } from "~/types";
interface BillingFormProps extends React.HTMLAttributes<HTMLFormElement> {
subscriptionPlan: UserSubscriptionPlan & {
isCanceled: boolean;
};
}
export function BillingForm({
subscriptionPlan,
className,
...props
}: BillingFormProps) {
const [isLoading, setIsLoading] = useState<boolean>(false);
async function onSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault();
setIsLoading(!isLoading);
// Get a Stripe session URL.
const response = await fetch("/api/stripe");
if (!response?.ok) {
return toast({
title: "Something went wrong.",
description: "Please refresh the page and try again.",
variant: "destructive",
});
}
// Redirect to the Stripe session.
// This could be a checkout page for initial upgrade.
// Or portal to manage existing subscription.
const session = await response.json();
if (session) {
window.location.href = session.url;
}
}
return (
<form className={cn(className)} onSubmit={onSubmit} {...props}>
<Card>
<CardHeader>
<CardTitle>Subscription</CardTitle>
<CardDescription>
<em>
Currently on the <strong>{subscriptionPlan.name}</strong> plan.
</em>
</CardDescription>
</CardHeader>
<CardContent className="font-medium ">
{subscriptionPlan.description}
</CardContent>
<CardFooter className="flex flex-col items-start space-y-2 md:flex-row md:justify-between md:space-x-0">
<Button type="submit" disabled={isLoading}>
{isLoading && (
<Icons.spinner className="mr-2 h-4 w-4 animate-spin" />
)}
{subscriptionPlan.isPro ? "Manage Subscription" : "Upgrade to PRO"}
</Button>
{subscriptionPlan.isPro ? (
<p className="rounded-full text-xs font-medium md:self-end ">
{subscriptionPlan.isCanceled
? "Your plan will be canceled on "
: "Your plan renews on "}
{formatDate(subscriptionPlan.stripeCurrentPeriodEnd)}.
</p>
) : null}
</CardFooter>
</Card>
</form>
);
}
| moinulmoin/chadnext/src/components/billing-form.tsx | {
"file_path": "moinulmoin/chadnext/src/components/billing-form.tsx",
"repo_id": "moinulmoin/chadnext",
"token_count": 1096
} | 57 |
export default {
header: {
changelog: "Journal des modifications",
about: "Environ",
login: "Se connecter",
dashboard: "Tableau de bord",
},
hero: {
top: "Presentation de",
main: "Modele de demarrage rapide pour votre prochain projet",
sub: "Dote de toutes les fonctionnalites necessaires pour commencer.",
firstButton: "Commencer",
tools: "Construit a l'aide d'excellents outils",
on: "sur",
},
notFound: {
title: "Page non trouvee!",
},
} as const;
| moinulmoin/chadnext/src/locales/fr.ts | {
"file_path": "moinulmoin/chadnext/src/locales/fr.ts",
"repo_id": "moinulmoin/chadnext",
"token_count": 196
} | 58 |
import DiscordIcon from "@/components/icons/discord-icon";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
export const CommunitySection = () => {
return (
<section id="community" className="py-12 ">
<hr className="border-secondary" />
<div className="container py-20 sm:py-20">
<div className="lg:w-[60%] mx-auto">
<Card className="bg-background border-none shadow-none text-center flex flex-col items-center justify-center">
<CardHeader>
<CardTitle className="text-4xl md:text-5xl font-bold flex flex-col items-center">
<DiscordIcon />
<div>
Ready to join this
<span className="text-transparent pl-2 bg-gradient-to-r from-[#D247BF] to-primary bg-clip-text">
Community?
</span>
</div>
</CardTitle>
</CardHeader>
<CardContent className="lg:w-[80%] text-xl text-muted-foreground">
Join our vibrant Discord community! Connect, share, and grow with
like-minded enthusiasts. Click to dive in!
</CardContent>
<CardFooter>
<Button asChild>
<a href="https://discord.com/" target="_blank">
Join Discord
</a>
</Button>
</CardFooter>
</Card>
</div>
</div>
<hr className="border-secondary" />
</section>
);
};
| nobruf/shadcn-landing-page/components/layout/sections/community.tsx | {
"file_path": "nobruf/shadcn-landing-page/components/layout/sections/community.tsx",
"repo_id": "nobruf/shadcn-landing-page",
"token_count": 783
} | 59 |
import { CardSkeleton } from "@/components/card-skeleton"
import { DashboardHeader } from "@/components/header"
import { DashboardShell } from "@/components/shell"
export default function DashboardBillingLoading() {
return (
<DashboardShell>
<DashboardHeader
heading="Billing"
text="Manage billing and your subscription plan."
/>
<div className="grid gap-10">
<CardSkeleton />
</div>
</DashboardShell>
)
}
| shadcn-ui/taxonomy/app/(dashboard)/dashboard/billing/loading.tsx | {
"file_path": "shadcn-ui/taxonomy/app/(dashboard)/dashboard/billing/loading.tsx",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 173
} | 60 |
interface EditorProps {
children?: React.ReactNode
}
export default function EditorLayout({ children }: EditorProps) {
return (
<div className="container mx-auto grid items-start gap-10 py-8">
{children}
</div>
)
}
| shadcn-ui/taxonomy/app/(editor)/editor/layout.tsx | {
"file_path": "shadcn-ui/taxonomy/app/(editor)/editor/layout.tsx",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 83
} | 61 |
import { MetadataRoute } from "next"
export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: "*",
allow: "/",
},
}
}
| shadcn-ui/taxonomy/app/robots.ts | {
"file_path": "shadcn-ui/taxonomy/app/robots.ts",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 68
} | 62 |
import * as React from "react"
import * as ToastPrimitives from "@radix-ui/react-toast"
import { VariantProps, cva } from "class-variance-authority"
import { X } from "lucide-react"
import { cn } from "@/lib/utils"
const ToastProvider = ToastPrimitives.Provider
const ToastViewport = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Viewport>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
>(({ className, ...props }, ref) => (
<ToastPrimitives.Viewport
ref={ref}
className={cn(
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
className
)}
{...props}
/>
))
ToastViewport.displayName = ToastPrimitives.Viewport.displayName
const toastVariants = cva(
"data-[swipe=move]:transition-none group relative pointer-events-auto flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full data-[state=closed]:slide-out-to-right-full",
{
variants: {
variant: {
default: "bg-background border",
destructive:
"group destructive border-destructive bg-destructive text-destructive-foreground",
},
},
defaultVariants: {
variant: "default",
},
}
)
const Toast = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Root>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
VariantProps<typeof toastVariants>
>(({ className, variant, ...props }, ref) => {
return (
<ToastPrimitives.Root
ref={ref}
className={cn(toastVariants({ variant }), className)}
{...props}
/>
)
})
Toast.displayName = ToastPrimitives.Root.displayName
const ToastAction = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Action>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
>(({ className, ...props }, ref) => (
<ToastPrimitives.Action
ref={ref}
className={cn(
"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-destructive/30 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
className
)}
{...props}
/>
))
ToastAction.displayName = ToastPrimitives.Action.displayName
const ToastClose = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Close>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
>(({ className, ...props }, ref) => (
<ToastPrimitives.Close
ref={ref}
className={cn(
"absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
className
)}
toast-close=""
{...props}
>
<X className="h-4 w-4" />
</ToastPrimitives.Close>
))
ToastClose.displayName = ToastPrimitives.Close.displayName
const ToastTitle = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Title>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
>(({ className, ...props }, ref) => (
<ToastPrimitives.Title
ref={ref}
className={cn("text-sm font-semibold", className)}
{...props}
/>
))
ToastTitle.displayName = ToastPrimitives.Title.displayName
const ToastDescription = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Description>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
>(({ className, ...props }, ref) => (
<ToastPrimitives.Description
ref={ref}
className={cn("text-sm opacity-90", className)}
{...props}
/>
))
ToastDescription.displayName = ToastPrimitives.Description.displayName
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>
type ToastActionElement = React.ReactElement<typeof ToastAction>
export {
type ToastProps,
type ToastActionElement,
ToastProvider,
ToastViewport,
Toast,
ToastTitle,
ToastDescription,
ToastClose,
ToastAction,
}
| shadcn-ui/taxonomy/components/ui/toast.tsx | {
"file_path": "shadcn-ui/taxonomy/components/ui/toast.tsx",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 1690
} | 63 |
import * as React from "react"
export function useMounted() {
const [mounted, setMounted] = React.useState(false)
React.useEffect(() => {
setMounted(true)
}, [])
return mounted
}
| shadcn-ui/taxonomy/hooks/use-mounted.ts | {
"file_path": "shadcn-ui/taxonomy/hooks/use-mounted.ts",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 67
} | 64 |
import NextAuth from "next-auth"
import { authOptions } from "@/lib/auth"
// @see ./lib/auth
export default NextAuth(authOptions)
| shadcn-ui/taxonomy/pages/api/auth/[...nextauth].ts | {
"file_path": "shadcn-ui/taxonomy/pages/api/auth/[...nextauth].ts",
"repo_id": "shadcn-ui/taxonomy",
"token_count": 42
} | 65 |
"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
import { Icons } from "@/components/icons"
import { Button } from "@/registry/new-york/ui/button"
import { Input } from "@/registry/new-york/ui/input"
import { Label } from "@/registry/new-york/ui/label"
interface UserAuthFormProps extends React.HTMLAttributes<HTMLDivElement> {}
export function UserAuthForm({ className, ...props }: UserAuthFormProps) {
const [isLoading, setIsLoading] = React.useState<boolean>(false)
async function onSubmit(event: React.SyntheticEvent) {
event.preventDefault()
setIsLoading(true)
setTimeout(() => {
setIsLoading(false)
}, 3000)
}
return (
<div className={cn("grid gap-6", className)} {...props}>
<form onSubmit={onSubmit}>
<div className="grid gap-2">
<div className="grid gap-1">
<Label className="sr-only" htmlFor="email">
Email
</Label>
<Input
id="email"
placeholder="[email protected]"
type="email"
autoCapitalize="none"
autoComplete="email"
autoCorrect="off"
disabled={isLoading}
/>
</div>
<Button disabled={isLoading}>
{isLoading && (
<Icons.spinner className="mr-2 h-4 w-4 animate-spin" />
)}
Sign In with Email
</Button>
</div>
</form>
<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>
<Button variant="outline" type="button" disabled={isLoading}>
{isLoading ? (
<Icons.spinner className="mr-2 h-4 w-4 animate-spin" />
) : (
<Icons.gitHub className="mr-2 h-4 w-4" />
)}{" "}
GitHub
</Button>
</div>
)
}
| shadcn-ui/ui/apps/www/app/(app)/examples/authentication/components/user-auth-form.tsx | {
"file_path": "shadcn-ui/ui/apps/www/app/(app)/examples/authentication/components/user-auth-form.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1010
} | 66 |
import { Input } from "@/registry/new-york/ui/input"
export function Search() {
return (
<div>
<Input
type="search"
placeholder="Search..."
className="md:w-[100px] lg:w-[300px]"
/>
</div>
)
}
| shadcn-ui/ui/apps/www/app/(app)/examples/dashboard/components/search.tsx | {
"file_path": "shadcn-ui/ui/apps/www/app/(app)/examples/dashboard/components/search.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 115
} | 67 |
import { Metadata } from "next"
import Link from "next/link"
import { cn } from "@/lib/utils"
import { Announcement } from "@/components/announcement"
import { ExamplesNav } from "@/components/examples-nav"
import {
PageActions,
PageHeader,
PageHeaderDescription,
PageHeaderHeading,
} from "@/components/page-header"
import { Button, buttonVariants } from "@/registry/new-york/ui/button"
export const metadata: Metadata = {
title: "Examples",
description: "Check out some examples app built using the components.",
}
interface ExamplesLayoutProps {
children: React.ReactNode
}
export default function ExamplesLayout({ children }: ExamplesLayoutProps) {
return (
<div className="container relative">
<PageHeader>
<Announcement />
<PageHeaderHeading className="hidden md:block">
Check out some examples
</PageHeaderHeading>
<PageHeaderHeading className="md:hidden">Examples</PageHeaderHeading>
<PageHeaderDescription>
Dashboard, cards, authentication. Some examples built using the
components. Use this as a guide to build your own.
</PageHeaderDescription>
<PageActions>
<Button asChild size="sm">
<Link href="/docs">Get Started</Link>
</Button>
<Button asChild size="sm" variant="ghost">
<Link href="/components">Components</Link>
</Button>
</PageActions>
</PageHeader>
<section>
<ExamplesNav />
<div className="overflow-hidden rounded-[0.5rem] border bg-background shadow">
{children}
</div>
</section>
</div>
)
}
| shadcn-ui/ui/apps/www/app/(app)/examples/layout.tsx | {
"file_path": "shadcn-ui/ui/apps/www/app/(app)/examples/layout.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 630
} | 68 |
import { Button } from "@/registry/new-york/ui/button"
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/registry/new-york/ui/dialog"
export function CodeViewer() {
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="secondary">View code</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[625px]">
<DialogHeader>
<DialogTitle>View code</DialogTitle>
<DialogDescription>
You can use the following code to start integrating your current
prompt and settings into your application.
</DialogDescription>
</DialogHeader>
<div className="grid gap-4">
<div className="rounded-md bg-black p-6">
<pre>
<code className="grid gap-1 text-sm text-muted-foreground [&_span]:h-4">
<span>
<span className="text-sky-300">import</span> os
</span>
<span>
<span className="text-sky-300">import</span> openai
</span>
<span />
<span>
openai.api_key = os.getenv(
<span className="text-green-300">
"OPENAI_API_KEY"
</span>
)
</span>
<span />
<span>response = openai.Completion.create(</span>
<span>
{" "}
model=
<span className="text-green-300">"davinci"</span>,
</span>
<span>
{" "}
prompt=<span className="text-amber-300">""</span>,
</span>
<span>
{" "}
temperature=<span className="text-amber-300">0.9</span>,
</span>
<span>
{" "}
max_tokens=<span className="text-amber-300">5</span>,
</span>
<span>
{" "}
top_p=<span className="text-amber-300">1</span>,
</span>
<span>
{" "}
frequency_penalty=<span className="text-amber-300">0</span>,
</span>
<span>
{" "}
presence_penalty=<span className="text-green-300">0</span>,
</span>
<span>)</span>
</code>
</pre>
</div>
<div>
<p className="text-sm text-muted-foreground">
Your API Key can be found here. You should use environment
variables or a secret management tool to expose your key to your
applications.
</p>
</div>
</div>
</DialogContent>
</Dialog>
)
}
| shadcn-ui/ui/apps/www/app/(app)/examples/playground/components/code-viewer.tsx | {
"file_path": "shadcn-ui/ui/apps/www/app/(app)/examples/playground/components/code-viewer.tsx",
"repo_id": "shadcn-ui/ui",
"token_count": 1704
} | 69 |
Subsets and Splits