forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Navigator: internal refactor in preparation for stabilization (WordPr…
…ess#65671) * Rename navigator-provider internal folder to navigator * Rename internal NavigatorProvider variables to Navigator * Remove default exports * Remove JSDocs from individual component files * Move exports to legacy.ts file, including JSDocs * Undo folder rename as it was causing a different doc manifest --- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
- Loading branch information
1 parent
f624423
commit 79efa22
Showing
11 changed files
with
182 additions
and
131 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 was deleted.
Oops, something went wrong.
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,172 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { Navigator as InternalNavigator } from './navigator-provider/component'; | ||
import { NavigatorScreen as InternalNavigatorScreen } from './navigator-screen/component'; | ||
import { NavigatorButton as InternalNavigatorButton } from './navigator-button/component'; | ||
import { NavigatorBackButton as InternalNavigatorBackButton } from './navigator-back-button/component'; | ||
import { NavigatorToParentButton as InternalNavigatorToParentButton } from './navigator-to-parent-button/component'; | ||
export { useNavigator } from './use-navigator'; | ||
|
||
/** | ||
* The `NavigatorProvider` component allows rendering nested views/panels/menus | ||
* (via the `NavigatorScreen` component and navigate between these different | ||
* view (via the `NavigatorButton` and `NavigatorBackButton` components or the | ||
* `useNavigator` hook). | ||
* | ||
* ```jsx | ||
* import { | ||
* __experimentalNavigatorProvider as NavigatorProvider, | ||
* __experimentalNavigatorScreen as NavigatorScreen, | ||
* __experimentalNavigatorButton as NavigatorButton, | ||
* __experimentalNavigatorBackButton as NavigatorBackButton, | ||
* } from '@wordpress/components'; | ||
* | ||
* const MyNavigation = () => ( | ||
* <NavigatorProvider initialPath="/"> | ||
* <NavigatorScreen path="/"> | ||
* <p>This is the home screen.</p> | ||
* <NavigatorButton path="/child"> | ||
* Navigate to child screen. | ||
* </NavigatorButton> | ||
* </NavigatorScreen> | ||
* | ||
* <NavigatorScreen path="/child"> | ||
* <p>This is the child screen.</p> | ||
* <NavigatorBackButton> | ||
* Go back | ||
* </NavigatorBackButton> | ||
* </NavigatorScreen> | ||
* </NavigatorProvider> | ||
* ); | ||
* ``` | ||
*/ | ||
export const NavigatorProvider = Object.assign( InternalNavigator, { | ||
displayName: 'NavigatorProvider', | ||
} ); | ||
|
||
/** | ||
* The `NavigatorScreen` component represents a single view/screen/panel and | ||
* should be used in combination with the `NavigatorProvider`, the | ||
* `NavigatorButton` and the `NavigatorBackButton` components (or the `useNavigator` | ||
* hook). | ||
* | ||
* @example | ||
* ```jsx | ||
* import { | ||
* __experimentalNavigatorProvider as NavigatorProvider, | ||
* __experimentalNavigatorScreen as NavigatorScreen, | ||
* __experimentalNavigatorButton as NavigatorButton, | ||
* __experimentalNavigatorBackButton as NavigatorBackButton, | ||
* } from '@wordpress/components'; | ||
* | ||
* const MyNavigation = () => ( | ||
* <NavigatorProvider initialPath="/"> | ||
* <NavigatorScreen path="/"> | ||
* <p>This is the home screen.</p> | ||
* <NavigatorButton path="/child"> | ||
* Navigate to child screen. | ||
* </NavigatorButton> | ||
* </NavigatorScreen> | ||
* | ||
* <NavigatorScreen path="/child"> | ||
* <p>This is the child screen.</p> | ||
* <NavigatorBackButton> | ||
* Go back | ||
* </NavigatorBackButton> | ||
* </NavigatorScreen> | ||
* </NavigatorProvider> | ||
* ); | ||
* ``` | ||
*/ | ||
export const NavigatorScreen = Object.assign( InternalNavigatorScreen, { | ||
displayName: 'NavigatorScreen', | ||
} ); | ||
|
||
/** | ||
* The `NavigatorButton` component can be used to navigate to a screen and should | ||
* be used in combination with the `NavigatorProvider`, the `NavigatorScreen` | ||
* and the `NavigatorBackButton` components (or the `useNavigator` hook). | ||
* | ||
* @example | ||
* ```jsx | ||
* import { | ||
* __experimentalNavigatorProvider as NavigatorProvider, | ||
* __experimentalNavigatorScreen as NavigatorScreen, | ||
* __experimentalNavigatorButton as NavigatorButton, | ||
* __experimentalNavigatorBackButton as NavigatorBackButton, | ||
* } from '@wordpress/components'; | ||
* | ||
* const MyNavigation = () => ( | ||
* <NavigatorProvider initialPath="/"> | ||
* <NavigatorScreen path="/"> | ||
* <p>This is the home screen.</p> | ||
* <NavigatorButton path="/child"> | ||
* Navigate to child screen. | ||
* </NavigatorButton> | ||
* </NavigatorScreen> | ||
* | ||
* <NavigatorScreen path="/child"> | ||
* <p>This is the child screen.</p> | ||
* <NavigatorBackButton> | ||
* Go back | ||
* </NavigatorBackButton> | ||
* </NavigatorScreen> | ||
* </NavigatorProvider> | ||
* ); | ||
* ``` | ||
*/ | ||
export const NavigatorButton = Object.assign( InternalNavigatorButton, { | ||
displayName: 'NavigatorButton', | ||
} ); | ||
|
||
/** | ||
* The `NavigatorBackButton` component can be used to navigate to a screen and | ||
* should be used in combination with the `NavigatorProvider`, the | ||
* `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator` | ||
* hook). | ||
* | ||
* @example | ||
* ```jsx | ||
* import { | ||
* __experimentalNavigatorProvider as NavigatorProvider, | ||
* __experimentalNavigatorScreen as NavigatorScreen, | ||
* __experimentalNavigatorButton as NavigatorButton, | ||
* __experimentalNavigatorBackButton as NavigatorBackButton, | ||
* } from '@wordpress/components'; | ||
* | ||
* const MyNavigation = () => ( | ||
* <NavigatorProvider initialPath="/"> | ||
* <NavigatorScreen path="/"> | ||
* <p>This is the home screen.</p> | ||
* <NavigatorButton path="/child"> | ||
* Navigate to child screen. | ||
* </NavigatorButton> | ||
* </NavigatorScreen> | ||
* | ||
* <NavigatorScreen path="/child"> | ||
* <p>This is the child screen.</p> | ||
* <NavigatorBackButton> | ||
* Go back (to parent) | ||
* </NavigatorBackButton> | ||
* </NavigatorScreen> | ||
* </NavigatorProvider> | ||
* ); | ||
* ``` | ||
*/ | ||
export const NavigatorBackButton = Object.assign( InternalNavigatorBackButton, { | ||
displayName: 'NavigatorBackButton', | ||
} ); | ||
|
||
/** | ||
* _Note: this component is deprecated. Please use the `NavigatorBackButton` | ||
* component instead._ | ||
* | ||
* @deprecated | ||
*/ | ||
export const NavigatorToParentButton = Object.assign( | ||
InternalNavigatorToParentButton, | ||
{ | ||
displayName: 'NavigatorToParentButton', | ||
} | ||
); |
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
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
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
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