New source found from dndbeyond.com
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import clsx from "clsx";
|
||||
import React from "react";
|
||||
|
||||
import {
|
||||
BoxBackground,
|
||||
ThemedSenseRowBoxSvg,
|
||||
ThemedSenseRowSmallBoxSvg,
|
||||
ThemedSenseRowMinimalSvg,
|
||||
} from "@dndbeyond/character-components/es";
|
||||
import {
|
||||
CharacterTheme,
|
||||
@@ -14,13 +16,14 @@ import {
|
||||
} from "@dndbeyond/character-rules-engine/es";
|
||||
|
||||
import { TypeScriptUtils } from "../../../Shared/utils";
|
||||
import styles from "./styles.module.css";
|
||||
|
||||
interface Props {
|
||||
passivePerception: number;
|
||||
passiveInvestigation: number;
|
||||
passiveInsight: number;
|
||||
senses: SenseInfo;
|
||||
rowStyle: "small" | "normal";
|
||||
rowStyle: "small" | "normal" | "minimal";
|
||||
onClick?: () => void;
|
||||
theme: CharacterTheme;
|
||||
}
|
||||
@@ -53,8 +56,6 @@ export default class Senses extends React.PureComponent<Props> {
|
||||
};
|
||||
|
||||
renderSummaryInfo = (): React.ReactNode => {
|
||||
const { theme } = this.props;
|
||||
|
||||
let senseKeys: Array<Constants.SenseTypeEnum> = [
|
||||
Constants.SenseTypeEnum.BLINDSIGHT,
|
||||
Constants.SenseTypeEnum.DARKVISION,
|
||||
@@ -66,24 +67,17 @@ export default class Senses extends React.PureComponent<Props> {
|
||||
.map((senseKey) => this.getSenseSummary(senseKey))
|
||||
.filter(TypeScriptUtils.isNotNullOrUndefined);
|
||||
|
||||
let summaryClasses: Array<string> = ["ct-senses__summary"];
|
||||
if (!senseSummaries.length) {
|
||||
summaryClasses.push("ct-senses__summary--empty");
|
||||
}
|
||||
if (theme?.isDarkMode) {
|
||||
summaryClasses.push("ct-senses__summary--dark-mode");
|
||||
}
|
||||
|
||||
if (senseSummaries.length) {
|
||||
return (
|
||||
<div className={summaryClasses.join(" ")}>
|
||||
{senseSummaries.join(", ")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={summaryClasses.join(" ")}>Additional Sense Types</div>
|
||||
<div
|
||||
className={clsx([
|
||||
styles.summary,
|
||||
!senseSummaries.length && styles.summaryEmpty,
|
||||
])}
|
||||
>
|
||||
{!senseSummaries.length
|
||||
? "Additional Sense Types"
|
||||
: senseSummaries.join(", ")}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -96,84 +90,140 @@ export default class Senses extends React.PureComponent<Props> {
|
||||
theme,
|
||||
} = this.props;
|
||||
|
||||
let isMinimal = false;
|
||||
let StyleComponent: React.ComponentType<any> = ThemedSenseRowBoxSvg;
|
||||
if (rowStyle === "small") {
|
||||
StyleComponent = ThemedSenseRowSmallBoxSvg;
|
||||
} else if (rowStyle === "minimal") {
|
||||
StyleComponent = ThemedSenseRowMinimalSvg;
|
||||
isMinimal = true;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="ct-senses" onClick={this.handleClick}>
|
||||
<div className="ct-senses__callouts">
|
||||
<div className="ct-senses__callout">
|
||||
<BoxBackground
|
||||
StyleComponent={StyleComponent}
|
||||
theme={{
|
||||
...theme,
|
||||
themeColor: `${theme?.themeColor}80`,
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
className={`ct-senses__callout-value ${
|
||||
theme?.isDarkMode ? "ct-senses__callout-value--dark-mode" : ""
|
||||
}`}
|
||||
>
|
||||
{passivePerception}
|
||||
<div className={styles.senses} onClick={this.handleClick}>
|
||||
{isMinimal ? (
|
||||
<div className={styles.minimalRow}>
|
||||
<div className={styles.minimalItem}>
|
||||
<div className={styles.minimalCallout}>
|
||||
<BoxBackground
|
||||
StyleComponent={StyleComponent}
|
||||
theme={{
|
||||
...theme,
|
||||
themeColor: `${theme?.themeColor}80`,
|
||||
}}
|
||||
/>
|
||||
<div className={styles.calloutValue}>{passivePerception}</div>
|
||||
</div>
|
||||
<div
|
||||
className={clsx([
|
||||
styles.calloutLabel,
|
||||
styles.minimalCalloutLabel,
|
||||
])}
|
||||
>
|
||||
Perception
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={`ct-senses__callout-label ${
|
||||
theme?.isDarkMode ? "ct-senses__callout-label--dark-mode" : ""
|
||||
}`}
|
||||
>
|
||||
Passive Perception
|
||||
<div className={styles.minimalItem}>
|
||||
<div className={styles.minimalCallout}>
|
||||
<BoxBackground
|
||||
StyleComponent={StyleComponent}
|
||||
theme={{
|
||||
...theme,
|
||||
themeColor: `${theme?.themeColor}80`,
|
||||
}}
|
||||
/>
|
||||
<div className={styles.calloutValue}>
|
||||
{passiveInvestigation}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={clsx([
|
||||
styles.calloutLabel,
|
||||
styles.minimalCalloutLabel,
|
||||
])}
|
||||
>
|
||||
Investigation
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.minimalItem}>
|
||||
<div className={styles.minimalCallout}>
|
||||
<BoxBackground
|
||||
StyleComponent={StyleComponent}
|
||||
theme={{
|
||||
...theme,
|
||||
themeColor: `${theme?.themeColor}80`,
|
||||
}}
|
||||
/>
|
||||
<div className={styles.calloutValue}>{passiveInsight}</div>
|
||||
</div>
|
||||
<div
|
||||
className={clsx([
|
||||
styles.calloutLabel,
|
||||
styles.minimalCalloutLabel,
|
||||
])}
|
||||
>
|
||||
Insight
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="ct-senses__callout">
|
||||
<BoxBackground
|
||||
StyleComponent={StyleComponent}
|
||||
theme={{
|
||||
...theme,
|
||||
themeColor: `${theme?.themeColor}80`,
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
className={`ct-senses__callout-value ${
|
||||
theme?.isDarkMode ? "ct-senses__callout-value--dark-mode" : ""
|
||||
}`}
|
||||
>
|
||||
{passiveInvestigation}
|
||||
) : (
|
||||
<div>
|
||||
<div className={styles.callout}>
|
||||
<BoxBackground
|
||||
StyleComponent={StyleComponent}
|
||||
theme={{
|
||||
...theme,
|
||||
themeColor: `${theme?.themeColor}80`,
|
||||
}}
|
||||
/>
|
||||
<div className={styles.calloutValue}>{passivePerception}</div>
|
||||
<div
|
||||
className={clsx([
|
||||
styles.calloutLabel,
|
||||
styles.regularCalloutLabel,
|
||||
])}
|
||||
>
|
||||
Passive Perception
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={`ct-senses__callout-label ${
|
||||
theme?.isDarkMode ? "ct-senses__callout-label--dark-mode" : ""
|
||||
}`}
|
||||
>
|
||||
Passive Investigation
|
||||
<div className={styles.callout}>
|
||||
<BoxBackground
|
||||
StyleComponent={StyleComponent}
|
||||
theme={{
|
||||
...theme,
|
||||
themeColor: `${theme?.themeColor}80`,
|
||||
}}
|
||||
/>
|
||||
<div className={styles.calloutValue}>{passiveInvestigation}</div>
|
||||
<div
|
||||
className={clsx([
|
||||
styles.calloutLabel,
|
||||
styles.regularCalloutLabel,
|
||||
])}
|
||||
>
|
||||
Passive Investigation
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.callout}>
|
||||
<BoxBackground
|
||||
StyleComponent={StyleComponent}
|
||||
theme={{
|
||||
...theme,
|
||||
themeColor: `${theme?.themeColor}80`,
|
||||
}}
|
||||
/>
|
||||
<div className={styles.calloutValue}>{passiveInsight}</div>
|
||||
<div
|
||||
className={clsx([
|
||||
styles.calloutLabel,
|
||||
styles.regularCalloutLabel,
|
||||
])}
|
||||
>
|
||||
Passive Insight
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="ct-senses__callout">
|
||||
<BoxBackground
|
||||
StyleComponent={StyleComponent}
|
||||
theme={{
|
||||
...theme,
|
||||
themeColor: `${theme?.themeColor}80`,
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
className={`ct-senses__callout-value ${
|
||||
theme?.isDarkMode ? "ct-senses__callout-value--dark-mode" : ""
|
||||
}`}
|
||||
>
|
||||
{passiveInsight}
|
||||
</div>
|
||||
<div
|
||||
className={`ct-senses__callout-label ${
|
||||
theme?.isDarkMode ? "ct-senses__callout-label--dark-mode" : ""
|
||||
}`}
|
||||
>
|
||||
Passive Insight
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{this.renderSummaryInfo()}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user