From 7c1de46462f4dbbbe70a50f82439c6e280de1683 Mon Sep 17 00:00:00 2001 From: satnaing Date: Thu, 26 Jan 2023 22:54:24 +0630 Subject: [PATCH] refactor: update frontmatter type and change React to Astro --- src/components/Card.astro | 40 +++++++++++++++++++++++++++++++++++++++ src/components/Card.tsx | 31 ------------------------------ 2 files changed, 40 insertions(+), 31 deletions(-) create mode 100644 src/components/Card.astro delete mode 100644 src/components/Card.tsx diff --git a/src/components/Card.astro b/src/components/Card.astro new file mode 100644 index 0000000..e41b36c --- /dev/null +++ b/src/components/Card.astro @@ -0,0 +1,40 @@ +--- +import Datetime from "./Datetime"; +import type { BlogFrontmatter } from "@content/schemas"; + +export interface Props { + href?: string; + frontmatter: BlogFrontmatter; + secHeading?: boolean; +} + +const { href, frontmatter, secHeading } = Astro.props; + +const { title, publishDatetime, description } = frontmatter; +--- + +
  • + + { + secHeading ? ( +

    {title}

    + ) : ( +

    {title}

    + ) + } +
    + +

    {description}

    +
  • + + diff --git a/src/components/Card.tsx b/src/components/Card.tsx deleted file mode 100644 index 446a6ab..0000000 --- a/src/components/Card.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import Datetime from "./Datetime"; -import type { Frontmatter } from "src/types"; - -export interface Props { - href?: string; - post: Frontmatter; - secHeading?: boolean; -} - -const styles = { - cardContainer: "my-6", - titleLink: - "text-skin-accent font-medium text-lg underline-offset-4 decoration-dashed focus-visible:no-underline focus-visible:underline-offset-0 inline-block", - titleHeading: "font-medium text-lg decoration-dashed hover:underline", -}; - -export default function Card({ href, post, secHeading = true }: Props) { - return ( -
  • - - {secHeading ? ( -

    {post.title}

    - ) : ( -

    {post.title}

    - )} -
    - -

    {post.description}

    -
  • - ); -}