Add initial project files

This commit is contained in:
Igor Martyniuk
2026-09-01 13:03:41 +03:00
parent 22e111bb44
commit 74cb5b6176
1841 changed files with 242819 additions and 30 deletions
+31
View File
@@ -0,0 +1,31 @@
# useBodyClass
Adds one or more CSS classes to `document.body` while the component is mounted, and removes them on unmount.
## Signature
```ts
function useBodyClass(className: string): void;
```
| Parameter | Type | Description |
| ----------- | -------- | ------------------------------------------------------- |
| `className` | `string` | Space-separated class name(s) to add to `document.body` |
## Usage
```tsx
export function ModalLayout({ children }: { children: React.ReactNode }) {
useBodyClass('overflow-hidden bg-overlay');
return <div>{children}</div>;
}
```
While `ModalLayout` is mounted, `document.body` will have the classes `overflow-hidden` and `bg-overlay`. Both are removed automatically when the component unmounts.
## Notes
- Accepts a space-separated string — multiple classes are handled individually so partial removal is safe.
- Re-applies classes if the `className` prop changes.
- Client-only (`'use client'`). Does not run during SSR.