From 70cad1cba171418f1709a66c224f8b23b2b6872c Mon Sep 17 00:00:00 2001 From: gitdallas Date: Tue, 14 Mar 2023 12:37:24 -0500 Subject: [PATCH 1/2] chore(ApplicationLauncher): deprecate converting demos add import in md remove applauncher from pagestickysectionbreadcrumb example update examples after deprecating app launcher import missing semi colon address pr feedback remove applauncher from page/dashboard demos use composablemenu applauncher demo in masthead demo rebase markers rebase fix rebase fix fix test snap after rebase fixing dropdown imports after rebase fix applauncher search --- packages/react-core/src/components/index.ts | 1 - .../ComposableApplicationLauncher.tsx | 2 +- packages/react-core/src/demos/Masthead.md | 3 + packages/react-core/src/demos/Page.md | 7 - .../src/demos/examples/DashboardHeader.js | 37 +-- ...stheadWithUtilitiesAndUserDropdownMenu.tsx | 287 ++++++++++++++++-- .../Page/PageStickySectionBreadcrumb.tsx | 31 +- .../examples/Page/PageStickySectionGroup.tsx | 29 -- .../Page/PageStickySectionGroupAlternate.tsx | 29 -- .../PageStickySectionGroupUsingPageHeader.tsx | 29 -- .../ApplicationLauncher.tsx | 8 +- .../ApplicationLauncherContent.tsx | 0 .../ApplicationLauncherContext.ts | 0 .../ApplicationLauncherGroup.tsx | 2 +- .../ApplicationLauncherIcon.tsx | 0 .../ApplicationLauncherItem.tsx | 4 +- .../ApplicationLauncherItemContext.ts | 0 .../ApplicationLauncherSeparator.tsx | 2 +- .../ApplicationLauncherText.tsx | 0 .../__tests__/ApplicationLauncher.test.tsx | 3 +- .../ApplicationLauncherContent.test.tsx | 0 .../ApplicationLauncherGroup.test.tsx | 0 .../ApplicationLauncherIcon.test.tsx | 0 .../ApplicationLauncherSeparator.test.tsx | 2 +- .../ApplicationLauncherText.test.tsx | 0 .../ApplicationLauncherContent.test.tsx.snap | 0 .../ApplicationLauncherGroup.test.tsx.snap | 0 .../ApplicationLauncherIcon.test.tsx.snap | 0 ...ApplicationLauncherSeparator.test.tsx.snap | 0 .../ApplicationLauncherText.test.tsx.snap | 0 .../ApplicationLauncher.test.tsx.snap | 0 .../examples/ApplicationLauncher.md | 0 .../ApplicationLauncherAlignRight.tsx | 4 +- .../examples/ApplicationLauncherAlignTop.tsx | 3 +- .../examples/ApplicationLauncherBasic.tsx | 2 +- .../ApplicationLauncherCustomIcon.tsx | 2 +- .../examples/ApplicationLauncherDisabled.tsx | 2 +- .../ApplicationLauncherDocumentBody.tsx | 2 +- .../ApplicationLauncherFavoritesAndSearch.tsx | 2 +- .../ApplicationLauncherRouterLink.tsx | 2 +- .../ApplicationLauncherSectionsAndIcons.tsx | 2 +- .../examples/ApplicationLauncherTooltip.tsx | 2 +- .../examples/pf-logo-small.svg | 0 .../components/ApplicationLauncher/index.ts | 0 .../src/deprecated/components/index.ts | 3 +- packages/react-core/src/helpers/favorites.ts | 2 +- .../ApplicationLauncherFavoritesDemo.tsx | 2 +- 47 files changed, 294 insertions(+), 212 deletions(-) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/ApplicationLauncher.tsx (97%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/ApplicationLauncherContent.tsx (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/ApplicationLauncherContext.ts (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/ApplicationLauncherGroup.tsx (76%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/ApplicationLauncherIcon.tsx (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/ApplicationLauncherItem.tsx (96%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/ApplicationLauncherItemContext.ts (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/ApplicationLauncherSeparator.tsx (75%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/ApplicationLauncherText.tsx (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/ApplicationLauncher.test.tsx (95%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/Generated/ApplicationLauncherContent.test.tsx (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/Generated/ApplicationLauncherGroup.test.tsx (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/Generated/ApplicationLauncherIcon.test.tsx (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/Generated/ApplicationLauncherSeparator.test.tsx (83%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/Generated/ApplicationLauncherText.test.tsx (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncherContent.test.tsx.snap (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncherGroup.test.tsx.snap (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncherIcon.test.tsx.snap (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncherSeparator.test.tsx.snap (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncherText.test.tsx.snap (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/__tests__/__snapshots__/ApplicationLauncher.test.tsx.snap (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncher.md (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncherAlignRight.tsx (96%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncherAlignTop.tsx (86%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncherBasic.tsx (96%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncherCustomIcon.tsx (97%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncherDisabled.tsx (96%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncherDocumentBody.tsx (96%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncherFavoritesAndSearch.tsx (98%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncherRouterLink.tsx (96%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncherSectionsAndIcons.tsx (97%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/ApplicationLauncherTooltip.tsx (97%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/examples/pf-logo-small.svg (100%) rename packages/react-core/src/{ => deprecated}/components/ApplicationLauncher/index.ts (100%) diff --git a/packages/react-core/src/components/index.ts b/packages/react-core/src/components/index.ts index 7b0707bfb48..bdd2f2166e6 100644 --- a/packages/react-core/src/components/index.ts +++ b/packages/react-core/src/components/index.ts @@ -4,7 +4,6 @@ export * from './Accordion'; export * from './ActionList'; export * from './Alert'; export * from './AlertGroup'; -export * from './ApplicationLauncher'; export * from './Avatar'; export * from './BackToTop'; export * from './Backdrop'; diff --git a/packages/react-core/src/demos/ComposableMenu/examples/ComposableApplicationLauncher.tsx b/packages/react-core/src/demos/ComposableMenu/examples/ComposableApplicationLauncher.tsx index 763a69a6b37..9003472d57e 100644 --- a/packages/react-core/src/demos/ComposableMenu/examples/ComposableApplicationLauncher.tsx +++ b/packages/react-core/src/demos/ComposableMenu/examples/ComposableApplicationLauncher.tsx @@ -50,7 +50,7 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => { 'li > button:not(:disabled), li > a:not(:disabled), input:not(:disabled)' ); firstElement && (firstElement as HTMLElement).focus(); - setRefFullOptions(Array.from(menuRef.current.querySelectorAll('li:not(li[role=separator])'))); + setRefFullOptions(Array.from(menuRef.current.querySelectorAll('li:not(li[role=separator])>*:first-child'))); } }, 0); setIsOpen(!isOpen); diff --git a/packages/react-core/src/demos/Masthead.md b/packages/react-core/src/demos/Masthead.md index 8e2e1dbe55c..2bf3adef33f 100644 --- a/packages/react-core/src/demos/Masthead.md +++ b/packages/react-core/src/demos/Masthead.md @@ -7,6 +7,7 @@ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon'; import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon'; import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon'; import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon'; +import ThIcon from '@patternfly/react-icons/dist/esm/icons/th-icon'; import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon'; import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg'; import { @@ -16,6 +17,8 @@ DropdownItem as DropdownItemDeprecated, DropdownToggle, KebabToggle } from '@patternfly/react-core/deprecated'; +import pfIcon from './Card/pf-logo-small.svg'; +import { Link } from '@reach/router'; ## Demos diff --git a/packages/react-core/src/demos/Page.md b/packages/react-core/src/demos/Page.md index 00c890d826f..3f8183e2f4d 100644 --- a/packages/react-core/src/demos/Page.md +++ b/packages/react-core/src/demos/Page.md @@ -12,13 +12,6 @@ import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/ava import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon'; import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon'; import LightbulbIcon from '@patternfly/react-icons/dist/esm/icons/lightbulb-icon'; -import { -Dropdown as DropdownDeprecated, -DropdownGroup as DropdownGroupDeprecated, -DropdownItem as DropdownItemDeprecated, -DropdownToggle, -KebabToggle -} from '@patternfly/react-core/deprecated'; - All examples set the `isManagedSidebar` prop on the Page component to have the sidebar automatically close for smaller screen widths. You can also manually control this behavior by not adding the `isManagedSidebar` prop and instead: diff --git a/packages/react-core/src/demos/examples/DashboardHeader.js b/packages/react-core/src/demos/examples/DashboardHeader.js index f6a878e47f3..cd9b8142487 100644 --- a/packages/react-core/src/demos/examples/DashboardHeader.js +++ b/packages/react-core/src/demos/examples/DashboardHeader.js @@ -1,7 +1,5 @@ import React from 'react'; import { - ApplicationLauncher, - ApplicationLauncherItem, Avatar, Brand, Button, @@ -16,7 +14,7 @@ import { ToolbarContent, ToolbarGroup, ToolbarItem, - PageToggleButton + PageToggleButton, } from '@patternfly/react-core'; import { Dropdown as DropdownDeprecated, @@ -40,7 +38,6 @@ export default class DashboardHeader extends React.Component { isDropdownOpen: false, isKebabDropdownOpen: false, isFullKebabDropdownOpen: false, - isAppLauncherOpen: false, activeItem: 0 }; @@ -79,22 +76,10 @@ export default class DashboardHeader extends React.Component { isFullKebabDropdownOpen: !this.state.isFullKebabDropdownOpen }); }; - - this.onAppLauncherToggle = (_event, isAppLauncherOpen) => { - this.setState({ - isAppLauncherOpen - }); - }; - - this.onAppLauncherSelect = () => { - this.setState({ - isAppLauncherOpen: !this.state.isAppLauncherOpen - }); - }; } render() { - const { isDropdownOpen, isKebabDropdownOpen, isFullKebabDropdownOpen, isAppLauncherOpen } = this.state; + const { isDropdownOpen, isKebabDropdownOpen, isFullKebabDropdownOpen } = this.state; const { notificationBadge } = this.props; const kebabDropdownItems = [ @@ -133,15 +118,6 @@ export default class DashboardHeader extends React.Component { ]; - const appLauncherItems = [ - - Application 1 (anchor link) - , - alert('Clicked item 2')}> - Application 2 (button with onClick) - - ]; - const headerToolbar = ( @@ -163,15 +139,6 @@ export default class DashboardHeader extends React.Component { )} - - -