Skip to content

Commit 505b717

Browse files
author
atulsy9
committed
tooltip songs
1 parent ca1aa8f commit 505b717

File tree

2 files changed

+45
-13
lines changed

2 files changed

+45
-13
lines changed

qtify/src/components/Card/index.js

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,46 @@
11
import "./card.css";
2+
import { useState, useEffect } from "react";
3+
import Tooltip from "@mui/material/Tooltip";
24
// eslint-disable-next-line import/no-anonymous-default-export
35
export default ({ data, view }) => {
4-
return (
5-
<div className="card">
6-
<img src={data.image} alt={data.title} className="card-img" />
7-
<div className="card-innerCard">
8-
{view ? (
9-
<div className="followerCount">{data.likes} Likes</div>
10-
) : (
11-
<div className="followerCount">{data.follows} Follows</div>
12-
)}
6+
const [noOfSongs, setnoOfSongs] = useState(0);
7+
useEffect(() => {
8+
if (data.songs) {
9+
setnoOfSongs(data.songs.length);
10+
}
11+
}, []);
12+
if (view) {
13+
return (
14+
<div className="card">
15+
<img src={data.image} alt={data.title} className="card-img" />
16+
<div className="card-innerCard">
17+
{view ? (
18+
<div className="followerCount">{data.likes} Likes</div>
19+
) : (
20+
<div className="followerCount">{data.follows} Follows</div>
21+
)}
22+
</div>
23+
<div className="title">{data.title}</div>
1324
</div>
14-
<div className="title">{data.title}</div>
15-
</div>
16-
);
25+
);
26+
} else {
27+
return (
28+
<Tooltip
29+
title={`${noOfSongs} Songs`}
30+
placement="top"
31+
className="card"
32+
arrow
33+
>
34+
<img src={data.image} alt={data.title} className="card-img" />
35+
<div className="card-innerCard">
36+
{view ? (
37+
<div className="followerCount">{data.likes} Likes</div>
38+
) : (
39+
<div className="followerCount">{data.follows} Follows</div>
40+
)}
41+
</div>
42+
<div className="title">{data.title}</div>
43+
</Tooltip>
44+
);
45+
}
1746
};

qtify/src/components/Carousel/index.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "./Carousel.css";
22
import { Virtual, Navigation } from "swiper/modules";
33
import { Swiper, SwiperSlide } from "swiper/react";
4+
import Tooltip from "@mui/material/Tooltip";
45

56
// Import Swiper styles
67
import "swiper/css";
@@ -24,7 +25,9 @@ export default ({ data, id, view }) => {
2425
>
2526
{data.map((cardData) => (
2627
<SwiperSlide key={cardData.id}>
27-
<Card data={cardData} view={view} />
28+
<Tooltip title="Delete">
29+
<Card data={cardData} view={view} />
30+
</Tooltip>
2831
</SwiperSlide>
2932
))}
3033
</Swiper>

0 commit comments

Comments
 (0)