diff --git a/src/lib/utils/codeSnippets.ts b/src/lib/utils/codeSnippets.ts index 68dda14..d4084d3 100644 --- a/src/lib/utils/codeSnippets.ts +++ b/src/lib/utils/codeSnippets.ts @@ -1,81 +1,5 @@ export const codeSnippets = { 'typescript.tsx': - "import React, { useState, useEffect } from 'react';\n" + - '\n' + - '// Interface and Type\n' + - 'interface User {\n' + - ' id: number;\n' + - ' name: string;\n' + - '}\n' + - '\n' + - 'type UserProps = {\n' + - ' user: User;\n' + - '};\n' + - '\n' + - '// Decorator\n' + - 'function logged(target: any, key: string, descriptor: PropertyDescriptor) {\n' + - ' const original = descriptor.value;\n' + - ' descriptor.value = function (...args: any[]) {\n' + - ' console.log(`Calling ${key} with`, args);\n' + - ' return original.apply(this, args);\n' + - ' };\n' + - ' return descriptor;\n' + - '}\n' + - '\n' + - '// Class with generics\n' + - 'class DataFetcher {\n' + - ' private url: string;\n' + - '\n' + - ' constructor(url: string) {\n' + - ' this.url = url;\n' + - ' }\n' + - '\n' + - ' @logged\n' + - ' async fetchData(): Promise {\n' + - ' const response = await fetch(this.url);\n' + - ' return response.json();\n' + - ' }\n' + - '}\n' + - '\n' + - '// React component\n' + - 'const UserProfile: React.FC = ({ user }) => {\n' + - ' const [loading, setLoading] = useState(true);\n' + - '\n' + - ' useEffect(() => {\n' + - ' // Async function in useEffect\n' + - ' const loadUser = async () => {\n' + - ' try {\n' + - ' const fetcher = new DataFetcher(`/api/users/${user.id}`);\n' + - ' await fetcher.fetchData();\n' + - ' setLoading(false);\n' + - ' } catch (error) {\n' + - ' console.error("Failed to load user:", error);\n' + - ' }\n' + - ' };\n' + - '\n' + - ' loadUser();\n' + - ' }, [user.id]);\n' + - '\n' + - ' if (loading) return
Loading...
;\n' + - '\n' + - ' return (\n' + - '
\n' + - "

{user.name}'s Profile

\n" + - '

User ID: {user.id}

\n' + - '
\n' + - ' );\n' + - '};\n' + - '\n' + - 'export default UserProfile;\n' + - 'import type {\n' + - ' UIColors,\n' + - ' SyntaxColors,\n' + - ' AnsiColors,\n' + - ' VSCodeTheme,\n' + - '} from "@/lib/types/colors"\n' + - '\n' + - 'import Color from "color"\n' + - '\n' + 'export function generateSemanticThemeJSON(\n' + ' name: string = "Generated Color Theme",\n' + ' colors: UIColors,\n' +