AI Skill Report Card
Building Professional UI from SVG
Quick Start13 / 15
TypeScript// 1. Extract SVG components const IconComponent = ({ className }: { className?: string }) => ( <svg className={className} viewBox="0 0 24 24" fill="currentColor"> {/* SVG paths from Illustrator */} </svg> ); // 2. Create typed component with design tokens interface UIComponentProps { variant: 'primary' | 'secondary'; size: 'sm' | 'md' | 'lg'; locale: 'en' | 'ar'; } export const UIComponent: React.FC<UIComponentProps> = ({ variant, size, locale }) => { const isRTL = locale === 'ar'; return ( <div className={cn( 'flex items-center gap-3', isRTL && 'flex-row-reverse', variant === 'primary' && 'bg-primary text-primary-foreground', size === 'lg' && 'p-4 text-lg' )}> <IconComponent className="w-6 h-6" /> {/* Content */} </div> ); };
Recommendation▾
Add specific SVG optimization techniques (SVGO settings, path simplification) and exact Illustrator export settings
Workflow12 / 15
Progress:
- Extract SVG Elements: Export individual icons/graphics from Illustrator as optimized SVG
- Create Design Tokens: Define colors, spacing, typography in
@nassify/ui-tokens - Build Base Components: Create reusable React components with TypeScript interfaces
- Add Internationalization: Implement RTL/LTR support and translation hooks
- Setup Monorepo Structure: Organize in
apps/weband shared packages - Implement Testing: Add Playwright visual regression tests
- Optimize Performance: Use RSC/SSR for static parts, client components for interactivity
Recommendation▾
Include concrete monorepo setup commands and package.json configurations for the workspace structure
Examples15 / 20
Example 1 - Product Gallery Component:
TypeScript// packages/ui-tokens/src/index.ts export const tokens = { colors: { primary: '#2563eb', secondary: '#64748b' }, spacing: { xs: '0.25rem', sm: '0.5rem' } }; // apps/web/components/ProductGallery.tsx 'use client'; import { useState } from 'react'; import { useTranslation } from '@/hooks/useTranslation'; export const ProductGallery: React.FC<{ images: string[]; locale: 'en' | 'ar'; }> = ({ images, locale }) => { const [activeIndex, setActiveIndex] = useState(0); const { t } = useTranslation(locale); return ( <div className={`grid gap-4 ${locale === 'ar' ? 'rtl' : 'ltr'}`}> <div className="aspect-square overflow-hidden rounded-lg"> <img src={images[activeIndex]} alt={t('product.gallery.main')} className="w-full h-full object-cover" /> </div> <div className="flex gap-2"> {images.map((img, index) => ( <button key={index} onClick={() => setActiveIndex(index)} className={`w-16 h-16 rounded border-2 ${ index === activeIndex ? 'border-primary' : 'border-gray-200' }`} > <img src={img} className="w-full h-full object-cover" /> </button> ))} </div> </div> ); };
Example 2 - RTL Layout Component:
TypeScript// apps/web/components/ProductDetailClient.tsx interface ProductDetailProps { product: Product; locale: 'en' | 'ar'; } export const ProductDetailClient: React.FC<ProductDetailProps> = ({ product, locale }) => { const isRTL = locale === 'ar'; return ( <div className={cn( 'grid lg:grid-cols-2 gap-8', isRTL && 'rtl' )}> <ProductGallery images={product.images} locale={locale} /> <div className={cn( 'space-y-6', isRTL && 'text-right' )}> <h1 className="text-3xl font-bold"> {product.name[locale]} </h1> <VariantSelector variants={product.variants} locale={locale} /> <StickyAddToCart productId={product.id} locale={locale} /> </div> </div> ); };
Recommendation▾
Provide performance benchmarks and specific bundle size targets for the resulting components
Best Practices
Design System Integration:
- Use
@nassify/ui-tokensfor all colors, spacing, and typography - Create consistent component APIs with TypeScript interfaces
- Implement responsive design with Tailwind's mobile-first approach
Internationalization:
- Structure components to handle RTL/LTR layouts automatically
- Use translation keys consistently:
t('section.component.text') - Test both languages during development
Performance Optimization:
- Use Server Components for static content
- Client Components only for interactive features
- Implement proper image optimization with Next.js
Component Architecture:
apps/web/
├── components/
│ ├── ui/ (base components)
│ ├── product/ (domain-specific)
│ └── layout/ (page structure)
packages/
├── ui-tokens/ (design system)
├── contracts/ (TypeScript interfaces)
└── application/ (business logic)
Common Pitfalls
RTL Layout Issues:
- Don't use absolute positioning without RTL consideration
- Test margin/padding directions with both locales
- Use logical properties (
margin-inline-startvsmargin-left)
TypeScript Integration:
- Don't bypass shared contracts from
packages/contracts - Avoid
anytypes in component props - Use proper typing for translation functions
Performance Mistakes:
- Don't make all components client-side
- Avoid large SVG files without optimization
- Don't skip image lazy loading for galleries
Testing Oversights:
- Include visual regression tests for RTL layouts
- Test component behavior across different viewport sizes
- Validate translation coverage in both languages