Skip to content

Commit

Permalink
refactor: remove comments and render component on requested page
Browse files Browse the repository at this point in the history
  • Loading branch information
abanicaisse committed Jul 21, 2024
1 parent 24b88b9 commit 81fc886
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 133 deletions.
4 changes: 1 addition & 3 deletions app/components/CommentBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ type CommentProperties = {
commentContent: string;
pubDate: string;
likeCount: number;
// setLikeCount: (like: number) => number;
};

const CommentBox = ({
Expand All @@ -15,8 +14,7 @@ const CommentBox = ({
commentContent,
pubDate,
likeCount,
}: // setLikeCount,
CommentProperties) => {
}: CommentProperties) => {
return (
<div className="flex w-full max-w-[54rem] items-start gap-[0.75rem] self-stretch rounded-[.5rem] border-[.8px] border-solid border-[#cbd5e1] bg-white px-[1rem] py-[1.2rem] lg:py-4">
<img src={userPicUrl} alt="Profile Pic" className="h-10 w-10" />
Expand Down
28 changes: 28 additions & 0 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { MetaFunction } from "@remix-run/node";
import { Link } from "@remix-run/react";
import { useState } from "react";

import CommentBox from "~/components/CommentBox";
import { Button } from "~/components/ui/button";
import CardPlatform from "~/components/ui/card/card-platform";
import OtpAuth from "~/components/ui/otp/OtpAuth";
Expand All @@ -18,6 +19,23 @@ const handleSubmit = (values: Input[]) => {
console.log({ values });
};

const commentData: {
userPicUrl: string;
userDisplayName: string;
userTagName: string;
commentContent: string;
likeCount: number;
pubDate: string;
} = {
userPicUrl: "../public/images/comment-user-pic.svg",
userDisplayName: "Uduak Essien",
userTagName: "Uduess",
commentContent:
"Living a balanced lifestyle is essential. Focus on healthy eating, regular exercise, and mental well-being. A well-rounded lifestyle leads to a happier, more fulfilling life. Embrace positive habits and enjoy the journey.",
pubDate: `02 Jan, 2020 Wed 02:30pm`,
likeCount: 20,
};

export default function Index() {
const [openModal, setOpenModal] = useState(false);

Expand Down Expand Up @@ -59,6 +77,16 @@ export default function Index() {
containerClassName="max-w-[341px]"
/>
</div>
<div className="p-2">
<CommentBox
userPicUrl={commentData.userPicUrl}
userDisplayName={commentData.userDisplayName}
userTagName={commentData.userTagName}
commentContent={commentData.commentContent}
pubDate={commentData.pubDate}
likeCount={commentData.likeCount}
/>
</div>
<li>
<a
className="text-blue-700 underline visited:text-purple-900"
Expand Down
39 changes: 0 additions & 39 deletions app/routes/comments/route.tsx

This file was deleted.

Loading

0 comments on commit 81fc886

Please sign in to comment.