Skip to content
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

Navigation: Soft deprecate component #59182

Merged
merged 4 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Deprecation

- `Navigation`: Soft deprecate component ([#59182](https://github.com/WordPress/gutenberg/pull/59182)).

### Enhancements

- `ExternalLink`: Use unicode arrow instead of svg icon ([#60255](https://github.com/WordPress/gutenberg/pull/60255)).
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/navigation/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Navigation

<div class="callout callout-alert">
This component is deprecated. Consider using `Navigator` instead.
</div>

<div class="callout callout-alert">
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
</div>
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/navigation/back-button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ function UnforwardedNavigationBackButton(
);
}

/**
* @deprecated Use `Navigator` instead.
*/
export const NavigationBackButton = forwardRef(
UnforwardedNavigationBackButton
);
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/navigation/group/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import type { NavigationGroupProps } from '../types';

let uniqueId = 0;

/**
* @deprecated Use `Navigator` instead.
*/
export function NavigationGroup( {
children,
className,
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const noop = () => {};
/**
* Render a navigation list with optional groupings and hierarchy.
*
* @deprecated Use `Navigator` instead.
*
* ```jsx
* import {
* __experimentalNavigation as Navigation,
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/navigation/item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import type { NavigationItemProps } from '../types';

const noop = () => {};

/**
* @deprecated Use `Navigator` instead.
*/
export function NavigationItem( props: NavigationItemProps ) {
const {
badge,
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/navigation/menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import { MenuUI } from '../styles/navigation-styles';

import type { NavigationMenuProps } from '../types';

/**
* @deprecated Use `Navigator` instead.
*/
export function NavigationMenu( props: NavigationMenuProps ) {
const {
backButtonLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ import { MoreExamplesStory } from './utils/more-examples';
import { HideIfEmptyStory } from './utils/hide-if-empty';
import './style.css';

/**
* Render a navigation list with optional groupings and hierarchy.
*
* This component is deprecated. Consider using `Navigator` instead.
*/
const meta: Meta< typeof Navigation > = {
title: 'Components (Experimental)/Navigation',
title: 'Components (Deprecated)/Navigation',
id: 'components-navigation',
component: Navigation,
subcomponents: {
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
Expand Down
9 changes: 9 additions & 0 deletions storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
<script>
( function redirectIfStoryMoved() {
const PREVIOUSLY_EXPERIMENTAL_COMPONENTS = [ 'navigation' ];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add components to this list as we remove their experimental status (#59418), and once all of them are done we can simplify to a bulk redirect on components-experimental- prefixes.

More info on the redirect mechanism at #59181.

const REDIRECTS = [
{
from: /\/components-deprecated-/,
to: '/components-',
},
{
from: new RegExp(
`\/components-experimental-(?=${ PREVIOUSLY_EXPERIMENTAL_COMPONENTS.map(
( str ) => `${ str }\\b`
).join( '|' ) })`
),
to: '/components-',
},
];

const params = new URLSearchParams( window.location.search );
Expand Down
Loading