Commit 645102b
committed
feat: add useVisibility hook and optimize toolbar UI performance
## New Features
- Add useVisibility hook for intersection observer-based lazy loading
- Supports configurable root margin (default: 300px)
- Includes fallback for environments without IntersectionObserver
- Provides ref and visible state for component integration
## UI Improvements
- Optimize toolbar image thumbnail dimensions
- Reduce thumbnail height from 32 to 24 units
- Reduce thumbnail width from 40 to 32 units
- Adjust minimum width from 40 to 32 units
- Improve toolbar scrolling behavior
- Add overflowY: hidden to prevent vertical scrolling
- Add vertical padding (pt: 2.5, pb: 2) for better spacing
- Remove hover scale transform effect for smoother interactions
- Commented out transform: "scale(1.02)" on hover
- Maintains box shadow hover effect for visual feedback
## Performance Enhancements
- Smaller thumbnail sizes reduce memory usage and improve rendering
- useVisibility hook enables lazy loading capabilities for better performance
- Optimized scrolling container prevents unnecessary overflow
## Technical Details
- useVisibility hook uses TypeScript generics for type safety
- Includes proper cleanup and cancellation handling
- Fallback detection for elements already in viewport
- Compatible with custom root elements and configurable margins1 parent 9b3f179 commit 645102b
File tree
9 files changed
+322
-253
lines changed- examples/react-example/src
- packages/imagekit-editor-dev/src
- components
- editor
- header
- sidebar
- toolbar
- hooks
9 files changed
+322
-253
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
47 | 57 | | |
48 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
49 | 76 | | |
50 | 77 | | |
51 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 26 | + | |
41 | 27 | | |
42 | 28 | | |
43 | 29 | | |
| |||
0 commit comments