From 1c218d4e0583ff80b0d91b7f0f4fc86d744b2844 Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Fri, 3 Jan 2025 09:59:38 -0500 Subject: [PATCH 1/4] Replace deprecated AdminHero with Hero --- .../pages/CommunityDashboardPage/CommunityDashboardPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/src/pages/CommunityDashboardPage/CommunityDashboardPage.tsx b/apps/web/src/pages/CommunityDashboardPage/CommunityDashboardPage.tsx index 89804226f35..b929996f6a5 100644 --- a/apps/web/src/pages/CommunityDashboardPage/CommunityDashboardPage.tsx +++ b/apps/web/src/pages/CommunityDashboardPage/CommunityDashboardPage.tsx @@ -39,7 +39,7 @@ import SEO from "~/components/SEO/SEO"; import { getFullNameHtml } from "~/utils/nameUtils"; import useRoutes from "~/hooks/useRoutes"; import AdminContentWrapper from "~/components/AdminContentWrapper/AdminContentWrapper"; -import AdminHero from "~/components/HeroDeprecated/AdminHero"; +import Hero from "~/components/Hero"; import RequireAuth from "~/components/RequireAuth/RequireAuth"; import adminMessages from "~/messages/adminMessages"; import permissionConstants from "~/constants/permissionConstants"; @@ -218,7 +218,7 @@ export const DashboardPage = ({ currentUser }: DashboardPageProps) => { title={intl.formatMessage(pageTitles.dashboard)} description={intl.formatMessage(subTitle)} /> - Date: Fri, 3 Jan 2025 10:01:42 -0500 Subject: [PATCH 2/4] Remove AdminHero story --- .../HeroDeprecated/AdminHero.stories.tsx | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 apps/web/src/components/HeroDeprecated/AdminHero.stories.tsx diff --git a/apps/web/src/components/HeroDeprecated/AdminHero.stories.tsx b/apps/web/src/components/HeroDeprecated/AdminHero.stories.tsx deleted file mode 100644 index becea9cb3e9..00000000000 --- a/apps/web/src/components/HeroDeprecated/AdminHero.stories.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { StoryFn } from "@storybook/react"; - -import { allModes } from "@gc-digital-talent/storybook-helpers"; - -import AdminHero from "./AdminHero"; - -const navItems = [ - { - label: "Home", - url: "/home", - }, - { - label: "One", - url: "/one", - }, - { - label: "Two", - url: "/two", - }, - { - label: "Three", - url: "/three", - }, -]; - -export default { - component: AdminHero, - parameters: { - defaultPath: { - path: "/:index", - initialEntries: [`/one`], - }, - chromatic: { - modes: { - light: allModes.light, - "light mobile": allModes["light mobile"], - dark: allModes.dark, - }, - }, - }, -}; - -const Template: StoryFn = (args) => ; - -export const Default = Template.bind({}); -Default.args = { - subtitle: "A subtitle for the current page.", -}; - -export const SubNav = Template.bind({}); -SubNav.args = { - nav: { - mode: "subNav", - items: navItems, - }, -}; - -export const Breadcrumbs = Template.bind({}); -Breadcrumbs.args = { - nav: { - mode: "crumbs", - items: navItems, - }, -}; From cfbc9a52e2bc4bb8e99bdc56b28753cfb697e370 Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Fri, 3 Jan 2025 10:01:51 -0500 Subject: [PATCH 3/4] Remove AdminHero component --- .../components/HeroDeprecated/AdminHero.tsx | 73 ------------------- 1 file changed, 73 deletions(-) delete mode 100644 apps/web/src/components/HeroDeprecated/AdminHero.tsx diff --git a/apps/web/src/components/HeroDeprecated/AdminHero.tsx b/apps/web/src/components/HeroDeprecated/AdminHero.tsx deleted file mode 100644 index aafbca42674..00000000000 --- a/apps/web/src/components/HeroDeprecated/AdminHero.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import { ReactNode, useEffect, useRef } from "react"; - -import { Flourish, Heading, type HeadingRef } from "@gc-digital-talent/ui"; - -import AdminSubNav, { AdminSubNavProps } from "./AdminSubNav"; - -interface AdminHeroProps { - title: ReactNode; - subtitle?: ReactNode; - nav?: AdminSubNavProps; - contentRight?: ReactNode; - children?: ReactNode; -} - -const AdminHero = ({ - title, - subtitle, - nav, - contentRight, - children, -}: AdminHeroProps) => { - const headingRef = useRef(null); - - // Focus heading on page load for assistive technologies - useEffect(() => { - if (headingRef.current) { - headingRef.current.focus(); - } - }, []); - - return ( -
-
-
-
-
- - {title} - - {subtitle && ( -

- {subtitle} -

- )} -
-
{contentRight}
-
- {children} -
-
- {nav ? : } -
- ); -}; - -export default AdminHero; From da1df9f02526339f207c91c5486de6a86aa62a54 Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Fri, 3 Jan 2025 10:02:07 -0500 Subject: [PATCH 4/4] Remove AdminSubNav component --- .../components/HeroDeprecated/AdminSubNav.tsx | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 apps/web/src/components/HeroDeprecated/AdminSubNav.tsx diff --git a/apps/web/src/components/HeroDeprecated/AdminSubNav.tsx b/apps/web/src/components/HeroDeprecated/AdminSubNav.tsx deleted file mode 100644 index c953cfe373c..00000000000 --- a/apps/web/src/components/HeroDeprecated/AdminSubNav.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { ReactNode } from "react"; - -import { Breadcrumbs, NavTabs } from "@gc-digital-talent/ui"; - -interface NavItem { - label: ReactNode; - url: string; -} - -type NavMode = "crumbs" | "subNav"; - -export interface AdminSubNavProps { - mode: NavMode; - items: NavItem[]; -} - -const AdminSubNav = ({ mode, items }: AdminSubNavProps) => { - if (mode === "crumbs") { - return ; - } - - return ( - - - {items.map((item) => ( - - {item.label} - - ))} - - - ); -}; - -export default AdminSubNav;