-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core][xs]: fix Navbar title not showing
- Loading branch information
Showing
4 changed files
with
172 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@portaljs/core': patch | ||
--- | ||
|
||
Fix Navbar version not showing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { NavTitle } from './NavTitle'; | ||
|
||
const meta: Meta<typeof NavTitle> = { | ||
component: NavTitle, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof NavTitle>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
title: 'Title', | ||
logo: 'https://via.placeholder.com/50', | ||
}, | ||
}; | ||
|
||
export const WithVersion: Story = { | ||
args: { | ||
title: 'Title', | ||
logo: 'https://via.placeholder.com/50', | ||
version: 'Alpha', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import Link from "next/link.js"; | ||
|
||
interface Props { | ||
title: string; | ||
logo?: string; | ||
version?: string; | ||
title: string; | ||
logo?: string; | ||
version?: string; | ||
} | ||
|
||
export const NavTitle: React.FC<Props> = ({ title, logo, version }) => { | ||
return ( | ||
<Link | ||
href="/" | ||
aria-label="Home page" | ||
className="flex items-center font-extrabold text-xl sm:text-2xl text-slate-900 dark:text-white" | ||
> | ||
{logo && ( | ||
<img src={logo} alt={title} className="nav-logo mr-1 fill-white" /> | ||
)} | ||
{title && <span>{title}</span>} | ||
{version && ( | ||
<div className="mx-2 rounded-full border border-slate-500 py-1 px-3 text-xs text-slate-500"> | ||
{version} | ||
</div> | ||
)} | ||
</Link> | ||
); | ||
return ( | ||
<Link | ||
href="/" | ||
aria-label="Home page" | ||
className="flex items-center font-extrabold text-xl sm:text-2xl text-slate-900 dark:text-white" | ||
> | ||
{logo && ( | ||
<img src={logo} alt={title} className="nav-logo mr-1 fill-white" /> | ||
)} | ||
{title && <span>{title}</span>} | ||
{version && ( | ||
<span className="inline-flex items-center rounded-full bg-gray-50 ml-2 px-2 py-1 text-xs font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10"> | ||
{version} | ||
</span> | ||
)} | ||
</Link> | ||
); | ||
}; |