diff --git a/src/common/components/Like/Like.jsx b/src/common/components/Like/Like.jsx index 460ad60ff4..183ab07142 100644 --- a/src/common/components/Like/Like.jsx +++ b/src/common/components/Like/Like.jsx @@ -8,10 +8,14 @@ const Like = ({ onLikeClick, likeObj }) => { }; return ( - ); }; diff --git a/src/common/playlists/PlayCard.jsx b/src/common/playlists/PlayCard.jsx index f4ad450e19..3a4648616d 100644 --- a/src/common/playlists/PlayCard.jsx +++ b/src/common/playlists/PlayCard.jsx @@ -1,62 +1,122 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Link } from 'react-router-dom'; import { BsPlayCircleFill } from 'react-icons/bs'; import { BiLogoTypescript, BiLogoJavascript } from 'react-icons/bi'; import PlayShare from './PlayShare.jsx'; - -import Shimmer from 'react-shimmer-effect'; import Like from 'common/components/Like/Like'; import userImage from 'images/user.png'; +const formatDate = (dateString) => dateString || ''; + function PlayCard({ play, cover, likeObject }) { - return ( - -
-
- - - - + const [isExpanded, setIsExpanded] = useState(false); + if (!play || !play.github || !play.slug) return null; + + const avatarSrc = + play?.user?.avatarUrl && play.user.avatarUrl.length ? play.user.avatarUrl : userImage; + + const LanguageBadge = () => { + if (play.language === 'ts') { + return ( +
+ + Typescript
+ ); + } + if (play.language === 'js') { + return ( +
+ + Javascript +
+ ); + } + + return null; + }; + + const linkTo = `/plays/${encodeURI(play.github.toLowerCase())}/${play.slug}`; - {/*
*/} -
{play.name}
- {play.user && ( -
- avatar +
+ {cover && ( +
+ {play.name} +
+ -
{play?.user.displayName}
)} -
-
- -
- + + + {play.user?.displayName && ( +
+ avatar - {play.language === 'ts' ? ( - - ) : ( - + {play.user.displayName} + {play.date && ( + <> + + {formatDate(play.date)} + )}
+ )} + +
{play.name}
+ + {play.description && ( +
+

+ {play.description} +

+
+ )} + +
+ {likeObject && + (() => { + const data = likeObject?.(); + + return ( +
+ +
+ ); + })()} + +
+
e.preventDefault()}> + +
+
+ + ); } diff --git a/src/common/playlists/PlayShare.jsx b/src/common/playlists/PlayShare.jsx index 63f9498157..51e1140ac4 100644 --- a/src/common/playlists/PlayShare.jsx +++ b/src/common/playlists/PlayShare.jsx @@ -115,7 +115,7 @@ function PlayShare({ cover, link }) { setShowModal(true); }} > - +
); diff --git a/src/common/playlists/playlist.css b/src/common/playlists/playlist.css index 28dc9fc45d..4b90f9f7fc 100644 --- a/src/common/playlists/playlist.css +++ b/src/common/playlists/playlist.css @@ -842,17 +842,18 @@ position: relative; display: flex; flex-direction: column; - border: 2px solid #757575; + border: 2px solid #efefef; border-radius: 8px; overflow: hidden; transition: transform 0.2s ease-in-out; - width: 300px; - height: 100%; + width: 350px; + /* height: 100%; */ padding: 12px; } .play-card-container:hover { - transform: scale(105%); + transform: scale(103%); + box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.2); transition: transform 0.2s ease-in-out; } @@ -881,9 +882,9 @@ font-weight: 200; } .card-header { - font-size: 18px; - padding: 10px; - text-align: center; + font-size: 15px; + padding: 10px 0px; + text-align: start; } .img { @@ -960,3 +961,12 @@ .play-card-container:hover .lang-icon { filter: none; } + +/* Line clamp utility for text truncation */ +.line-clamp-3 { + display: -webkit-box; + -webkit-line-clamp: 3; + line-clamp: 3; + -webkit-box-orient: vertical; + overflow: hidden; +}