forked from profectus/Profectus
Made sections support computable titles and subtitles
This commit is contained in:
parent
4c4ff87110
commit
b89366de2a
1 changed files with 10 additions and 4 deletions
|
@ -237,9 +237,9 @@ export function createLayerTreeNode<T extends LayerTreeNodeOptions>(
|
|||
/** An option object for a modifier display as a single section. **/
|
||||
export interface Section {
|
||||
/** The header for this modifier. **/
|
||||
title: string;
|
||||
title: Computable<string>;
|
||||
/** A subtitle for this modifier, e.g. to explain the context for the modifier. **/
|
||||
subtitle?: string;
|
||||
subtitle?: Computable<string>;
|
||||
/** The modifier to be displaying in this section. **/
|
||||
modifier: WithRequired<Modifier, "description">;
|
||||
/** The base value being modified. **/
|
||||
|
@ -266,6 +266,8 @@ export function createCollapsibleModifierSections(
|
|||
base: ProcessedComputable<DecimalSource | undefined>[];
|
||||
baseText: ProcessedComputable<CoercableComponent | undefined>[];
|
||||
visible: ProcessedComputable<boolean | undefined>[];
|
||||
title: ProcessedComputable<string | undefined>[];
|
||||
subtitle: ProcessedComputable<string | undefined>[];
|
||||
}
|
||||
| Record<string, never> = {};
|
||||
let calculated = false;
|
||||
|
@ -275,6 +277,8 @@ export function createCollapsibleModifierSections(
|
|||
processed.base = sections.map(s => convertComputable(s.base));
|
||||
processed.baseText = sections.map(s => convertComputable(s.baseText));
|
||||
processed.visible = sections.map(s => convertComputable(s.visible));
|
||||
processed.title = sections.map(s => convertComputable(s.title));
|
||||
processed.subtitle = sections.map(s => convertComputable(s.subtitle));
|
||||
calculated = true;
|
||||
}
|
||||
return sections;
|
||||
|
@ -297,8 +301,10 @@ export function createCollapsibleModifierSections(
|
|||
>
|
||||
▼
|
||||
</span>
|
||||
{s.title}
|
||||
{s.subtitle != null ? <span class="subtitle"> ({s.subtitle})</span> : null}
|
||||
{unref(processed.title)}
|
||||
{unref(processed.subtitle) != null ? (
|
||||
<span class="subtitle"> ({unref(processed.subtitle)})</span>
|
||||
) : null}
|
||||
</h3>
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue