1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 06:01:17 -04:00

add page stats typings

This commit is contained in:
2022-06-30 09:17:12 -04:00
parent ae2cb50cbe
commit 7da0a713a4
9 changed files with 80 additions and 87 deletions

View File

@@ -56,7 +56,7 @@ const Tag = styled("span", {
export type NoteMetaProps = Pick<NoteFrontMatter, "slug" | "date" | "title" | "htmlTitle" | "tags">;
const NoteMeta = ({ slug, date, title, htmlTitle, tags = [] }: NoteMetaProps) => {
const NoteMeta = ({ slug, date, title, htmlTitle, tags }: NoteMetaProps) => {
return (
<>
<Wrapper>
@@ -68,21 +68,17 @@ const NoteMeta = ({ slug, date, title, htmlTitle, tags = [] }: NoteMetaProps) =>
}}
underline={false}
>
<span>
<Icon as={DateIcon} />
</span>
<Icon as={DateIcon} />
<Time date={date} format="MMMM D, YYYY" />
</MetaLink>
</MetaItem>
{tags.length > 0 && (
{tags && (
<MetaItem>
<span title="Tags">
<Icon as={TagIcon} />
</span>
<Icon as={TagIcon} />
<TagsList>
{tags.map((tag) => (
<Tag key={tag} title={tag}>
<Tag key={tag} title={tag} aria-label={`Tagged with ${tag}`}>
{tag}
</Tag>
))}
@@ -96,9 +92,7 @@ const NoteMeta = ({ slug, date, title, htmlTitle, tags = [] }: NoteMetaProps) =>
title={`Edit "${title}" on GitHub`}
underline={false}
>
<span>
<Icon as={EditIcon} />
</span>
<Icon as={EditIcon} />
<span>Improve This Post</span>
</MetaLink>
</MetaItem>
@@ -106,12 +100,13 @@ const NoteMeta = ({ slug, date, title, htmlTitle, tags = [] }: NoteMetaProps) =>
{/* only count hits on production site */}
{process.env.NEXT_PUBLIC_VERCEL_ENV === "production" && (
<MetaItem
// fix potential layout shift when number of hits loads
css={{ minWidth: "7em", marginRight: 0 }}
css={{
// fix potential layout shift when number of hits loads
minWidth: "7em",
marginRight: 0,
}}
>
<span>
<Icon as={ViewsIcon} />
</span>
<Icon as={ViewsIcon} />
<HitCounter slug={`notes/${slug}`} />
</MetaItem>
)}