-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a38066b
commit 61131ca
Showing
9 changed files
with
1,693 additions
and
1,322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,62 @@ | ||
import { Fragment } from "react" | ||
import { LazyLoadImage } from "react-lazy-load-image-component" | ||
import aboutChallenge from "../css/aboutChallenge.module.css" | ||
import goTo from "./goTo" | ||
import capstone from "../img/capstone.svg" | ||
import { checkExists } from "./arrayManipulationFunctions.js" | ||
|
||
import { Fragment } from "react"; | ||
import { LazyLoadImage } from "react-lazy-load-image-component"; | ||
import aboutChallenge from "../css/aboutChallenge.module.css"; | ||
import goTo from "./goTo"; | ||
import capstone from "../img/capstone.svg"; | ||
import { checkExists } from "./arrayManipulationFunctions.js"; | ||
|
||
/** | ||
* Function to generate a react object which shows a challenge | ||
* @param {object} content | ||
* @param {boolean} genLine | ||
* @returns {object} - React object containing the name and the image of a challenge | ||
*/ | ||
export default function generateObject(content, genLine = true, challengeId = -1) { | ||
|
||
// Additional stylesheet might be needed, as the challenge will be colored blue if it is the current one | ||
let additionalStylesheet = "" | ||
|
||
if (content.id === challengeId) { | ||
|
||
additionalStylesheet = " " + aboutChallenge.this | ||
|
||
} | ||
|
||
let imageurl = "https://lolcdn.darkintaqt.com/cdn/np-token" + content.id | ||
if (content.id < 10 || content.id === 2022000 || content.id === 2023000 || content.id === 2024100 || content.id === 2024200) { | ||
if (content.id !== 0) { | ||
imageurl = "https://cdn.darkintaqt.com/lol/static/challenges/" + content.translation.name.toLowerCase().replace(" ", "") + ".svg" | ||
} | ||
* Function to generate a react object which shows a challenge | ||
* @param {object} content | ||
* @param {boolean} genLine | ||
* @returns {object} - React object containing the name and the image of a challenge | ||
*/ | ||
export default function generateObject( | ||
content, | ||
genLine = true, | ||
challengeId = -1 | ||
) { | ||
// Additional stylesheet might be needed, as the challenge will be colored blue if it is the current one | ||
let additionalStylesheet = ""; | ||
|
||
if (content.id === challengeId) { | ||
additionalStylesheet = " " + aboutChallenge.this; | ||
} | ||
|
||
let imageurl = "https://lolcdn.darkintaqt.com/cdn/np-token" + content.id; | ||
if ( | ||
content.id < 10 || | ||
content.id === 2022000 || | ||
content.id === 2023000 || | ||
content.id === 2024100 || | ||
content.id === 2024200 || | ||
content.id === 2024300 | ||
) { | ||
if (content.id !== 0) { | ||
imageurl = | ||
"https://cdn.darkintaqt.com/lol/static/challenges/" + | ||
content.translation.name.toLowerCase().replace(" ", "") + | ||
".svg"; | ||
} | ||
} | ||
|
||
return <Fragment key={content.id}> | ||
|
||
{genLine ? | ||
<div className={aboutChallenge.line}></div> | ||
: null} | ||
|
||
<a href={"/challenge/" + content.id} className={aboutChallenge.category + additionalStylesheet} onClick={goTo}> | ||
|
||
{checkExists(content.tags.isCapstone) | ||
? <img src={capstone} alt="" className={aboutChallenge.capstone} /> : | ||
null} | ||
|
||
<LazyLoadImage height={28} width={28} src={imageurl} alt={""} /> | ||
|
||
<p> | ||
|
||
{content.translation.name} | ||
return ( | ||
<Fragment key={content.id}> | ||
{genLine ? <div className={aboutChallenge.line}></div> : null} | ||
|
||
</p> | ||
<a | ||
href={"/challenge/" + content.id} | ||
className={aboutChallenge.category + additionalStylesheet} | ||
onClick={goTo} | ||
> | ||
{checkExists(content.tags.isCapstone) ? ( | ||
<img src={capstone} alt="" className={aboutChallenge.capstone} /> | ||
) : null} | ||
|
||
</a> | ||
<LazyLoadImage height={28} width={28} src={imageurl} alt={""} /> | ||
|
||
<p>{content.translation.name}</p> | ||
</a> | ||
</Fragment> | ||
} | ||
); | ||
} |
Oops, something went wrong.