|
| 1 | +--- |
| 2 | +'@leafygreen-ui/drawer': major |
| 3 | +--- |
| 4 | + |
| 5 | +# Unified Drawer Layout System |
| 6 | + |
| 7 | +## Summary |
| 8 | + |
| 9 | +This release introduces a unified grid layout system for all drawer instances, eliminating layout inconsistencies between drawers with and without toolbars. All drawers now use the same consistent grid-based layout, providing better visual consistency and easier customization. |
| 10 | + |
| 11 | +## Breaking Changes |
| 12 | + |
| 13 | +### Layout Unification Impact |
| 14 | + |
| 15 | +Previously, drawers with toolbars used a different internal layout system than drawers without toolbars, leading to inconsistent spacing, positioning, and responsive behavior when adding new internal features. This change standardizes all drawer layouts (with one exception - see below) to use the same grid system. |
| 16 | + |
| 17 | +**⚠️ Migration Required:** If you were using custom CSS to override drawer layout styles, you will need to update your styles to work with the new grid-based layout system. |
| 18 | + |
| 19 | +### What's Changed |
| 20 | + |
| 21 | +#### 1. Drawer without toolbar using the `drawer` prop |
| 22 | + |
| 23 | +Drawers passed via the `drawer` prop now use the unified grid layout. Mobile styles have been updated to match the responsive behavior of drawers with toolbars. |
| 24 | + |
| 25 | +**Impact:** Custom style overrides will need to be updated to work with the new grid system. |
| 26 | + |
| 27 | +```tsx |
| 28 | +// ✅ This usage is affected - now uses unified grid layout |
| 29 | +<DrawerLayout |
| 30 | + displayMode={DisplayMode.Embedded} |
| 31 | + isDrawerOpen={open} |
| 32 | + resizable |
| 33 | + drawer={ |
| 34 | + <Drawer title="Resizable Drawer"> |
| 35 | + <div> |
| 36 | + Drawer content that can be resized by dragging the left edge |
| 37 | + </div> |
| 38 | + </Drawer> |
| 39 | + } |
| 40 | + onClose={() => setOpen(false)} |
| 41 | +> |
| 42 | + <main> |
| 43 | + <Button onClick={() => setOpen(prevOpen => !prevOpen)}> |
| 44 | + Toggle Resizable Drawer |
| 45 | + </Button> |
| 46 | + </main> |
| 47 | +</DrawerLayout> |
| 48 | +``` |
| 49 | + |
| 50 | +#### 2. Drawer passed as child (No changes required) |
| 51 | + |
| 52 | +**Impact:** No changes needed. This usage pattern is unaffected. |
| 53 | + |
| 54 | +When the drawer is passed as a child component, it cannot be wrapped in the new grid layout system, so this usage pattern remains unchanged. |
| 55 | + |
| 56 | +```tsx |
| 57 | +// ✅ This usage is NOT affected - works exactly the same |
| 58 | +<DrawerLayout displayMode={DisplayMode.Overlay} isDrawerOpen={open}> |
| 59 | + <main> |
| 60 | + <Button onClick={() => setOpen(prevOpen => !prevOpen)}> |
| 61 | + Open Drawer |
| 62 | + </Button> |
| 63 | + </main> |
| 64 | + <Drawer |
| 65 | + displayMode={DisplayMode.Overlay} |
| 66 | + onClose={() => setOpen(false)} |
| 67 | + open={open} |
| 68 | + title="Drawer Title" |
| 69 | + > |
| 70 | + Drawer content goes here |
| 71 | + </Drawer> |
| 72 | +</DrawerLayout> |
| 73 | +``` |
| 74 | + |
| 75 | +#### 3. Drawer with toolbar (No changes required) |
| 76 | + |
| 77 | +**Impact:** No changes needed. This usage already used the unified grid layout. |
| 78 | + |
| 79 | +```tsx |
| 80 | +// ✅ This usage is NOT affected - already used the unified layout |
| 81 | +<DrawerLayout |
| 82 | + toolbarData={DRAWER_TOOLBAR_DATA} |
| 83 | + displayMode={DisplayMode.Overlay} |
| 84 | + size={Size.Default} |
| 85 | +> |
| 86 | + <Main /> |
| 87 | +</DrawerLayout> |
| 88 | +``` |
| 89 | + |
| 90 | +## Migration Guide |
| 91 | + |
| 92 | +### If you have custom CSS overrides: |
| 93 | + |
| 94 | +1. **Review your custom styles:** Check if you have any CSS that targets drawer layout elements |
| 95 | +2. **Test thoroughly:** The new grid system may affect positioning, spacing, or responsive behavior |
| 96 | +3. **Update selectors:** You may need to update CSS selectors to target the new grid structure |
| 97 | + |
| 98 | +### Benefits of this change: |
| 99 | + |
| 100 | +- **Consistent layout:** All drawers now have the same visual structure and behavior |
| 101 | +- **Better mobile experience:** Unified responsive behavior across all drawer types |
| 102 | +- **Easier customization:** Single grid system to understand and customize |
| 103 | +- **Future-proof:** Consistent foundation for future drawer enhancements |
0 commit comments