Skip to content

Commit

Permalink
Revert "Dialog v2: Move files, reformat stories and add e2e tests (#2984
Browse files Browse the repository at this point in the history
)"

This reverts commit 418f316.
  • Loading branch information
broccolinisoup committed Mar 15, 2023
1 parent f5a9f12 commit b907326
Show file tree
Hide file tree
Showing 73 changed files with 167 additions and 348 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
---
title: Dialog v2
componentId: dialog_2
componentId: dialog
status: Draft
a11yReviewed: false
description: Use an underlined nav to allow tab like navigation with overflow behaviour in your UI.
source: https://github.com/primer/react/tree/main/src/Dialog2
storybook: '/react/storybook/?path=/story/drafts-components-dialog--default'
---

import data from '../../../src/Dialog2/Dialog.docs.json'
import data from '../../../src/Dialog/Dialog.docs.json'

```js
import {Dialog} from '@primer/react/drafts'
Expand Down
2 changes: 1 addition & 1 deletion docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
- title: Drafts
children:
- title: Dialog v2
url: /drafts/Dialog2
url: /drafts/Dialog
- title: InlineAutocomplete
url: /drafts/InlineAutocomplete
- title: MarkdownEditor
Expand Down
131 changes: 0 additions & 131 deletions e2e/components/DialogV2.test.ts

This file was deleted.

7 changes: 1 addition & 6 deletions generated/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -2112,12 +2112,7 @@
"name": "Dialog",
"status": "draft",
"a11yReviewed": false,
"stories": [
{
"id": "components-dialog--default",
"code": "() => {\n const [isOpen, setIsOpen] = useState(false)\n const buttonRef = useRef<HTMLButtonElement>(null)\n const onDialogClose = useCallback(() => setIsOpen(false), [])\n return (\n <>\n <Button ref={buttonRef} onClick={() => setIsOpen(!isOpen)}>\n Show dialog\n </Button>\n {isOpen && <Dialog onClose={onDialogClose}>Dialog Content</Dialog>}\n </>\n )\n}"
}
],
"stories": [],
"props": [
{
"name": "title",
Expand Down
19 changes: 0 additions & 19 deletions script/generate-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,25 +336,6 @@ const components = new Map([
],
},
],
[
'DialogV2',
{
stories: [
{
id: 'drafts-components-dialog--default',
name: 'Default',
},
{
id: 'drafts-components-dialog-features--basic-dialog',
name: 'Basic Dialog',
},
{
id: 'drafts-components-dialog-features--basic-confirmation-dialog',
name: 'Basic Confirmation Dialog',
},
],
},
],
[
'Flash',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Box from '../Box'
import {ThemeProvider, useTheme, ThemeProviderProps} from '../ThemeProvider'
import {FocusKeys} from '@primer/behaviors'
import {get} from '../constants'
import {Dialog, DialogProps, DialogHeaderProps, DialogButtonProps} from './Dialog'
import {Dialog, DialogProps, DialogHeaderProps, DialogButtonProps} from '../Dialog/Dialog'
import {useFocusZone} from '../hooks/useFocusZone'

/**
Expand Down
File renamed without changes.
File renamed without changes.
39 changes: 0 additions & 39 deletions src/Dialog2/Dialog.stories.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/Dialog2/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/TreeView/TreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import classnames from 'classnames'
import React from 'react'
import styled, {keyframes} from 'styled-components'
import {get} from '../constants'
import {ConfirmationDialog} from '../Dialog2/ConfirmationDialog'
import {ConfirmationDialog} from '../Dialog/ConfirmationDialog'
import {useControllableState} from '../hooks/useControllableState'
import {useId} from '../hooks/useId'
import useSafeTimeout from '../hooks/useSafeTimeout'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import {render as HTMLRender, act, fireEvent} from '@testing-library/react'
import {axe} from 'jest-axe'
import React, {useCallback, useRef, useState} from 'react'

import {ActionMenu} from '../../deprecated/ActionMenu'
import BaseStyles from '../../BaseStyles'
import Box from '../../Box'
import Button from '../../deprecated/Button/Button'
import {ConfirmationDialog, useConfirm} from '../ConfirmationDialog'
import theme from '../../theme'
import {ThemeProvider} from '../../ThemeProvider'
import {SSRProvider} from '../../utils/ssr'
import {behavesAsComponent, checkExports} from '../../utils/testing'
import {ActionMenu} from '../deprecated/ActionMenu'
import BaseStyles from '../BaseStyles'
import Box from '../Box'
import Button from '../deprecated/Button/Button'
import {ConfirmationDialog, useConfirm} from '../Dialog/ConfirmationDialog'
import theme from '../theme'
import {ThemeProvider} from '../ThemeProvider'
import {SSRProvider} from '../utils/ssr'
import {behavesAsComponent, checkExports} from '../utils/testing'

declare const REACT_VERSION_LATEST: boolean

Expand Down Expand Up @@ -80,7 +80,7 @@ describe('ConfirmationDialog', () => {
options: {skipAs: true, skipSx: true},
})

checkExports('Dialog2/ConfirmationDialog', {
checkExports('Dialog/ConfirmationDialog', {
default: undefined,
useConfirm,
ConfirmationDialog,
Expand Down Expand Up @@ -140,7 +140,9 @@ describe('ConfirmationDialog', () => {
// REACT_VERSION_LATEST should be treated as a constant for the test
// environment
if (REACT_VERSION_LATEST) {
// eslint-disable-next-line jest/no-conditional-expect
expect(spy).toHaveBeenCalledTimes(1)
// eslint-disable-next-line jest/no-conditional-expect
expect(spy).toHaveBeenCalledWith(
expect.stringContaining('Warning: ReactDOM.render is no longer supported in React 18'),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import {Dialog} from '../Dialog'
import {Dialog} from '../Dialog/Dialog'

export function shouldAcceptCallWithNoProps() {
return <Dialog onClose={() => null} />
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/storybook.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const allowlist = [
'CounterLabel',
'DataTable',
'Details',
'Dialog2',
'Flash',
'Heading',
'IconButton',
Expand Down
2 changes: 1 addition & 1 deletion src/drafts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type {
TableActionsProps,
} from '../DataTable'

export * from '../Dialog2'
export * from '../Dialog/Dialog'

export {default as InlineAutocomplete} from './InlineAutocomplete'
export type {
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type {TouchOrMouseEvent} from './hooks/useOnOutsideClick'
export {useOpenAndCloseFocus} from './hooks/useOpenAndCloseFocus'
export {useOnEscapePress} from './hooks/useOnEscapePress'
export {useOverlay} from './hooks/useOverlay'
export {useConfirm} from './Dialog2/ConfirmationDialog'
export {useConfirm} from './Dialog/ConfirmationDialog'
export {useFocusTrap} from './hooks/useFocusTrap'
export type {FocusTrapHookSettings} from './hooks/useFocusTrap'
export {useFocusZone} from './hooks/useFocusZone'
Expand Down Expand Up @@ -87,8 +87,8 @@ export {default as Details} from './Details'
export type {DetailsProps} from './Details'
export {default as Dialog} from './Dialog'
export type {DialogProps, DialogHeaderProps} from './Dialog'
export type {ConfirmationDialogProps} from './Dialog2/ConfirmationDialog'
export {ConfirmationDialog} from './Dialog2/ConfirmationDialog'
export type {ConfirmationDialogProps} from './Dialog/ConfirmationDialog'
export {ConfirmationDialog} from './Dialog/ConfirmationDialog'
export {default as FilteredSearch} from './FilteredSearch'
export type {FilteredSearchProps} from './FilteredSearch'
export {default as FilterList} from './FilterList'
Expand Down
Loading

0 comments on commit b907326

Please sign in to comment.