2023-09-26 14:27:38 +08:00
|
|
|
---
|
|
|
|
import {formatDateToYYYYMMDD} from "../utils/date-utils";
|
|
|
|
import { Icon } from 'astro-icon/components';
|
2023-10-06 02:53:47 +08:00
|
|
|
import {i18n} from "../i18n/translation";
|
|
|
|
import I18nKey from "../i18n/i18nKey";
|
2023-09-26 14:27:38 +08:00
|
|
|
|
|
|
|
interface Props {
|
|
|
|
class: string;
|
|
|
|
pubDate: Date;
|
|
|
|
tags: string[];
|
|
|
|
categories: string[];
|
|
|
|
}
|
|
|
|
const {pubDate, tags, categories} = Astro.props;
|
|
|
|
const className = Astro.props.class;
|
|
|
|
---
|
|
|
|
|
2023-10-16 22:45:30 +08:00
|
|
|
<div class:list={["flex flex-wrap text-neutral-500 dark:text-neutral-400 items-center gap-4 gap-x-4 gap-y-2", className]}>
|
2023-09-26 14:27:38 +08:00
|
|
|
<!-- publish date -->
|
|
|
|
<div class="flex items-center">
|
|
|
|
<div class="meta-icon"
|
|
|
|
>
|
|
|
|
<Icon name="material-symbols:calendar-today-outline-rounded" class="text-xl"></Icon>
|
|
|
|
</div>
|
|
|
|
<span class="text-black/50 dark:text-white/50 text-sm font-medium">{formatDateToYYYYMMDD(pubDate)}</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- categories -->
|
|
|
|
<div class="flex items-center">
|
|
|
|
<div class="meta-icon"
|
|
|
|
>
|
|
|
|
<Icon name="material-symbols:menu-rounded" class="text-xl"></Icon>
|
|
|
|
</div>
|
2023-10-18 01:25:31 +08:00
|
|
|
<div class="flex flex-row flex-nowrap">
|
2023-09-26 14:27:38 +08:00
|
|
|
{categories && categories.map(category => <div
|
|
|
|
class="with-divider"
|
|
|
|
>
|
|
|
|
<a href=`/archive/category/${category}`
|
2023-10-04 18:02:00 +08:00
|
|
|
class="link transition text-black/50 dark:text-white/50 text-sm font-medium
|
2023-10-18 01:25:31 +08:00
|
|
|
hover:text-[var(--primary)] dark:hover:text-[var(--primary)] whitespace-nowrap">
|
2023-09-26 14:27:38 +08:00
|
|
|
{category}
|
|
|
|
</a>
|
|
|
|
</div>)}
|
2023-10-06 02:53:47 +08:00
|
|
|
{!categories && <div class="transition text-black/50 dark:text-white/50 text-sm font-medium">{i18n(I18nKey.uncategorized)}</div>}
|
2023-09-26 14:27:38 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- tags -->
|
|
|
|
<div class="flex items-center">
|
|
|
|
<div class="meta-icon"
|
|
|
|
>
|
|
|
|
<Icon name="material-symbols:tag-rounded" class="text-xl"></Icon>
|
|
|
|
</div>
|
2023-10-18 01:25:31 +08:00
|
|
|
<div class="flex flex-row flex-nowrap">
|
2023-10-06 02:53:47 +08:00
|
|
|
{tags && tags.map(tag => <div
|
2023-09-26 14:27:38 +08:00
|
|
|
class="with-divider"
|
|
|
|
>
|
|
|
|
<a href=`/archive/tag/${tag}`
|
2023-10-04 18:02:00 +08:00
|
|
|
class="link transition text-black/50 dark:text-white/50 text-sm font-medium
|
2023-10-18 01:25:31 +08:00
|
|
|
hover:text-[var(--primary)] dark:hover:text-[var(--primary)] whitespace-nowrap">
|
2023-09-26 14:27:38 +08:00
|
|
|
{tag}
|
|
|
|
</a>
|
|
|
|
</div>)}
|
2023-10-06 02:53:47 +08:00
|
|
|
{!tags && <div class="transition text-black/50 dark:text-white/50 text-sm font-medium">{i18n(I18nKey.noTags)}</div>}
|
2023-09-26 14:27:38 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
@tailwind components;
|
|
|
|
|
|
|
|
@layer components {
|
|
|
|
.meta-icon {
|
|
|
|
@apply w-8 h-8 transition rounded-md flex items-center justify-center bg-[var(--btn-regular-bg)]
|
2023-10-02 01:52:08 +08:00
|
|
|
text-[var(--btn-content)] mr-2
|
2023-09-26 14:27:38 +08:00
|
|
|
}
|
|
|
|
.with-divider {
|
|
|
|
@apply before:content-['/'] before:mx-[6px] before:text-[var(--meta-divider)] before:text-sm
|
|
|
|
before:font-medium before:first-of-type:hidden before:transition
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|