Drawer resizable mouse drag
Skill kjuhwa/skills-hub/skills/design/drawer-resizable-mouse-drag
Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.
npx -y skills add kjuhwa/skills-hub --skill drawer-resizable-mouse-dragAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Make Ant Design Drawer resizable via mouse drag with styled-components handle, min/max width constraints, and transition suppression during drag
SKILL.md
2.1 KB, 417 tokens by cl100k_base, as published. Nobody here has run it
Resizable Drawer with Mouse Drag
Steps
-
Create resize handle with styled-components:
const ResizableHandle = styled.div` position: absolute; left: 0; top: 0; bottom: 0; width: 4px; cursor: col-resize; z-index: 10; &:hover { background: var(--color-border-interactive); } `; -
Add mouse event listeners for drag:
const onMouseDown = (e) => { e.preventDefault(); const startX = e.clientX; const startWidth = currentWidth; // Suppress transition during drag const wrapper = document.querySelector('.ant-drawer-content-wrapper'); if (wrapper) wrapper.style.transition = 'none'; const onMouseMove = (moveE) => { const newWidth = Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, startWidth + (startX - moveE.clientX))); setWidth(newWidth); }; const onMouseUp = () => { if (wrapper) wrapper.style.transition = ''; document.removeEventListener('mousemove', onMouseMove); document.removeEventListener('mouseup', onMouseUp); }; document.addEventListener('mousemove', onMouseMove); document.addEventListener('mouseup', onMouseUp); }; -
Define constraints:
MIN_WIDTH = 440(minimum usable content width)MAX_WIDTH = window.innerWidth - menuOffset(don't overlap sidebar)
-
Apply width to Ant Drawer:
<Drawer width={width} {...props}> <ResizableHandle onMouseDown={onMouseDown} /> {children} </Drawer>
Key details
- Setting
transition: 'none'on.ant-drawer-content-wrapperduring drag prevents jittery animation - Restore transition on mouseup for smooth open/close animation
menuOffsetaccounts for sidebar width in the host layout
Gives 0 of the 12 instructions most css styling skills give in 417 tokens
Counted across 586 of the 596 authors here whose files we hold, read 2026-08-06
- avoid excessive centered layoutsin 55 of 586, across 12 files
- bundle code into single HTML filein 54 of 586, across 14 files
- Respect prefers-reduced-motion user settingsin 52 of 586, across 35 files
- avoid purple gradientsin 51 of 586, across 11 files
- avoid uniform rounded cornersin 51 of 586, across 11 files
- avoid Inter fontin 51 of 586, across 11 files
- edit generated files to develop artifactin 50 of 586, across 10 files
- animate only transform and opacity propertiesin 43 of 586
- Make touch targets at least 44x44 pixelsin 41 of 586, across 15 files
- Ensure minimum color contrast of 4.5:1in 39 of 586, across 10 files
- use tailwind cssin 39 of 586, across 24 files
- Use SVG icons instead of emojisin 38 of 586, across 11 files
Said here and by no other author read
- create a resize handle using styled-components
- add mouse down, move, and up event listeners
- suppress css transition during drag
- restore css transition on mouseup
- enforce minimum and maximum width constraints
- apply the dynamic width to the drawer component
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.