From a1689fae05f91c6d599606d7788b13fd99588ff0 Mon Sep 17 00:00:00 2001 From: Armagan Ersoz Date: Mon, 8 May 2023 15:48:33 +1000 Subject: [PATCH 01/21] move draft UnderlinNav to main bundle --- script/generate-e2e-tests.js | 16 +- .../PageHeader.examples.stories.tsx | 2 +- src/PageHeader/PageHeader.stories.tsx | 2 +- .../LoadingCounter.tsx | 0 .../UnderlineNav.Item.stories.tsx | 2 +- src/UnderlineNav/UnderlineNav.docs.json | 77 +- .../UnderlineNav.examples.stories.tsx} | 2 +- .../UnderlineNav.features.stories.tsx | 152 +++- .../UnderlineNav.interactions.stories.tsx} | 4 +- src/UnderlineNav/UnderlineNav.stories.tsx | 95 +-- src/UnderlineNav/UnderlineNav.test.tsx | 209 ++++-- src/UnderlineNav/UnderlineNav.tsx | 490 ++++++++++--- .../UnderlineNavContext.tsx | 0 .../UnderlineNavItem.tsx | 0 .../__snapshots__/UnderlineNav.test.tsx.snap | 59 -- src/UnderlineNav/index.ts | 11 +- src/{UnderlineNav2 => UnderlineNav}/styles.ts | 0 src/{UnderlineNav2 => UnderlineNav}/types.ts | 0 src/UnderlineNav2/UnderlineNav.test.tsx | 192 ----- src/UnderlineNav2/UnderlineNav.tsx | 415 ----------- src/UnderlineNav2/UnderlineNav2.docs.json | 88 --- .../UnderlineNav2.features.stories.tsx | 141 ---- src/UnderlineNav2/UnderlineNav2.stories.tsx | 62 -- .../__snapshots__/UnderlineNav.test.tsx.snap | 665 ------------------ src/UnderlineNav2/index.ts | 10 - .../UnderlineNav/UnderlineNav.docs.json | 57 ++ .../UnderlineNav.features.stories.tsx | 19 + .../UnderlineNav/UnderlineNav.stories.tsx | 55 ++ .../UnderlineNav/UnderlineNav.test.tsx | 55 ++ src/deprecated/UnderlineNav/UnderlineNav.tsx | 117 +++ .../UnderlineNav/UnderlineNav.types.test.tsx | 2 +- src/deprecated/UnderlineNav/index.ts | 1 + src/deprecated/index.ts | 3 + src/drafts/index.ts | 2 - src/index.ts | 5 +- 35 files changed, 1139 insertions(+), 1871 deletions(-) rename src/{UnderlineNav2 => UnderlineNav}/LoadingCounter.tsx (100%) rename src/{UnderlineNav2 => UnderlineNav}/UnderlineNav.Item.stories.tsx (94%) rename src/{UnderlineNav2/UnderlineNav2.examples.stories.tsx => UnderlineNav/UnderlineNav.examples.stories.tsx} (99%) rename src/{UnderlineNav2/UnderlineNav2.interactions.stories.tsx => UnderlineNav/UnderlineNav.interactions.stories.tsx} (97%) rename src/{UnderlineNav2 => UnderlineNav}/UnderlineNavContext.tsx (100%) rename src/{UnderlineNav2 => UnderlineNav}/UnderlineNavItem.tsx (100%) delete mode 100644 src/UnderlineNav/__snapshots__/UnderlineNav.test.tsx.snap rename src/{UnderlineNav2 => UnderlineNav}/styles.ts (100%) rename src/{UnderlineNav2 => UnderlineNav}/types.ts (100%) delete mode 100644 src/UnderlineNav2/UnderlineNav.test.tsx delete mode 100644 src/UnderlineNav2/UnderlineNav.tsx delete mode 100644 src/UnderlineNav2/UnderlineNav2.docs.json delete mode 100644 src/UnderlineNav2/UnderlineNav2.features.stories.tsx delete mode 100644 src/UnderlineNav2/UnderlineNav2.stories.tsx delete mode 100644 src/UnderlineNav2/__snapshots__/UnderlineNav.test.tsx.snap delete mode 100644 src/UnderlineNav2/index.ts create mode 100644 src/deprecated/UnderlineNav/UnderlineNav.docs.json create mode 100644 src/deprecated/UnderlineNav/UnderlineNav.features.stories.tsx create mode 100644 src/deprecated/UnderlineNav/UnderlineNav.stories.tsx create mode 100644 src/deprecated/UnderlineNav/UnderlineNav.test.tsx create mode 100644 src/deprecated/UnderlineNav/UnderlineNav.tsx rename src/{ => deprecated}/UnderlineNav/UnderlineNav.types.test.tsx (91%) create mode 100644 src/deprecated/UnderlineNav/index.ts diff --git a/script/generate-e2e-tests.js b/script/generate-e2e-tests.js index 8111ce98f384..545e84bfe098 100644 --- a/script/generate-e2e-tests.js +++ b/script/generate-e2e-tests.js @@ -1228,35 +1228,35 @@ const components = new Map([ { stories: [ { - id: 'drafts-components-underlinenav-examples--profile-page', + id: 'components-underlinenav-examples--profile-page', name: 'Profile Page', }, { - id: 'drafts-components-underlinenav-examples--pull-request-page', + id: 'components-underlinenav-examples--pull-request-page', name: 'Pull Request Page', }, { - id: 'drafts-components-underlinenav-examples--repos-page', + id: 'components-underlinenav-examples--repos-page', name: 'Repos Page', }, { - id: 'drafts-components-underlinenav-features--counters-loading-state', + id: 'components-underlinenav-features--counters-loading-state', name: 'Counters Loading State', }, { - id: 'drafts-components-underlinenav-features--default', + id: 'components-underlinenav-features--default', name: 'Default', }, { - id: 'drafts-components-underlinenav-features--overflow-template', + id: 'components-underlinenav-features--overflow-template', name: 'Overflow Template', }, { - id: 'drafts-components-underlinenav-features--with-counter-labels', + id: 'components-underlinenav-features--with-counter-labels', name: 'With Counter Labels', }, { - id: 'drafts-components-underlinenav-features--with-icons', + id: 'components-underlinenav-features--with-icons', name: 'With Icons', }, ], diff --git a/src/PageHeader/PageHeader.examples.stories.tsx b/src/PageHeader/PageHeader.examples.stories.tsx index 5377cd5897ce..4b9c5c8d567e 100644 --- a/src/PageHeader/PageHeader.examples.stories.tsx +++ b/src/PageHeader/PageHeader.examples.stories.tsx @@ -14,7 +14,7 @@ import { import {PageHeader} from './PageHeader' import {Hidden} from '../Hidden' -import {UnderlineNav} from '../UnderlineNav2' +import {UnderlineNav} from '../UnderlineNav' const meta: Meta = { title: 'Drafts/Components/PageHeader/Examples', diff --git a/src/PageHeader/PageHeader.stories.tsx b/src/PageHeader/PageHeader.stories.tsx index 0e8b3ce35652..267a3802a07f 100644 --- a/src/PageHeader/PageHeader.stories.tsx +++ b/src/PageHeader/PageHeader.stories.tsx @@ -1,7 +1,7 @@ import React from 'react' import {Meta, Story} from '@storybook/react' import {Button, IconButton, Breadcrumbs, Link, Text, StateLabel, BranchName, Box} from '..' -import {UnderlineNav} from '../UnderlineNav2' +import {UnderlineNav} from '../UnderlineNav' import Label from '../Label' import { KebabHorizontalIcon, diff --git a/src/UnderlineNav2/LoadingCounter.tsx b/src/UnderlineNav/LoadingCounter.tsx similarity index 100% rename from src/UnderlineNav2/LoadingCounter.tsx rename to src/UnderlineNav/LoadingCounter.tsx diff --git a/src/UnderlineNav2/UnderlineNav.Item.stories.tsx b/src/UnderlineNav/UnderlineNav.Item.stories.tsx similarity index 94% rename from src/UnderlineNav2/UnderlineNav.Item.stories.tsx rename to src/UnderlineNav/UnderlineNav.Item.stories.tsx index 109fc3935896..1680fe134a06 100644 --- a/src/UnderlineNav2/UnderlineNav.Item.stories.tsx +++ b/src/UnderlineNav/UnderlineNav.Item.stories.tsx @@ -6,7 +6,7 @@ import {CodeIcon, GitPullRequestIcon, PeopleIcon} from '@primer/octicons-react' import {OcticonArgType} from '../utils/story-helpers' export default { - title: 'Drafts/Components/UnderlineNav/UnderlineNav.Item', + title: 'Components/UnderlineNav/UnderlineNav.Item', component: UnderlineNavItem, decorators: [ Story => { diff --git a/src/UnderlineNav/UnderlineNav.docs.json b/src/UnderlineNav/UnderlineNav.docs.json index 349c1d6b8a08..33f307eb029c 100644 --- a/src/UnderlineNav/UnderlineNav.docs.json +++ b/src/UnderlineNav/UnderlineNav.docs.json @@ -1,29 +1,34 @@ { - "id": "underline_nav", + "id": "drafts_underline_nav2", "name": "UnderlineNav", - "status": "alpha", - "a11yReviewed": false, + "status": "draft", + "a11yReviewed": true, "stories": [], "props": [ { - "name": "actions", - "type": "React.ReactNode", - "description": "Place another element, such as a button, to the opposite side of the navigation items." + "name": "afterSelect", + "type": "(event) => void", + "defaultValue": "", + "description": "The handler that gets called when a nav link child is selected" }, { - "name": "align", - "type": "'right'", - "description": "Use `right` to have navigation items aligned right." + "name": "aria-label", + "type": "string", + "defaultValue": "", + "description": "A unique name for the rendered 'nav' landmark. It will also be used to label the arrow\nbuttons that control the scroll behaviour on coarse pointer devices. (I.e.\n'Scroll ${aria-label} left/right')\n" }, { - "name": "full", - "type": "boolean", - "description": "Used to make navigation fill the width of the container." + "name": "children", + "type": "UnderlineNav.Item[]", + "defaultValue": "", + "required": true, + "description": "" }, { - "name": "aria-label", - "type": "string", - "description": "Used to set the `aria-label` on the top level `