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 GenericClickable
} from "features/clickables/clickable"; } from "features/clickables/clickable";
import { GenericConversion } from "features/conversion"; 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 { displayResource } from "features/resources/resource";
import { import {
createTreeNode, 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>
);
}