[core][xs]: fix Navbar title not showing

This commit is contained in:
Ola Rubaj
2023-10-09 19:32:42 +02:00
parent c5e17810af
commit c63551a54e
4 changed files with 172 additions and 139 deletions

View File

@@ -0,0 +1,5 @@
---
'@portaljs/core': patch
---
Fix Navbar version not showing.

View File

@@ -96,6 +96,7 @@ export const Layout: React.FC<Props> = ({
social={nav.social}
defaultTheme={theme.defaultTheme}
themeToggleIcon={theme.themeToggleIcon}
version={nav.version}
>
{showSidebar && <SiteToc currentPath={urlPath} nav={siteMap} />}
</Nav>

View File

@@ -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',
},
};

View File

@@ -18,9 +18,9 @@ export const NavTitle: React.FC<Props> = ({ title, logo, version }) => {
)}
{title && <span>{title}</span>}
{version && (
<div className="mx-2 rounded-full border border-slate-500 py-1 px-3 text-xs text-slate-500">
<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}
</div>
</span>
)}
</Link>
);