feat: add docs

This commit is contained in:
2026-01-02 16:43:29 +03:00
parent 202ac4627f
commit 12e86ef7f1
4 changed files with 246 additions and 95 deletions

62
CONVENTIONS.md Normal file
View File

@@ -0,0 +1,62 @@
# 📐 Coding Conventions
## Именование
- **Компоненты:** PascalCase (`Button.tsx`)
- **Утилиты:** kebab-case (`format-date.ts`)
- **Хуки:** camelCase с use (`useInView.ts`)
```typescript
const userName = "John";
const MAX_RETRIES = 3;
```
## Структура компонента
```typescript
"use client";
import { Button } from "@/shared/ui/button";
interface MyComponentProps {
title: string;
}
export function MyComponent({ title }: MyComponentProps) {
return <div>{title}</div>;
}
```
## TypeScript
Всегда типизируйте props:
```typescript
interface ButtonProps {
children: React.ReactNode;
variant?: "primary" | "secondary";
}
```
## Импорты
Порядок: React → Внешние → Наши (@/...)
```typescript
import { useState } from "react";
import { motion } from "framer-motion";
import { Button } from "@/shared/ui/button";
```
**ВСЕГДА используйте @/ для абсолютных импортов.**
## Стилизация
Порядок Tailwind: Layout → Sizing → Spacing → Typography → Colors
Условные классы через cn():
```typescript
import { cn } from '@/shared/lib/utils';
<button className={cn('px-4 py-2', variant === 'primary' && 'bg-primary')}>
```