Skip to content

Commit

Permalink
Add banner to component docs with link to page in new docsite (#3752)
Browse files Browse the repository at this point in the history
* WIP

* Fix quotes; add banner to a few more pages

* Fix linting issues

* Update docs/components/DeprecationBanner.js

Co-authored-by: Josep Martins <josepmartins@github.com>

* Fix linting issue

---------

Co-authored-by: Josep Martins <josepmartins@github.com>
  • Loading branch information
camertron and Josep Martins authored Sep 25, 2023
1 parent b4fe331 commit f080f72
Show file tree
Hide file tree
Showing 60 changed files with 196 additions and 3 deletions.
14 changes: 14 additions & 0 deletions docs/components/DeprecationBanner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react'
import {Link as GatsbyLink} from 'gatsby'
import {Note} from '@primer/gatsby-theme-doctocat'

const DeprecationBanner = ({replacementUrl}) => {
return (
<Note variant="warning" sx={{marginBottom: '40px'}}>
This documentation is moving to a new home. Please update any link or bookmark that points to this page. The new
content can be found <GatsbyLink href={replacementUrl}>here</GatsbyLink>.
</Note>
)
}

export default DeprecationBanner
3 changes: 3 additions & 0 deletions docs/content/ActionList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import data from '../../src/ActionList/ActionList.docs.json'
import {ActionList, Avatar} from '@primer/react'
import {LinkIcon, AlertIcon, ArrowRightIcon} from '@primer/octicons-react'
import InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/action-list/react'} />

<Box sx={{border: '1px solid', borderColor: 'border.default', borderRadius: 2, padding: 6, marginBottom: 3}}>
<ActionList sx={{width: 320}}>
Expand Down
3 changes: 3 additions & 0 deletions docs/content/ActionMenu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ description: An ActionMenu is an ActionList-based component for creating a menu
import data from '../../src/ActionMenu/ActionMenu.docs.json'

import {Box, Avatar, ActionList, ActionMenu} from '@primer/react'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/action-menu/react'} />

<br />

Expand Down
4 changes: 4 additions & 0 deletions docs/content/AnchoredOverlay.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ storybook: '/react/storybook?path=/story/behaviors-anchoredoverlay--default-port

import data from '../../src/AnchoredOverlay/AnchoredOverlay.docs.json'

import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/anchored-overlay/react'} />

An `AnchoredOverlay` provides an anchor that will open a floating overlay positioned relative to the anchor.
The overlay can be opened and navigated using keyboard or mouse.

Expand Down
3 changes: 3 additions & 0 deletions docs/content/Autocomplete.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ storybook: '/react/storybook?path=/story/components-forms-autocomplete'

import data from '../../src/Autocomplete/Autocomplete.docs.json'
import {Autocomplete} from '@primer/react'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/autocomplete/react'} />

The `Autocomplete` component is comprised of an `Autocomplete.Input` component that a user types into, and a `Autocomplete.Menu` component that displays the list of selectable values.

Expand Down
4 changes: 3 additions & 1 deletion docs/content/Avatar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ source: https://github.com/primer/react/blob/main/src/Avatar
---

import data from '../../src/Avatar/Avatar.docs.json'

import {Avatar, Box} from '@primer/react'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/avatar/react'} />

```js
import {Avatar} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/AvatarPair.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ source: https://github.com/primer/react/blob/main/src/AvatarPair
---

import data from '../../src/AvatarPair/AvatarPair.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/avatar-pair/react'} />

```js
import {AvatarPair} from '@primer/react'
Expand Down
4 changes: 3 additions & 1 deletion docs/content/AvatarStack.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ storybook: '/react/storybook?path=/story/components-avatarstack--default'
---

import data from '../../src/AvatarStack/AvatarStack.docs.json'

import {AvatarStack} from '@primer/react'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/avatar-stack/react'} />

```js
import {AvatarStack} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/Box.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ source: https://github.com/primer/react/blob/main/src/Box.tsx
---

import data from '../../src/Box/Box.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/box/react'} />

```js
import {Box} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/BranchName.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ source: https://github.com/primer/react/blob/main/src/BranchName/BranchName.tsx
---

import data from '../../src/BranchName/BranchName.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/branch-name/react'} />

```js
import {BranchName} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/Breadcrumbs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ source: https://github.com/primer/react/blob/main/src/Breadcrumbs/Breadcrumbs.ts
---

import data from '../../src/Breadcrumbs/Breadcrumbs.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/breadcrumbs/react'} />

```js
import {Breadcrumbs} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/Button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ description: Use button for the main actions on a page or form.
---

import data from '../../src/Button/Button.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/button/react'} />

```js
import {Button} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/ButtonGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ storybook: '/react/storybook?path=/story/components-buttongroup--default'
---

import data from '../../src/ButtonGroup/ButtonGroup.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/button-group/react'} />

```js
import {ButtonGroup} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/Checkbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ componentId: checkbox
---

import data from '../../src/Checkbox/Checkbox.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/checkbox/react'} />

## Examples

Expand Down
3 changes: 3 additions & 0 deletions docs/content/CheckboxGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import data from '../../src/CheckboxGroup/CheckboxGroup.docs.json'

import {CheckboxGroup, Checkbox, Box} from '@primer/components'
import {CheckIcon, XIcon, AlertIcon} from '@primer/octicons-react'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/checkbox-group/react'} />

## Examples

Expand Down
3 changes: 3 additions & 0 deletions docs/content/CircleBadge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ source: https://github.com/primer/react/blob/main/src/CircleBadge
---

import data from '../../src/CircleBadge/CircleBadge.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/circle-badge/react'} />

```js
import {CircleBadge} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/CounterLabel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ source: https://github.com/primer/react/blob/main/src/CounterLabel/CounterLabel.
---

import data from '../../src/CounterLabel/CounterLabel.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/counter-label/react'} />

## Example

Expand Down
3 changes: 3 additions & 0 deletions docs/content/Details.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ storybook: '/react/storybook/?path=/story/components-details--default'
---

import data from '../../src/Details/Details.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/details/react'} />

`Details` is a styled `details` element for use with the `useDetails` hook. The `useDetails` hook returns the `open` state, a `setOpen` function to manually change the open state, and **`getDetailsProps` which must be spread onto your `Details` element in order for `Details` to get receive the proper behaviors provided by the hook**. See [Kent Dodd's article on this pattern](https://kentcdodds.com/blog/how-to-give-rendering-control-to-users-with-prop-getters).

Expand Down
3 changes: 3 additions & 0 deletions docs/content/Dialog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ source: https://github.com/primer/react/blob/main/src/Dialog
---

import data from '../../src/Dialog.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/dialog/react'} />

The dialog component is used for all modals. It renders on top of the rest of the app with an overlay.

Expand Down
3 changes: 3 additions & 0 deletions docs/content/Flash.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ source: https://github.com/primer/react/blob/main/src/Flash
---

import data from '../../src/Flash/Flash.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/flash/react'} />

```js
import {Flash} from '@primer/react'
Expand Down
5 changes: 4 additions & 1 deletion docs/content/FormControl.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ storybook: '/react/storybook?path=/story/components-forms-autocomplete'
---

import data from '../../src/FormControl/FormControl.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'
import {MarkGithubIcon} from '@primer/octicons-react'

import {
FormControl,
Expand All @@ -21,7 +23,8 @@ import {
RadioGroup,
Text,
} from '@primer/react'
import {MarkGithubIcon} from '@primer/octicons-react'

<DeprecationBanner replacementUrl={'/design/components/form-control/react'} />

## Examples

Expand Down
3 changes: 3 additions & 0 deletions docs/content/Header.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ componentId: header
---

import data from '../../src/Header/Header.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/header/react'} />

## Examples

Expand Down
3 changes: 3 additions & 0 deletions docs/content/Heading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ componentId: heading
---

import data from '../../src/Heading/Heading.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/heading/react'} />

The Heading component will render an html `h2` tag without any default styling. Other heading level elements `h1-h6` are available through use of the `as` prop (see [System Props](/system-props) for additional explanation). Please reference the [w3 recommendations for headings](https://www.w3.org/WAI/tutorials/page-structure/headings/) to ensure your headings provide an accessible experience for screen reader users.

Expand Down
3 changes: 3 additions & 0 deletions docs/content/IconButton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ description: An accessible button component with no text and only icon.
---

import data from '../../src/Button/IconButton.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/icon-button/react'} />

## Usage

Expand Down
3 changes: 3 additions & 0 deletions docs/content/Label.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ description: Use Label components to add contextual metadata to a design.
---

import data from '../../src/Label/Label.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/label/react'} />

## Examples

Expand Down
3 changes: 3 additions & 0 deletions docs/content/LabelGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ componentId: label_group
---

import data from '../../src/LabelGroup/LabelGroup.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/label-group/react'} />

## Example

Expand Down
3 changes: 3 additions & 0 deletions docs/content/Link.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ storybook: '/react/storybook/?path=/story/components-link--default'
---

import data from '../../src/Link/Link.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/link/react'} />

The Link component styles anchor tags with default hyperlink color cues and hover text decoration. `Link` is used for destinations, or moving from one page to another.

Expand Down
3 changes: 3 additions & 0 deletions docs/content/NavList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ storybook: '/react/storybook/?path=/story/components-navlist--simple'
---

import data from '../../src/NavList/NavList.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/nav-list/react'} />

```js
import {NavList} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/Overlay.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ storybook: '/react/storybook?path=/story/private-components-overlay--dropdown-ov
---

import data from '../../src/Overlay/Overlay.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/overlay/react'} />

```js
import {Overlay} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/PageLayout.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ a11yReviewed: true
---

import data from '../../src/PageLayout/PageLayout.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/page-layout/react'} />

```js
import {PageLayout} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/Pagehead.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ status: Alpha
---

import data from '../../src/Pagehead/Pagehead.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/pagehead/react'} />

```js
import {Pagehead} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/Pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ status: Alpha
import data from '../../src/Pagination/Pagination.docs.json'

import State from '../components/State'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/pagination/react'} />

```js
import {Pagination} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/PointerBox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ source: https://github.com/primer/react/blob/main/src/PointerBox
---

import data from '../../src/PointerBox/PointerBox.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/pointer-box/react'} />

## Examples

Expand Down
3 changes: 3 additions & 0 deletions docs/content/Popover.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ source: https://github.com/primer/react/blob/main/src/Popover
---

import data from '../../src/Popover/Popover.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/popover/react'} />

```js
import {Popover} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/ProgressBar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ source: https://github.com/primer/react/blob/main/src/ProgressBar
---

import data from '../../src/ProgressBar/ProgressBar.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/progress-bar/react'} />

```js
import {ProgressBar} from '@primer/react'
Expand Down
3 changes: 3 additions & 0 deletions docs/content/Radio.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ storybook: '/react/storybook?path=/story/components-forms-radiogroup'
---

import data from '../../src/Radio/Radio.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/radio/react'} />

## Examples

Expand Down
3 changes: 3 additions & 0 deletions docs/content/RadioGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import data from '../../src/RadioGroup/RadioGroup.docs.json'

import {RadioGroup, Radio, Box} from '@primer/components'
import {CheckIcon, XIcon, AlertIcon} from '@primer/octicons-react'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/radio-group/react'} />

## Examples

Expand Down
3 changes: 3 additions & 0 deletions docs/content/RelativeTime.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ source: https://github.com/primer/react/blob/main/src/RelativeTime
---

import data from '../../src/RelativeTime/RelativeTime.docs.json'
import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/design/components/relative-time/react'} />

```js
import {RelativeTime} from '@primer/react'
Expand Down
Loading

0 comments on commit f080f72

Please sign in to comment.