[core/Footer][xs]: minor style fixes

This commit is contained in:
Ola Rubaj
2023-10-05 12:11:37 +02:00
parent 3ae685253b
commit 8d74fd9844
5 changed files with 125 additions and 54 deletions

View File

@@ -0,0 +1,5 @@
---
'@portaljs/core': patch
---
Minor footer style fixes.

View File

@@ -0,0 +1,47 @@
import type { Meta, StoryObj } from '@storybook/react';
import { Footer } from './Footer';
const meta: Meta<typeof Footer> = {
component: Footer,
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof Footer>;
export const Basic: Story = {
args: {
author: {
name: "John Doe",
}
},
};
export const Links: Story = {
args: {
links: [
{ name: "Link A", href: "#" },
{ name: "Link B", href: "#" }
],
author: {
name: "John Doe",
}
},
};
export const Logo: Story = {
args: {
links: [
{ name: "Link A", href: "#" },
{ name: "Link B", href: "#" }
],
author: {
name: "John Doe",
logo: "https://via.placeholder.com/150"
}
},
};

View File

@@ -3,59 +3,77 @@ import Link from "next/link.js";
import { AuthorConfig, NavLink } from "../types"; import { AuthorConfig, NavLink } from "../types";
interface Props { interface Props {
links: Array<NavLink>; author: AuthorConfig;
author: AuthorConfig; links?: Array<NavLink>;
} }
// TODO replace this with some nice tailwindui footer
export const Footer: React.FC<Props> = ({ links, author }) => { export const Footer: React.FC<Props> = ({ links, author }) => {
return ( return (
<footer className="bg-background dark:bg-background-dark prose dark:prose-invert max-w-none flex flex-col items-center justify-center w-full h-auto pt-10 pb-20"> <footer className="bg-background dark:bg-background-dark text-primary dark:text-primary-dark pt-16 pb-20 px-14 flex flex-col items-center justify-center gap-3">
<div className="flex w-full flex-wrap justify-center"> {links && (
{links.map((item) => ( <div className="flex w-full flex-wrap justify-center mb-2">
<Link {links.map((item) => (
key={item.href} <Link
href={item.href} key={item.href}
className="inline-flex items-center mx-4 px-1 pt-1 font-regular hover:text-slate-300 no-underline" href={item.href}
> className="inline-flex items-center mx-4 px-1 py-1 text-black hover:text-primary dark:text-white hover:dark:text-primary-dark no-underline font-semibold"
{/* TODO aria-current={item.current ? "page" : undefined} */} >
{item.name} {/* TODO aria-current={item.current ? "page" : undefined} */}
</Link> {item.name}
))} </Link>
</div> ))}
<p className="flex items-center justify-center"> </div>
Created by )}
<a <p className="flex items-center justify-center gap-2">
href={author.url} <span>Created by</span>
target="_blank" {author.url ? (
rel="noopener noreferrer" <a
className="flex items-center no-underline" href={author.url}
> target="_blank"
{author.logo && ( rel="noopener noreferrer"
<img className="flex items-center gap-1 no-underline font-semibold text-black dark:text-white"
src={author.logo} >
alt={author.name} {author.logo && (
className="my-0 mx-1 h-6 block" <img
/> src={author.logo}
)} alt="Logo"
{author.name} className="h-6 block"
</a> />
</p> )}
<p className="flex items-center justify-center"> <span>{author.name}</span>
Made with </a>
<a ) : (
href="https://flowershow.app/" <span
target="_blank" className="flex items-center gap-1 no-underline font-semibold text-black dark:text-white"
rel="noopener noreferrer" >
className="flex items-center no-underline" {author.logo && (
> <img
<img src={author.logo}
src="https://flowershow.app/images/logo.svg" alt={author.name}
alt="Flowershow" className="h-6 block"
className="my-0 mx-1 h-6 block" />
/> )}
Flowershow <span>{author.name}</span>
</a> </span>
</p> )}
</footer> </p>
); <p className="flex items-center justify-center gap-1">
<span>Made with</span>
<a
href="https://flowershow.app/"
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-1 no-underline font-semibold text-black dark:text-white"
>
<img
src="https://flowershow.app/images/logo.svg"
alt="Logo"
className="h-6 block"
/>
<span>Flowershow</span>
</a>
</p>
</footer>
);
}; };

View File

@@ -7,6 +7,7 @@ export {
TocSection, TocSection,
EditThisPage, EditThisPage,
useTableOfContents, useTableOfContents,
Footer
} from "./Layout"; } from "./Layout";
export { Pre } from "./Pre"; export { Pre } from "./Pre";
export { CustomLink } from "./Base/CustomLink"; export { CustomLink } from "./Base/CustomLink";

View File

@@ -9,8 +9,8 @@ export interface NavLink {
export interface AuthorConfig { export interface AuthorConfig {
name: string; name: string;
url: string; url?: string;
logo: string; logo?: string;
} }
// social // social