From 259b0cc9474777b30f5ad9984cee6ca363dfdfa2 Mon Sep 17 00:00:00 2001 From: Manuel Salazar Date: Tue, 27 Aug 2024 08:41:13 -0700 Subject: [PATCH 1/3] feat(language switcher) adds an optional text justified to the right --- .../lib/components/Header/Header.stories.tsx | 8 ++++++ .../src/lib/components/Header/index.tsx | 25 +++++++++++++++++++ .../lib/components/Header/styles.module.scss | 14 ++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/libs/react-components/src/lib/components/Header/Header.stories.tsx b/libs/react-components/src/lib/components/Header/Header.stories.tsx index a1e156f..8cb7887 100644 --- a/libs/react-components/src/lib/components/Header/Header.stories.tsx +++ b/libs/react-components/src/lib/components/Header/Header.stories.tsx @@ -93,6 +93,14 @@ const meta = { type: 'button', }, ], + announcementContent: { + icon: , + text: 'Get started with Teradata today.', + link: { + url: 'https://www.teradata.com/getting-started/demos/clearscape-analytics', + label: 'Start free demo', + }, + }, }, } satisfies Meta; diff --git a/libs/react-components/src/lib/components/Header/index.tsx b/libs/react-components/src/lib/components/Header/index.tsx index 0bc7954..a4e48c0 100644 --- a/libs/react-components/src/lib/components/Header/index.tsx +++ b/libs/react-components/src/lib/components/Header/index.tsx @@ -54,6 +54,14 @@ interface HeaderProps { * Secondary menu content for mobile view */ secondaryMenu?: { menuElement: JSX.Element; title: string }; + /** + * Announcement content to be displayed in the header + */ + announcementContent?: { + icon: JSX.Element; + text: string; + link?: { url: string; label: string }; + }; } const Header: React.FC = ({ @@ -65,6 +73,7 @@ const Header: React.FC = ({ onLanguageChange, selectedLanguage, secondaryMenu, + announcementContent, }) => { const [activeNavItem, setActiveNavItem] = useState( navItems.findIndex((item) => item.active) @@ -144,6 +153,22 @@ const Header: React.FC = ({ {/* Header utility bar with the language switcher begins */}
+ {announcementContent && ( +
+ {announcementContent.icon && announcementContent.icon} + {announcementContent.text} + {announcementContent.link && ( + + {announcementContent.link.label} + + )} +
+ )}