This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
feat(menuItem: add menu prop) #357
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
72ea550
feat(menuItem: add menu prop)
d4a3a0c
Only one submenu open at a time
85981f8
Fix bug: submenu noe closes on clicking a menuItem with no submenu
fa99935
Code cleanup
8271a18
Remove the activeIndex prop passed to the menuItem
35e8a76
Remove Popup and implement submenu without it
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
docs/src/examples/components/Menu/Types/MenuExampleVerticalWithSubmenu.shorthand.tsx
This file contains hidden or 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,39 @@ | ||
| import React from 'react' | ||
| import { Menu, Provider } from '@stardust-ui/react' | ||
|
|
||
| const items = [ | ||
| { | ||
| key: 'editorials', | ||
| content: 'Editorials', | ||
| menu: { | ||
| items: [ | ||
| { key: '1', content: 'item1' }, | ||
| { | ||
| key: '2', | ||
| content: 'item2', | ||
| menu: { items: [{ key: '1', content: 'item1' }, { key: '2', content: 'item2' }] }, | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| { key: 'review', content: 'Reviews' }, | ||
| { key: 'events', content: 'Upcoming Events' }, | ||
| ] | ||
|
|
||
| const MenuExampleVerticalWithSubmenu = () => ( | ||
| <Provider | ||
| theme={{ | ||
| componentStyles: { | ||
| Menu: { | ||
| root: { | ||
| zIndex: 1000, | ||
| }, | ||
| }, | ||
| }, | ||
| }} | ||
| > | ||
| <Menu defaultActiveIndex={0} vertical items={items} /> | ||
| </Provider> | ||
| ) | ||
|
|
||
| export default MenuExampleVerticalWithSubmenu |
57 changes: 57 additions & 0 deletions
57
docs/src/examples/components/Menu/Types/MenuExampleWithSubmenu.shorthand.tsx
This file contains hidden or 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,57 @@ | ||
| import React from 'react' | ||
| import { Menu, Provider } from '@stardust-ui/react' | ||
|
|
||
| const items = [ | ||
| { | ||
| key: 'editorials', | ||
| content: 'Editorials', | ||
| menu: { | ||
| items: [ | ||
| { key: '1', content: 'item1' }, | ||
| { | ||
| key: '2', | ||
| content: 'item2', | ||
| menu: { items: [{ key: '1', content: 'item1' }, { key: '2', content: 'item2' }] }, | ||
| }, | ||
| { | ||
| key: '3', | ||
| content: 'item3', | ||
| menu: { items: [{ key: '1', content: 'item1' }, { key: '2', content: 'item2' }] }, | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| { | ||
| key: 'review', | ||
| content: 'Reviews', | ||
| menu: { | ||
| items: [ | ||
| { key: '1', content: 'item1' }, | ||
| { | ||
| key: '2', | ||
| content: 'item2', | ||
| menu: { items: [{ key: '1', content: 'item1' }, { key: '2', content: 'item2' }] }, | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| { key: 'events', content: 'Upcoming Events' }, | ||
| ] | ||
|
|
||
| const MenuExampleWithSubMenu = () => ( | ||
| <Provider | ||
| theme={{ | ||
| componentStyles: { | ||
| Menu: { | ||
| root: { | ||
| zIndex: 1000, | ||
| }, | ||
| }, | ||
| }, | ||
| }} | ||
| > | ||
| <Menu defaultActiveIndex={0} items={items} /> | ||
| </Provider> | ||
| ) | ||
|
|
||
| export default MenuExampleWithSubMenu |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
When should we use
setStatevs.trySetState? Can someone please explain in brief the purpose oftrySetState.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.
lets schedule a short sync for tomorrow, I will explain the concept to you. Before that, please, consider to read about Controlled and Uncontrolled Components, as well as try to make experiments with
inputcomponent being used in these different modes - note how the value updates for each, whenonChangehandler is triggered, how value updates in controlled mode.