forked from MapComplete/MapComplete
Better tag rewriting, add icons, add bicycle rental theme
This commit is contained in:
parent
1dcb3897e4
commit
9594868e83
23 changed files with 389 additions and 117 deletions
|
@ -5,6 +5,8 @@ import {VariableUiElement} from "../Base/VariableUIElement";
|
|||
import List from "../Base/List";
|
||||
import {SubstitutedTranslation} from "../SubstitutedTranslation";
|
||||
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig";
|
||||
import Combine from "../Base/Combine";
|
||||
import Img from "../Base/Img";
|
||||
|
||||
/***
|
||||
* Displays the correct value for a known tagrendering
|
||||
|
@ -38,11 +40,17 @@ export default class TagRenderingAnswer extends VariableUiElement {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
const valuesToRender: BaseUIElement[] = trs.map(tr => new SubstitutedTranslation(tr, tagsSource, state, options?.specialViz))
|
||||
const valuesToRender: BaseUIElement[] = trs.map(tr => {
|
||||
const text = new SubstitutedTranslation(tr.then, tagsSource, state, options?.specialViz);
|
||||
if(tr.icon === undefined){
|
||||
return text
|
||||
}
|
||||
return new Combine([new Img(tr.icon).SetClass("w-6 max-h-6 pr-2"), text]).SetClass("flex")
|
||||
})
|
||||
if (valuesToRender.length === 1) {
|
||||
return valuesToRender[0];
|
||||
} else if (valuesToRender.length > 1) {
|
||||
return new List(valuesToRender)
|
||||
return new Combine(valuesToRender).SetClass("flex flex-col")
|
||||
}
|
||||
return undefined;
|
||||
}).map((element: BaseUIElement) => element?.SetClass(contentClasses)?.SetStyle(contentStyle)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue