|
| 1 | +# MpesaKit Landing Page Components |
| 2 | + |
| 3 | +A collection of modular, reusable TSX components for building modern landing pages in Docusaurus, specifically designed for the MpesaKit Python M-Pesa SDK documentation site. |
| 4 | + |
| 5 | +## Components Overview |
| 6 | + |
| 7 | +### Core Components |
| 8 | + |
| 9 | +1. **HeroSection** - Main landing section with title, description, badges, and CTAs |
| 10 | +2. **StatsSection** - Statistics display with animated counters |
| 11 | +3. **FeaturesSection** - Feature cards with icons and descriptions |
| 12 | +4. **SecuritySection** - Security features with visual layers |
| 13 | +5. **APIStatusSection** - Real-time API status monitoring |
| 14 | +6. **DocumentationSection** - Documentation links and resources |
| 15 | +7. **CTASection** - Call-to-action with installation instructions |
| 16 | +8. **Footer** - Footer with links and social media |
| 17 | +9. **MpesaKitLanding** - Complete landing page combining all components |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +1. Copy the component files to your Docusaurus `src/components/` directory |
| 22 | +2. Copy the CSS module to the same directory |
| 23 | +3. Install any required dependencies (React is already included in Docusaurus) |
| 24 | + |
| 25 | +```bash |
| 26 | +src/ |
| 27 | +├── components/ |
| 28 | +│ ├── MpesaKit.module.css |
| 29 | +│ ├── HeroSection.tsx |
| 30 | +│ ├── StatsSection.tsx |
| 31 | +│ ├── FeaturesSection.tsx |
| 32 | +│ ├── SecuritySection.tsx |
| 33 | +│ ├── APIStatusSection.tsx |
| 34 | +│ ├── DocumentationSection.tsx |
| 35 | +│ ├── CTASection.tsx |
| 36 | +│ ├── Footer.tsx |
| 37 | +│ ├── MpesaKitLanding.tsx |
| 38 | +│ └── index.ts |
| 39 | +``` |
| 40 | + |
| 41 | +## Usage |
| 42 | + |
| 43 | +### Complete Landing Page |
| 44 | + |
| 45 | +```tsx |
| 46 | +import React from 'react'; |
| 47 | +import Layout from '@theme/Layout'; |
| 48 | +import { MpesaKitLanding } from '../components/MpesaKitLanding'; |
| 49 | + |
| 50 | +export default function Home(): JSX.Element { |
| 51 | + return ( |
| 52 | + <Layout title="MpesaKit" description="Python M-Pesa SDK"> |
| 53 | + <MpesaKitLanding /> |
| 54 | + </Layout> |
| 55 | + ); |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +### Individual Components |
| 60 | + |
| 61 | +```tsx |
| 62 | +import React from 'react'; |
| 63 | +import { HeroSection, StatsSection } from '../components'; |
| 64 | + |
| 65 | +const CustomPage: React.FC = () => { |
| 66 | + const heroData = { |
| 67 | + title: "Your Project", |
| 68 | + description: "Project description", |
| 69 | + badges: ["Feature 1", "Feature 2"], |
| 70 | + primaryCTA: { text: "Get Started", href: "/docs" }, |
| 71 | + secondaryCTA: { text: "GitHub", href: "/github" } |
| 72 | + }; |
| 73 | + |
| 74 | + const statsData = [ |
| 75 | + { number: "99%", label: "Uptime" }, |
| 76 | + { number: "1M+", label: "Downloads" } |
| 77 | + ]; |
| 78 | + |
| 79 | + return ( |
| 80 | + <> |
| 81 | + <HeroSection {...heroData} /> |
| 82 | + <StatsSection stats={statsData} /> |
| 83 | + </> |
| 84 | + ); |
| 85 | +}; |
| 86 | +``` |
| 87 | + |
| 88 | +## Component Props |
| 89 | + |
| 90 | +### HeroSection |
| 91 | + |
| 92 | +```typescript |
| 93 | +interface HeroSectionProps { |
| 94 | + title: string; |
| 95 | + description: string; |
| 96 | + badges: string[]; |
| 97 | + primaryCTA: { text: string; href: string }; |
| 98 | + secondaryCTA: { text: string; href: string }; |
| 99 | +} |
| 100 | +``` |
| 101 | + |
| 102 | +### StatsSection |
| 103 | + |
| 104 | +```typescript |
| 105 | +interface StatsSectionProps { |
| 106 | + stats: Array<{ |
| 107 | + number: string; |
| 108 | + label: string; |
| 109 | + }>; |
| 110 | +} |
| 111 | +``` |
| 112 | + |
| 113 | +### FeaturesSection |
| 114 | + |
| 115 | +```typescript |
| 116 | +interface FeaturesSectionProps { |
| 117 | + title: string; |
| 118 | + subtitle: string; |
| 119 | + features: Array<{ |
| 120 | + icon: string; |
| 121 | + title: string; |
| 122 | + description: string; |
| 123 | + features: string[]; |
| 124 | + }>; |
| 125 | +} |
| 126 | +``` |
| 127 | + |
| 128 | +## Customization |
| 129 | + |
| 130 | +### Colors and Themes |
| 131 | + |
| 132 | +The components use CSS custom properties (variables) defined in the CSS module: |
| 133 | + |
| 134 | +```css |
| 135 | +:root { |
| 136 | + --mpesa-green: #00D13A; |
| 137 | + --mpesa-dark-green: #00B032; |
| 138 | + --mpesa-light-green: #4AE668; |
| 139 | + --dark-bg: #0a0a0a; |
| 140 | + --card-bg: rgba(255, 255, 255, 0.05); |
| 141 | + /* ... more variables */ |
| 142 | +} |
| 143 | +``` |
| 144 | + |
| 145 | +To customize colors, modify these variables in your CSS or override them in your Docusaurus custom CSS. |
| 146 | + |
| 147 | +### Responsive Design |
| 148 | + |
| 149 | +All components are fully responsive with breakpoints at: |
| 150 | + |
| 151 | +- 768px (tablet) |
| 152 | +- 480px (mobile) |
| 153 | + |
| 154 | +### Animations |
| 155 | + |
| 156 | +Components include: |
| 157 | + |
| 158 | +- Fade-in animations using Intersection Observer |
| 159 | +- Slide-in animations for hero content |
| 160 | +- Hover effects on cards and buttons |
| 161 | +- Typewriter effect for code demo |
| 162 | + |
| 163 | +## Features |
| 164 | + |
| 165 | +- **Modular Design**: Use individual components or the complete landing page |
| 166 | +- **TypeScript Support**: Full type definitions included |
| 167 | +- **Responsive**: Works on all device sizes |
| 168 | +- **Accessible**: Semantic HTML and proper contrast ratios |
| 169 | +- **Performant**: Optimized animations and efficient rendering |
| 170 | +- **Customizable**: Easy to modify colors, content, and layout |
| 171 | + |
| 172 | +## Browser Support |
| 173 | + |
| 174 | +- Chrome/Edge 90+ |
| 175 | +- Firefox 88+ |
| 176 | +- Safari 14+ |
| 177 | +- Mobile browsers with CSS Grid support |
| 178 | + |
| 179 | +## Dependencies |
| 180 | + |
| 181 | +- React 16.8+ (for hooks) |
| 182 | +- CSS Grid and Flexbox support |
| 183 | +- Intersection Observer API (polyfill available if needed) |
| 184 | + |
| 185 | +## Best Practices |
| 186 | + |
| 187 | +1. **Data Structure**: Keep component data in separate files or use a CMS |
| 188 | +2. **Performance**: Use React.memo for components that don't change often |
| 189 | +3. **Accessibility**: Test with screen readers and keyboard navigation |
| 190 | +4. **SEO**: Ensure proper heading hierarchy and meta descriptions |
| 191 | + |
| 192 | +## Troubleshooting |
| 193 | + |
| 194 | +### Common Issues |
| 195 | + |
| 196 | +1. **CSS not loading**: Ensure the CSS module is imported in your component |
| 197 | +2. **Animations not working**: Check if Intersection Observer is supported |
| 198 | +3. **Layout breaks**: Verify CSS Grid browser support |
| 199 | + |
| 200 | +### Debug Mode |
| 201 | + |
| 202 | +Add this to your CSS for debugging layout issues: |
| 203 | + |
| 204 | +```css |
| 205 | +.debug * { |
| 206 | + border: 1px solid red !important; |
| 207 | +} |
| 208 | +``` |
| 209 | + |
| 210 | +## Contributing |
| 211 | + |
| 212 | +To modify these components: |
| 213 | + |
| 214 | +1. Update the TypeScript interfaces in `types/index.ts` |
| 215 | +2. Modify component logic in individual component files |
| 216 | +3. Update styles in `MpesaKit.module.css` |
| 217 | +4. Test responsiveness across devices |
| 218 | +5. Update documentation |
| 219 | + |
| 220 | +## License |
| 221 | + |
| 222 | +These components are designed for the MpesaKit project and follow the same open-source license. |
0 commit comments