🎨 [enhancement] Added optional title functionality to Tags.astro

This commit is contained in:
Liron Abutbul
2023-06-09 07:23:35 +03:00
committed by GitHub
parent e78c5881af
commit cf0d0cd028

View File

@ -7,17 +7,22 @@ import type { Post } from '~/types';
export interface Props { export interface Props {
tags: Post['tags']; tags: Post['tags'];
class?: string; class?: string;
title?: string | undefined;
} }
const { tags, class: className = 'text-sm' } = Astro.props; const { tags, class: className = 'text-sm', title = undefined } = Astro.props;
--- ---
{ {
tags && Array.isArray(tags) && ( tags && Array.isArray(tags) && (
<>
<>
{header !== undefined && <span class="align-super font-normal underline underline-offset-4 decoration-2 dark:text-slate-400">{header}</span>}
</>
<ul class={className}> <ul class={className}>
{tags.map((tag) => ( {tags.map((tag) => (
<li class="bg-gray-100 dark:bg-slate-700 inline-block mr-2 mb-2 py-0.5 px-2 lowercase font-medium"> <li class="bg-gray-100 dark:bg-slate-700 inline-block mr-2 mb-2 py-0.5 px-2 lowercase font-medium">
{BLOG?.tag?.disabled ? ( {BLOG?.tag?.disabled || PORTFOLIO?.tag?.disabled ? (
tag tag
) : ( ) : (
<a <a
@ -30,5 +35,6 @@ const { tags, class: className = 'text-sm' } = Astro.props;
</li> </li>
))} ))}
</ul> </ul>
</>
) )
} }