Skip to content

Commit afb591e

Browse files
imrprove the styling of cards
1 parent a7d1cba commit afb591e

File tree

4 files changed

+56
-42
lines changed

4 files changed

+56
-42
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"@tensorflow-models/coco-ssd": "^2.2.3",
1717
"@tensorflow/tfjs": "^4.16.0",
1818
"add": "^2.0.6",
19+
"ajv": "^6.12.6",
20+
"ajv-keywords": "^3.5.2",
1921
"axios": "^1.6.8",
2022
"browser-image-compression": "^2.0.2",
2123
"classnames": "^2.5.1",

src/App.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,3 +568,19 @@ small {
568568
::-webkit-scrollbar {
569569
width: 25px;
570570
}
571+
.glass-card {
572+
background: #c1bfbf25;
573+
backdrop-filter: blur(2px);
574+
-webkit-backdrop-filter: blur(20px);
575+
border-radius: 20px;
576+
border: 1px solid rgba(182, 180, 180, 0.2);
577+
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
578+
transition: transform 0.3s ease, box-shadow 0.3s ease;
579+
color: #3e5156;
580+
}
581+
582+
.glass-card:hover {
583+
transform: translateY(-8px);
584+
box-shadow: 0 12px 45px rgba(0, 0, 0, 0.35);
585+
}
586+

src/common/components/Like/Like.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const Like = ({ onLikeClick, likeObj }) => {
88
};
99

1010
return (
11-
<button className="action counted -mr-0.5" onClick={likeClickHandler}>
11+
<button className="flex items-center justify-center action counted -mr-0.5" onClick={likeClickHandler}>
1212
<AiOutlineLike className={liked ? 'hidden' : 'icon'} size="24px" />
1313
<AiFillLike className={liked ? 'icon' : 'hidden'} size="24px" />
1414
{number > 0 ? <div className="count-value">{number}</div> : <div />}

src/common/playlists/PlayCard.jsx

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,57 +3,53 @@ import { Link } from 'react-router-dom';
33
import { BsPlayCircleFill } from 'react-icons/bs';
44
import { BiLogoTypescript, BiLogoJavascript } from 'react-icons/bi';
55
import PlayShare from './PlayShare.jsx';
6-
7-
import Shimmer from 'react-shimmer-effect';
86
import Like from 'common/components/Like/Like';
97
import userImage from 'images/user.png';
108

119
function PlayCard({ play, cover, likeObject }) {
1210
return (
1311
<Link to={`/plays/${encodeURI(play.github.toLowerCase())}/${play.slug}`}>
14-
<div className="play-card-container">
15-
<div className="play-thumb-container">
16-
<Shimmer>
17-
<img alt="" className="play-card-thumb-img" src={cover} />
18-
</Shimmer>
19-
<BsPlayCircleFill className="play-icon" color="white" size={80} />
12+
<div className="glass-card max-w-sm overflow-hidden">
13+
14+
{/* Thumbnail */}
15+
<div className="relative group">
16+
<img
17+
src={cover}
18+
alt={play.name}
19+
className="min-w-full h-44 object-cover rounded-t-2xl transform group-hover:scale-105 transition duration-500"
20+
/>
21+
<BsPlayCircleFill className="absolute inset-0 m-auto text-gray-700 opacity-80 group-hover:opacity-100 transition" size={70}/>
2022
</div>
2123

22-
{/* <div className="border" /> */}
23-
<div className="card-header">{play.name}</div>
24-
{play.user && (
25-
<div className="author">
26-
<img
27-
alt="avatar"
28-
className="rounded-full border border-zink"
29-
height="25px"
30-
loading="lazy"
31-
src={
32-
play?.user.avatarUrl
33-
? play?.user.avatarUrl.length
34-
? play?.user.avatarUrl
35-
: userImage
36-
: userImage
37-
}
38-
width="25px"
39-
/>
40-
<div className="author-name">{play?.user.displayName}</div>
41-
</div>
42-
)}
43-
<div className="play-actions mt-4">
44-
<div className="like-container">
45-
<Like likeObj={likeObject()} onLikeClick={null} />
46-
<div style={{ display: 'flex', alignItems: 'center' }}>
47-
<PlayShare
48-
cover={cover}
49-
link={`/plays/${encodeURI(play.github.toLowerCase())}/${play.slug}`}
24+
{/* Content */}
25+
<div className="p-4 text-center">
26+
<h3 className="text-xl font-semibold text-gray-700 drop-shadow-lg">
27+
{play.name}
28+
</h3>
29+
30+
{play.user && (
31+
<div className="flex items-center justify-center gap-2 mt-2 text-gray-700 text-sm">
32+
<img
33+
className="w-8 h-8 rounded-full border border-white/40 shadow-md"
34+
src={play.user.avatarUrl?.length ? play.user.avatarUrl : userImage}
35+
alt="avatar"
5036
/>
51-
{play.language === 'ts' ? (
52-
<BiLogoTypescript className="lang-icon" color="#007acc" size={25} />
53-
) : (
54-
<BiLogoJavascript className="lang-icon" color="#F0DB4F" size={25} />
55-
)}
37+
<span>{play.user.displayName}</span>
5638
</div>
39+
)}
40+
41+
{/* Actions */}
42+
<div className="flex justify-between items-center mt-4 px-2 text-gray-700 ">
43+
<Like likeObj={likeObject()} onLikeClick={null} />
44+
<PlayShare
45+
cover={cover}
46+
link={`/plays/${encodeURI(play.github.toLowerCase())}/${play.slug}`}
47+
/>
48+
{play.language === "ts" ? (
49+
<BiLogoTypescript className="text-blue-400" size={22}/>
50+
) : (
51+
<BiLogoJavascript className="text-yellow-400" size={22}/>
52+
)}
5753
</div>
5854
</div>
5955
</div>

0 commit comments

Comments
 (0)