@@ -5,7 +5,7 @@ import { ImCancelCircle } from 'react-icons/im';
55import { confirmAlert } from 'react-confirm-alert' ;
66import { toast } from 'react-toastify' ;
77
8- const Post = ( { post } ) => {
8+ const Post = ( { post, index } ) => {
99 const { _id, postName, postDescription, postTags, postCategory, postAuthor, postAuthorImg, postDateTime } = post ;
1010
1111 const deleteConfirmation = ( _id ) => {
@@ -72,26 +72,62 @@ const Post = ({ post }) => {
7272 <input type="checkbox" className="checkbox" />
7373 </label>
7474 </th> */ }
75- < th > 1 </ th >
75+ < th > { index + 1 } </ th >
7676 < td >
77- < div className = "flex items-center space-x-3" >
78- < div className = "avatar" >
79- < div className = "mask mask-squircle w-12 h-12" >
80- < img src = { postAuthorImg } alt = "Avatar Tailwind CSS Component" />
77+ < article >
78+ < div class = "flex items-start p-6" >
79+ < a href = "" class = "block shrink-0" >
80+ < img
81+ src = { postAuthorImg }
82+ alt = "User Avatar"
83+ class = "object-cover rounded-lg h-14 w-14"
84+ />
85+ </ a >
86+
87+ < div class = "ml-4" >
88+ < strong class = "font-medium sm:text-lg" >
89+ < a href = "" class = "hover:underline" > { postName } </ a >
90+ </ strong >
91+
92+ < p class = "text-sm text-gray-700 line-clamp-2" >
93+ { postDescription ?. length > 150 ? postDescription . substring ( 0 , 120 ) + '...' : postDescription }
94+ </ p >
95+
96+ < div class = "mt-2 sm:flex sm:items-center sm:gap-2" >
97+ < div class = "flex items-center text-gray-500" >
98+ < svg
99+ xmlns = "http://www.w3.org/2000/svg"
100+ class = "w-4 h-4"
101+ fill = "none"
102+ viewBox = "0 0 24 24"
103+ stroke = "currentColor"
104+ stroke-width = "2"
105+ >
106+ < path
107+ stroke-linecap = "round"
108+ stroke-linejoin = "round"
109+ d = "M17 8h2a2 2 0 012 2v6a2 2 0 01-2 2h-2v4l-4-4H9a1.994 1.994 0 01-1.414-.586m0 0L11 14h4a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2v4l.586-.586z"
110+ />
111+ </ svg >
112+ < p class = "ml-1 text-xs" > { postCategory } </ p >
113+ </ div >
114+
115+ < span class = "hidden sm:block" aria-hidden = "true" > ·</ span >
116+
117+ < p class = "hidden sm:block sm:text-xs sm:text-gray-500" >
118+ { postAuthor ?. split ( '@' ) [ 0 ] }
119+ </ p >
120+
121+ < span class = "hidden sm:block" aria-hidden = "true" > ·</ span >
122+
123+ < p class = "hidden sm:block sm:text-xs sm:text-gray-500" >
124+ { postDateTime ?. slice ( 0 , 10 ) }
125+ </ p >
126+
127+ </ div >
81128 </ div >
82129 </ div >
83- < div className = 'w-74' >
84- < h3 className = "font-bold" > { postName ?. slice ( 0 , 32 ) + '...' } </ h3 >
85- < p className = "text-sm opacity-50" > { postDescription ?. length > 60 ? postDescription ?. slice ( 0 , 60 ) : postDescription } </ p >
86- < p className = 'text-sm opacity-80' > Category: { postCategory } </ p >
87- < p className = 'text-xs' > Tags: < span className = "badge badge-ghost badge-sm" > { postTags } </ span > </ p >
88- </ div >
89- </ div >
90- </ td >
91- < td >
92- { postAuthor }
93- < br />
94- < span className = "text-xs" > { postDateTime ?. slice ( 0 , 10 ) } </ span >
130+ </ article >
95131 </ td >
96132 < td >
97133 < div className = "flex items-center" >
0 commit comments