-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de1fee1
commit a11e356
Showing
2 changed files
with
57 additions
and
41 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
packages/components/src/navigation/stories/hide-if-empty.js
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,55 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import Navigation from '..'; | ||
import NavigationItem from '../item'; | ||
import NavigationMenu from '../menu'; | ||
|
||
export function HideIFEmptyStory() { | ||
return ( | ||
<> | ||
<Navigation> | ||
<NavigationMenu title="Home" menu="root" isEmpty={ false }> | ||
<NavigationItem | ||
navigateToMenu="root-sub-1" | ||
title="To sub 1 (hidden)" | ||
hideIfTargetMenuEmpty | ||
/> | ||
|
||
<NavigationItem | ||
navigateToMenu="root-sub-2" | ||
title="To sub 2 (visible)" | ||
hideIfTargetMenuEmpty | ||
/> | ||
|
||
<NavigationItem | ||
navigateToMenu="root-sub-1-sub-1" | ||
title="To sub 1-1 (hidden)" | ||
hideIfTargetMenuEmpty | ||
/> | ||
</NavigationMenu> | ||
|
||
<NavigationMenu | ||
menu="root-sub-1" | ||
parentMenu="root" | ||
isEmpty={ true } | ||
/> | ||
<NavigationMenu | ||
menu="root-sub-2" | ||
parentMenu="root" | ||
isEmpty={ false } | ||
/> | ||
<NavigationMenu | ||
menu="root-sub-1-sub-1" | ||
parentMenu="root-sub-1" | ||
isEmpty={ true } | ||
/> | ||
</Navigation> | ||
|
||
<p> | ||
This story contains 3 navigation items and 4 menus. You should | ||
only see one item: <strong>To sub 2 (visible)</strong> | ||
</p> | ||
</> | ||
); | ||
} |
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