Skip to main content

Layout & Structure

Rearrange, add, or remove UI elements.

Adding Elements

Add Custom Header

// File: threaded-comment-section.tsx

return (
  <div>
    {/* Add custom header */}
    <div className="flex justify-between items-center mb-4">
      <h2>Discussion ({totalComments} comments)</h2>
      <button onClick={sortBy}>Sort</button>
    </div>

    <NewCommentForm />
    <CommentsFeed />
  </div>
);
return (
  <div>
    <NewCommentForm />
    <CommentsFeed />

    {/* Add footer */}
    <footer className="text-center text-gray-500 mt-4">
      Powered by Replyke
    </footer>
  </div>
);

Removing Elements

Remove Vote Buttons

// File: single-comment.tsx

return (
  <div>
    <AuthorInfo />
    <CommentBody />
    {/* <VoteButtons /> */}  {/* Removed */}
    <ReplyButton />
  </div>
);

Remove Reply Functionality

// File: single-comment.tsx

return (
  <div>
    <AuthorInfo />
    <CommentBody />
    <VoteButtons />
    {/* <ReplyButton /> */}  {/* Removed */}
  </div>
);

Rearranging Elements

Move Reply Button Above Comment Body

// Before
<AuthorInfo />
<CommentBody />
<ReplyButton />

// After
<AuthorInfo />
<ReplyButton />  {/* Moved up */}
<CommentBody />

Modifying Spacing

Inline Styles:
<div style={{ padding: '24px' }}>  {/* Was 16px */}
Tailwind:
<div className="p-6">  {/* Was p-4 */}

Next Steps