[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,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

@@ -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>
);
};