1
0
Fork 0

refactor(themes/signpost): make link self-contained component

This commit is contained in:
Vojtěch Mareš 2022-08-20 18:59:07 +02:00
parent 7b16d859d4
commit ee1daec03c
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
2 changed files with 33 additions and 22 deletions

View file

@ -1,4 +1,5 @@
import type SectionType from './../types/section';
import Link from './Link';
type Props = {
sections: SectionType[];
@ -14,28 +15,7 @@ const Grid = ({ sections }: Props) => (
<ul>
{section.items.map((item) => (
<li key={item.name} className="my-2">
<a
href={item.url}
target="_blank"
rel="noopener noreferrer"
className="
block
w-full
text-center
py-2
border-2
border-gray-400
rounded
hover:bg-gray-900
hover:border-gray-900
hover:text-white
transition
focus:ring-2
focus:ring-gray-600 text-gray-800
"
>
{item.name}
</a>
<Link url={item.url} title={item.name} />
</li>
))}
</ul>

View file

@ -0,0 +1,31 @@
type Props = {
url: string;
title: string;
};
const Link = ({ url, title }: Props) => (
<a
href={url}
target="_blank"
rel="noopener noreferrer"
className="
block
w-full
text-center
py-2
border-2
border-gray-400
rounded
hover:bg-gray-900
hover:border-gray-900
hover:text-white
transition
focus:ring-2
focus:ring-gray-600 text-gray-800
"
>
{title}
</a>
);
export default Link;