A modern, bilingual company directory React application that seamlessly displays company information in English and Chinese. Built with React 18, Vite, and WordPress REST API.
- π Seamless English/Chinese language switching
- πΌοΈ Smart image lazy loading for optimal performance
- π« Smooth animations and transitions
- π― SEO-friendly URL structure
- π± Fully responsive design
- β‘ Lightning-fast loading with Vite
- π Real-time language switching
- π¨ Clean, modern UI
- Node.js >= 14
- WordPress backend with REST API
- npm or yarn
# Clone the repository
git clone https://github.com/yourusername/ShowCompanyLogo.git
# Navigate to project
cd ShowCompanyLogo
# Install dependencies
npm install
# Start development server
npm run dev- 
Frontend: - React 18
- TypeScript
- i18next
- Intersection Observer API
- CSS Grid & Flexbox
 
- 
Build Tools: - Vite
- ESLint
- Prettier
 
- 
Backend Integration: - WordPress REST API
- Custom Post Types
 
ShowCompanyLogo/
βββ public/
β   βββ locales/                # Translation files
β       βββ en/
β       βββ zh/
β
βββ src/
β   βββ components/             # React components
β   β   βββ CompanyCard/        # Company card component
β   β   βββ CompanyList/        # Company list container
β   β   βββ LanguageSwitcher/   # Language switching component
β   β
β   βββ services/               # Business logic and API services
β   β   βββ auth.ts             # Authentication and API calls
β   β   βββ imageLoader.ts      # Image lazy loading utility
β   β
β   βββ assets/                 # Static assets
β   β   βββ fonts/         
β   β   βββ main.css            # Global styles   
β   βββ App.jsx                 # Root component
β   βββ main.jsx                # Application entry point
β
βββ vite.config.js              # Vite configuration
βββ package.json                # Project metadata
Core component for displaying company information:
- Props: company: Company
- Features:
- Lazy loaded company logo
- Bilingual content display
- Contact information
- Responsive layout
 
Container component managing company data:
- Features:
- Data fetching and caching
- Language-based filtering
- Error handling
- Loading states
 
Handles language switching functionality:
- Features:
- URL-based language routing
- Language persistence
- Smooth transitions
- SEO-friendly links
 
Utility service for optimized image loading:
- Features:
- Intersection Observer implementation
- Progressive loading
- Error handling
- Memory management
 
Manages API communication:
interface AuthService {
  fetchCompanies(): Promise<Company[]>;
  fetchMediaWithAuth(mediaId: string): Promise<string>;
}Handles image optimization:
interface ImageLoaderService {
  init(): void;
  observe(element: HTMLImageElement): void;
  cleanup(): void;
}Currently supports:
- English (en)
- Chinese (zh)
Add new languages by creating translation files in public/locales/{lang}/common.json
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
MIT Β© [2024] [Daniel Viki]
- Create an issue
- Email: contact@outlook.com
Made with β€οΈ by Daniel Viki