Add TextLink component

This commit is contained in:
Prayag Prajapati committed 2023-09-17 19:27:28 +05:30
1 parent d7a573e8db
commit c3f18282c4
7 files changed
+96 -18

No files matched your search

+48 -14
View File
@@ -25,6 +25,7 @@ import PlayButton from "../../buttons/playButton";
import "./hero.module.scss";
import { Blurhash } from "react-blurhash";
import { MediaTypeIconCollection } from "../../utils/iconsCollection";
import TextLink from "../../textLink";
/**
* @typedef {Object} Props
@@ -511,7 +512,12 @@ const Hero = ({
marginTop: "0.2em",
}}
>
<Typography fontStyle="italic" variant="h5" mb={1}>
<Typography
fontStyle="italic"
variant="h5"
mb={1}
mt={1}
>
{item.Taglines[0]}
</Typography>
<Typography variant="subtitle1">
@@ -536,14 +542,29 @@ const Hero = ({
>
Written by
</Typography>
<Typography variant="subtitle1">
{writers
.map(
(writer, index) =>
writer.Name,
)
.join(", ")}
</Typography>
<div className="hero-text-container">
{writers.map((writer, index) => (
<>
<TextLink
text={
index ==
writers.length
? writer.Name
: `${writer.Name}`
}
variant={"subtitle1"}
location={`/person/${writer.Id}`}
/>
<span
style={{
whiteSpace: "pre",
}}
>
,{" "}
</span>
</>
))}
</div>
</div>
)}
{directors.length > 0 && (
@@ -562,11 +583,24 @@ const Hero = ({
>
Directed by
</Typography>
<Typography variant="subtitle1">
{directors
.map((director) => director.Name)
.join(", ")}
</Typography>
<div className="hero-text-container">
{directors.map((director) => (
<>
<TextLink
text={director.Name}
variant={"subtitle1"}
location={`/person/${director.Id}`}
/>
<span
style={{
whiteSpace: "pre",
}}
>
,{" "}
</span>
</>
))}
</div>
</div>
)}
{artists.length > 0 && (
@@ -63,4 +63,8 @@ $maskPercentage: 40%;
transition: opacity $transition-time-fast;
filter: drop-shadow(0px 4px 10px rgb(0 0 0 / 0.5));
}
&-text-container {
display: flex;
flex-wrap: wrap;
}
}
+22
View File
@@ -0,0 +1,22 @@
/** @format */
import Typography from "@mui/material/Typography";
import { useNavigate } from "react-router-dom";
import "./textLink.module.scss";
const TextLink = ({ text, location, variant }) => {
const navigate = useNavigate();
return (
<Typography
variant={variant}
className="link"
onClick={() => navigate(location)}
>
{text}
</Typography>
);
};
export default TextLink;
@@ -0,0 +1,11 @@
/** @format */
.link {
text-decoration: underline;
text-decoration-color: rgb(255 255 255 / 0.5);
white-space: pre-line;
&:hover {
cursor: pointer;
text-decoration-color: rgb(255 255 255 / 1);
}
}
+3
View File
@@ -204,6 +204,9 @@ const MusicAlbumTitlePage = () => {
justifySelf: "start",
}}
fontWeight={400}
onClick={() => {
console.log("Hvnrjn");
}}
>
Name
</Typography>