m4xshen / example-blog

0 stars 0 forks source link

A Test Post #28

Closed m4xshen closed 5 months ago

m4xshen commented 5 months ago

This is just a test post........

m4xshen commented 5 months ago

First!

m4xshen commented 5 months ago

how about this

m4xshen commented 5 months ago

Maybe you can also write code here ...?

import { Avatar, Link } from '@nextui-org/react';
import { getComments } from '@/utils/post';
import MarkdownWrapper from '../MarkdownWrapper';

export default async function Comments({ number }: { number: number }) {
  const comments = await getComments(number);

  if (!comments.length) {
    return <div>There are no comments yet.</div>;
  }

  return comments.map((comment) => (
    <div key={comment.id} className="flex gap-3">
      <Avatar src={comment.user?.avatar_url} className="flex-shrink-0" />
      <div className="grid w-full gap-3">
        <div className="flex items-center gap-3">
          <Link href={comment.user?.html_url}>@{comment.user?.login}</Link>
          <span className="text-sm">
            {new Date(comment.created_at).toDateString()}
          </span>
        </div>
        <div className="prose rounded-xl border border-secondary p-5 dark:prose-invert">
          <MarkdownWrapper>{comment.body}</MarkdownWrapper>
        </div>
      </div>
    </div>
  ));
}

Let's try this.

m4xshen commented 5 months ago

Looks great...

h1

h2