Moved createModifierSection to modifiers.tsx

This commit is contained in:
thepaperpilot 2022-04-23 15:21:12 -05:00
parent f04cb69726
commit 6e53678991
2 changed files with 30 additions and 1 deletions

View file

@ -5,7 +5,7 @@ import {
GenericClickable
} from "features/clickables/clickable";
import { GenericConversion } from "features/conversion";
import { CoercableComponent, OptionsFunc, jsx, Replace, setDefault } from "features/feature";
import { CoercableComponent, jsx, OptionsFunc, Replace, setDefault } from "features/feature";
import { displayResource } from "features/resources/resource";
import {
createTreeNode,

View file

@ -113,3 +113,32 @@ export function createSequentialModifier(...modifiers: Modifier[]): Required<Mod
))
};
}
export function createModifierSection(
title: string,
subtitle: string,
modifier: Required<Modifier>,
base = 1,
unit = ""
) {
return (
<div>
<h3>
{title}
{subtitle ? <span class="subtitle"> ({subtitle})</span> : null}
</h3>
<br />
<div class="modifier-container">
<span class="modifier-amount">
{base}
{unit}
</span>
<span class="modifier-description">Base</span>
</div>
{renderJSX(unref(modifier.description))}
<hr />
Total: {format(modifier.apply(base))}
{unit}
</div>
);
}