2019-05-15 05:56:59 +02:00
|
|
|
/**
|
|
|
|
* React Component for displaying a single Augmentation as an accordion.
|
|
|
|
*
|
|
|
|
* The header of the accordion contains the Augmentation's name (and level, if
|
2019-05-15 09:15:07 +02:00
|
|
|
* applicable), and the accordion's panel contains the Augmentation's description.
|
2019-05-15 05:56:59 +02:00
|
|
|
*/
|
|
|
|
import * as React from "react";
|
|
|
|
|
2021-09-13 18:44:46 +02:00
|
|
|
import { BBAccordion } from "./Accordion";
|
2019-05-15 05:56:59 +02:00
|
|
|
|
|
|
|
import { Augmentation } from "../../Augmentation/Augmentation";
|
|
|
|
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
|
|
|
|
|
|
|
type IProps = {
|
2021-09-05 01:09:30 +02:00
|
|
|
aug: Augmentation;
|
|
|
|
level?: number | string | null;
|
|
|
|
};
|
2019-05-15 05:56:59 +02:00
|
|
|
|
|
|
|
export function AugmentationAccordion(props: IProps): React.ReactElement {
|
2021-09-05 01:09:30 +02:00
|
|
|
let displayName = props.aug.name;
|
|
|
|
if (props.level != null) {
|
|
|
|
if (props.aug.name === AugmentationNames.NeuroFluxGovernor) {
|
|
|
|
displayName += ` - Level ${props.level}`;
|
2021-05-02 06:07:04 +02:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2021-05-02 06:07:04 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
if (typeof props.aug.info === "string") {
|
2019-05-15 05:56:59 +02:00
|
|
|
return (
|
2021-09-13 18:44:46 +02:00
|
|
|
<BBAccordion
|
2021-09-05 01:09:30 +02:00
|
|
|
headerContent={<>{displayName}</>}
|
|
|
|
panelContent={
|
|
|
|
<p>
|
|
|
|
<span dangerouslySetInnerHTML={{ __html: props.aug.info }} />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
{props.aug.stats}
|
|
|
|
</p>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2021-09-13 18:44:46 +02:00
|
|
|
<BBAccordion
|
2021-09-05 01:09:30 +02:00
|
|
|
headerContent={<>{displayName}</>}
|
|
|
|
panelContent={
|
|
|
|
<p>
|
|
|
|
{props.aug.info}
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
{props.aug.stats}
|
|
|
|
</p>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
2019-05-15 05:56:59 +02:00
|
|
|
}
|