Add TextLink component
This commit is contained in:
7 files changed
+96
-18
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user