Skip to content

Commit

Permalink
feat(components): implement PublishedDate component
Browse files Browse the repository at this point in the history
  • Loading branch information
kubosho committed Mar 26, 2023
1 parent e2b9a16 commit 776070e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/components/PublishedDate.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
import { formatISOString, formatYYMMDDString } from '../entry/date';
import './PublishedDate.css';
interface Props {
publishedAt: number;
className?: string;
}
const { publishedAt, className } = Astro.props;
const classNames = !className ? 'PublishedDate' : `PublishedDate ${className}}`;
const dateTime = formatISOString(publishedAt);
const dateString = formatYYMMDDString(publishedAt);
---

<time class={classNames} datetime={dateTime}>
{dateString}
</time>
4 changes: 4 additions & 0 deletions src/components/PublishedDate.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PublishedDate {
font-size: var(--font-size-note);
line-height: var(--line-height-note);
}

0 comments on commit 776070e

Please sign in to comment.