-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAY-1582] Drawer Menu Behavior (#3932)
**What does this PR do?** A clear and concise description with your runway ticket url. Runway https://runway.powerhrg.com/backlog_items/PLAY-1582 I add/rename props so the drawer kits has `closeBreakpoint` `openBreakpoint` `withinElement` So that we can have the drawer behave like a responsive menu. You can set what element is the drawer's menu button that will open and close the menu You can see it in action here and here's a screen cast (the animation on the drawer is kinda whack) [screencast-localhost_3000-2024_11_22-13_13_38.webm](https://github.com/user-attachments/assets/ea77424c-5550-46c2-b486-8439a4cff72f)
- Loading branch information
1 parent
172debf
commit 804f6b5
Showing
6 changed files
with
197 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
playbook/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from "react"; | ||
import { Button, Drawer, Icon, Title } from "playbook-ui"; | ||
|
||
const DrawerMenu = () => { | ||
|
||
return ( | ||
<> | ||
<Button id="menuButton" | ||
padding="sm" | ||
> | ||
<Icon icon="bars" | ||
size="3x" | ||
/> | ||
</Button> | ||
<Drawer | ||
behavior="push" | ||
closeBreakpoint="md" | ||
menuButtonID="menuButton" | ||
overlay={false} | ||
placement="left" | ||
size="lg" | ||
withinElement | ||
> | ||
<Title paddingBottom="md">A really neat menu</Title> | ||
<Button text="This Button does nothing" /> | ||
</Drawer> | ||
</> | ||
); | ||
}; | ||
|
||
export default DrawerMenu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Our drawer kit can fulfill your responsive menu needs! Using the `closeBreakpoint` prop you can have the menu close on smaller screens like phones/tablets. | ||
|
||
Set a menu button with the `menuButtonID` props. When the Drawer is open, the menu button will be hidden. But when your Brakpoint closes the drawer, you can toggle the Drawer open/close with your menu butotn. | ||
|
||
Also use the `withinElement` props to have the Drawer open within a specific element, instead of the default behavior of it taking up the entire screen size. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters