import * as React from 'react'; import Link from 'next/link'; import { cn } from '@/lib/utils'; import { motion } from 'motion/react'; import { Button } from '@/components/ui/button'; import { Book, Check, Copy, Terminal } from 'lucide-react'; export interface DeveloperSectionProps { className?: string; } /** * Developer Section - 开发者体验展示 */ export const DeveloperSection = React.memo(function DeveloperSection({ className, }: DeveloperSectionProps) { const [copied, setCopied] = React.useState(false); const codeContent = `# 注册用户 curl -X POST https://api.example.com/api/v1/auth/register \\ -H "Content-Type: application/json" \\ -d '{ "username": "developer", "email": "dev@example.com", "password": "secure_password" }'`; const onCopy = async () => { try { await navigator.clipboard.writeText(codeContent); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch { // Fallback for older browsers const textArea = document.createElement('textarea'); textArea.value = codeContent; textArea.style.position = 'fixed'; textArea.style.left = '-9999px'; document.body.appendChild(textArea); textArea.select(); document.execCommand('copy'); document.body.removeChild(textArea); setCopied(true); setTimeout(() => setCopied(false), 2000); } }; return (
bash
                
                  # 快速开始
                  {'\n'}
                  curl -X{' '}
                  POST{' '}
                  
                    https://api.example.com/api/v1/auth/register
                  {' '}
                  \{'\n'}
                  {'  '}-H{' '}
                  
                    "Content-Type: application/json"
                  {' '}
                  \{'\n'}
                  {'  '}-d{' '}
                  
                    "username=dev&password=***"
                  
                
              

开发者友好,
极速集成上手

标准化的 RESTful API 接口,完整的 TypeScript 类型定义,详细的文档和 Swagger UI。无论使用什么编程语言,只需几行代码,即可快速集成。

    {[ 'RESTful API,语义清晰,易于理解', 'OpenAPI / Swagger 接口文档', 'TypeScript 类型定义,开发友好', '丰富的代码示例和集成指南', ].map((item, i) => (
  • {item}
  • ))}
); });