UNPKG

mrlib-ui

Version:

Modern React UI component library with TypeScript, Tailwind CSS, and multi-language support

344 lines (253 loc) • 8.04 kB
# ⚔ mrlib - Modern React UI Library A UI component library designed to create modern, lightweight and clean React applications. ## ✨ Features - ⚔ **Fast Development**: Optimized build process with Vite - šŸŽØ **Modern Design**: Modern interface inspired by clean and minimal design principles - šŸ“± **Responsive**: Perfect appearance on all devices - šŸ”§ **TypeScript**: Type safety and enhanced developer experience - šŸ›”ļø **Modern Tools**: ESLint, Prettier and other development tools - šŸš€ **Ready Components**: UI components and hooks you can start coding with immediately - šŸŒ™ **Dark Mode**: Full Tailwind CSS compatible dark mode support - šŸŒ **Multi-language**: Turkish and English language support ## šŸš€ Quick Start ### Requirements - Node.js 18+ - npm or yarn ### Installation ```bash # Clone the project git clone <repository-url> cd mrlib # Install dependencies npm install # Start development server npm run dev ``` Open [http://localhost:3009](http://localhost:3009) in your browser. ## šŸ“ Project Structure ``` src/ ā”œā”€ā”€ components/ # UI components │ ā”œā”€ā”€ ui/ # Basic UI components │ │ ā”œā”€ā”€ Button.tsx │ │ ā”œā”€ā”€ Card.tsx │ │ ā”œā”€ā”€ Input.tsx │ │ ā”œā”€ā”€ Modal.tsx │ │ ā”œā”€ā”€ Toast.tsx │ │ ā”œā”€ā”€ Tooltip.tsx │ │ ā”œā”€ā”€ Select.tsx │ │ ā”œā”€ā”€ Checkbox.tsx │ │ ā”œā”€ā”€ Radio.tsx │ │ ā”œā”€ā”€ Switch.tsx │ │ ā”œā”€ā”€ Slider.tsx │ │ ā”œā”€ā”€ Progress.tsx │ │ ā”œā”€ā”€ Badge.tsx │ │ ā”œā”€ā”€ Avatar.tsx │ │ ā”œā”€ā”€ Container.tsx │ │ ā”œā”€ā”€ Divider.tsx │ │ ā”œā”€ā”€ Spacer.tsx │ │ ā”œā”€ā”€ Tabs.tsx │ │ ā”œā”€ā”€ Accordion.tsx │ │ ā”œā”€ā”€ DatePicker.tsx │ │ ā”œā”€ā”€ Table.tsx │ │ ā”œā”€ā”€ List.tsx │ │ ā”œā”€ā”€ Textarea.tsx │ │ ā”œā”€ā”€ Alert.tsx │ │ ā”œā”€ā”€ Skeleton.tsx │ │ ā”œā”€ā”€ Drawer.tsx │ │ ā”œā”€ā”€ Breadcrumb.tsx │ │ ā”œā”€ā”€ FileUpload.tsx │ │ └── Dropdown.tsx │ ā”œā”€ā”€ Header.tsx │ ā”œā”€ā”€ Hero.tsx │ ā”œā”€ā”€ Features.tsx │ └── Footer.tsx ā”œā”€ā”€ contexts/ # React Contexts │ ā”œā”€ā”€ ThemeContext.tsx │ ā”œā”€ā”€ ToastContext.tsx │ └── LanguageContext.tsx ā”œā”€ā”€ hooks/ # Custom hooks │ ā”œā”€ā”€ useToggle.ts │ ā”œā”€ā”€ useDebounce.ts │ ā”œā”€ā”€ useLocalStorage.ts │ ā”œā”€ā”€ useResponsive.ts │ ā”œā”€ā”€ useClipboard.ts │ ā”œā”€ā”€ useScrollPosition.ts │ ā”œā”€ā”€ useMediaQuery.ts │ └── index.ts ā”œā”€ā”€ utils/ # Helper functions │ ā”œā”€ā”€ cn.ts │ ā”œā”€ā”€ format.ts │ ā”œā”€ā”€ validation.ts │ └── index.ts ā”œā”€ā”€ types/ # TypeScript type definitions │ └── index.ts ā”œā”€ā”€ pages/ # Page components │ ā”œā”€ā”€ Documentation.tsx │ └── Examples.tsx ā”œā”€ā”€ App.tsx ā”œā”€ā”€ main.tsx ā”œā”€ā”€ index.css └── index.ts ``` ## šŸŽØ Design System ### Color Palette Color palette inspired by modern and clean design language: - **Primary**: Modern Blue (#007AFF) - **Success**: Modern Green (#34C759) - **Warning**: Modern Orange (#FF9500) - **Error**: Modern Red (#FF3B30) - **Gray Scale**: Modern Gray (50-900) - **Dark Mode**: Premium dark gray tones for sophisticated dark theme - **Premium Palettes**: Gold, Silver, Platinum, Rose Gold, Emerald, Sapphire, Amethyst, Ruby, Topaz, Pearl, Onyx (50-900 shades) ### Typography - **Font Family**: SF Pro Display/Text (Apple's system font) - **Font Sizes**: Responsive and consistent typography scales ### Components #### Button ```tsx import { Button } from '@/components/ui/Button' // Basic usage <Button variant="primary" size="md"> Click </Button> // Loading state <Button loading={true}> Loading... </Button> // Different variants <Button variant="secondary">Secondary</Button> <Button variant="ghost">Ghost</Button> <Button variant="destructive">Destructive</Button> ``` #### Card ```tsx import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/Card' <Card> <CardHeader> <CardTitle>Title</CardTitle> </CardHeader> <CardContent> Content goes here </CardContent> </Card> ``` #### Input ```tsx import { Input } from '@/components/ui/Input' <Input label="Email" type="email" placeholder="email@example.com" error="Please enter a valid email" /> ``` #### Modal ```tsx import { Modal } from '@/components/ui/Modal' <Modal isOpen={isOpen} onClose={() => setIsOpen(false)} title="Modal Title" > Modal content goes here </Modal> ``` ## šŸŖ Custom Hooks ### useToggle To toggle boolean state: ```tsx import { useToggle } from '@/hooks' const [isOpen, toggle, setIsOpen] = useToggle(false) ``` ### useDebounce To delay a value by specified time: ```tsx import { useDebounce } from '@/hooks' const debouncedValue = useDebounce(searchTerm, 300) ``` ### useLocalStorage For state synchronized with LocalStorage: ```tsx import { useLocalStorage } from '@/hooks' const [theme, setTheme] = useLocalStorage('theme', 'light') ``` ### useResponsive To track screen size: ```tsx import { useResponsive } from '@/hooks' const { isMobile, isTablet, isDesktop } = useResponsive() ``` ### useClipboard For clipboard operations: ```tsx import { useClipboard } from '@/hooks' const { copy, copied } = useClipboard() ``` ## šŸŒ™ Dark Mode Dark mode support is fully integrated with Tailwind CSS: ```tsx import { useTheme } from '@/contexts/ThemeContext' const { theme, setTheme } = useTheme() // Change theme setTheme('dark') // 'light' | 'dark' | 'system' ``` ## šŸŒ Multi-language Support Turkish and English language support: ```tsx import { useLanguage } from '@/contexts/LanguageContext' const { language, setLanguage, t } = useLanguage() // Use translations const title = t('nav.home') // 'Ana Sayfa' or 'Home' ``` ## šŸ› ļø Development ### Commands ```bash # Development server npm run dev # Production build npm run build # Type checking npm run type-check # Linting npm run lint # Preview npm run preview ``` ### Configuration - **Vite**: Modern build tool and dev server - **TypeScript**: Type safety - **Tailwind CSS**: Utility-first CSS framework - **ESLint**: Code linting - **PostCSS**: CSS processing - **Framer Motion**: Animations - **Zod**: Schema validation ## šŸ“¦ Packaging To use this starter kit in your own project: ```bash # Build npm run build # Ready files will be created in dist folder ``` ## šŸ¤ Contributing 1. Fork the repository 2. Create a feature branch (`git checkout -b feature/amazing-feature`) 3. Commit your changes (`git commit -m 'Add amazing feature'`) 4. Push to the branch (`git push origin feature/amazing-feature`) 5. Create a Pull Request ## šŸ“„ License This project is licensed under the MIT License. ## šŸ™ Acknowledgments - [React](https://react.dev/) - UI library - [Vite](https://vitejs.dev/) - Build tool - [Tailwind CSS](https://tailwindcss.com/) - CSS framework - [Lucide React](https://lucide.dev/) - Icon library - [Framer Motion](https://www.framer.com/motion/) - Animation library - [Zod](https://zod.dev/) - Schema validation - Modern design principles - Design inspiration --- **Note**: This starter kit is created inspired by modern design principles. ## šŸ“š Documentation Visit [http://localhost:3009/docs](http://localhost:3009/docs) for detailed documentation. ## šŸŽÆ Examples Visit [http://localhost:3009/examples](http://localhost:3009/examples) for live examples.