-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Drawer): resizer, portal rendering, hide veil #270
Conversation
Preview is ready. |
904ab2e
to
3e94231
Compare
I get some points after testing Drawer in Storybook preview
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe CSS API in Readme please
e.g. https://github.com/gravity-ui/navigation/tree/main/src/components/AsideHeader#css-api
src/components/Drawer/Drawer.tsx
Outdated
}; | ||
|
||
export type {DrawerDirection} from './utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move to the top or you can move to Drawer/index btw
|
src/components/Drawer/README.md
Outdated
@@ -57,3 +87,16 @@ The Drawer module consists of two primary components: `Drawer` and `DrawerItem`. | |||
| style | Optional inline styles to be applied to the drawer component. | `React.CSSProperties` | | | |||
| onVeilClick | Optional callback function that is called when the veil (overlay) is clicked. | `(event: React.MouseEvent) => void` | | | |||
| onEscape | Optional callback function that is called when the escape key is pressed, if the drawer is open. | `() => void` | | | |||
| hideVeil | Optional flag to hide the background darkening | `boolean` | | | |||
| disablePortal | Optional flag to hide the background darkening | `boolean` | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix description for disablePortal
Adds new functionality to Drawer.
Resizable drawer item
DrawerItem can be optionally made resizable, with the ability to save the width of the element.
New DrawerItem props:
resizable
: (optional) Whether the item should be able to resizewidth
: (optional) The width of the resizable drawer item. If not provided, the current width will be stored internally in the component.onResize
: (optional) Callback that can be used to save the new item widthminResizeWidth
: (optional) The minimum width the item can be resized tomaxResizeWidth
: (optional) The maximum width the item can be resized toPortal
Drawer renders itself in
<Portal>
by default. This can be disabled by passingdisablePortal={true}
prop.Hide veil
The background veil element can be disabled by passing
hideVeil={true}
prop.