File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,13 @@ import { convertToBase64, getThumbnail } from '@/lib/utils'
4242import { useUser } from '@clerk/clerk-react'
4343import { useDeletePost , useUpdatePost } from '@/hooks'
4444
45+ const truncate = ( text , wordLimit ) => {
46+ const words = text . split ( ' ' )
47+ return words . length > wordLimit
48+ ? `${ words . slice ( 0 , wordLimit ) . join ( ' ' ) } ...`
49+ : text
50+ }
51+
4552const MoreButton = ( { setEditing, post } ) => {
4653 const [ anchorEl , setAnchorEl ] = useState ( null )
4754 const open = Boolean ( anchorEl )
@@ -436,7 +443,7 @@ const StaticCard = ({ post, setEditing }) => {
436443 textOverflow = "ellipsis"
437444 sx = { { WebkitLineClamp : 3 , WebkitBoxOrient : 'vertical' } }
438445 >
439- { post . description }
446+ { truncate ( post . description , 20 ) }
440447 </ Typography >
441448 </ CardContent >
442449 </ CardActionArea >
You can’t perform that action at this time.
0 commit comments