Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(language switcher) adds an optional text justified to the right #28

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions libs/react-components/src/lib/components/Header/Header.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ const meta = {
type: 'button',
},
],
announcementContent: (
<div>
<Icon className="fa-regular fa-bell" style={{ marginRight: '8px' }} />
<span>Important Announcement: </span>
<a
href="https://www.teradata.com"
style={{
marginLeft: '4px',
color: '#007bff',
textDecoration: 'underline',
}}
target="_blank"
rel="noreferrer"
>
Start free demo
</a>
</div>
),
},
} satisfies Meta<typeof Header>;

Expand Down
12 changes: 11 additions & 1 deletion libs/react-components/src/lib/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ interface HeaderProps {
* Secondary menu content for mobile view
*/
secondaryMenu?: { menuElement: JSX.Element; title: string };
/**
* Announcement content to be displayed in the header
*/
announcementContent?: React.ReactNode;
}

const Header: React.FC<HeaderProps> = ({
Expand All @@ -65,6 +69,7 @@ const Header: React.FC<HeaderProps> = ({
onLanguageChange,
selectedLanguage,
secondaryMenu,
announcementContent,
}) => {
const [activeNavItem, setActiveNavItem] = useState<number | null>(
navItems.findIndex((item) => item.active)
Expand Down Expand Up @@ -143,7 +148,12 @@ const Header: React.FC<HeaderProps> = ({
>
{/* Header utility bar with the language switcher begins */}
<section className={styles.headerUtility}>
<div className={styles.containerWide}>
<div
className={`${styles.containerWide} ${
announcementContent ? styles.containerWideWithAnnouncment : ''
}`}
>
{announcementContent && announcementContent}
<ul className={styles.headerUtilityNav}>
<li>
<a href="https://www.teradata.com/" target="_self">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ body {
align-items: center;
}

.headerUtility .containerWideWithAnnouncment {
justify-content: space-between;
}

.headerUtility ul {
margin: 0;
padding: 0;
Expand Down
Loading