Add icon size options to mapping icons

This commit is contained in:
Pieter Vander Vennet 2022-02-17 23:54:14 +01:00
parent 29ad3be280
commit 2e6069b95b
10 changed files with 159 additions and 44 deletions

View file

@ -45,7 +45,7 @@ export default class TagRenderingAnswer extends VariableUiElement {
if(tr.icon === undefined){
return text
}
return new Combine([new Img(tr.icon).SetClass("w-6 max-h-6 pr-2"), text]).SetClass("flex")
return new Combine([new Img(tr.icon).SetClass("mapping-icon-"+(tr.iconClass ?? "small")), text]).SetClass("flex items-center")
})
if (valuesToRender.length === 1) {
return valuesToRender[0];

View file

@ -355,7 +355,8 @@ export default class TagRenderingQuestion extends Combine {
if: TagsFilter,
then: Translation,
addExtraTags: Tag[],
img?: string
icon?: string,
iconClass?: string
}, ifNot?: TagsFilter[]): InputElement<TagsFilter> {
let tagging: TagsFilter = mapping.if;
@ -375,13 +376,14 @@ export default class TagRenderingQuestion extends Combine {
private static GenerateMappingContent(mapping: {
then: Translation,
icon?: string
icon?: string,
iconClass?: string
}, tagsSource: UIEventSource<any>, state: FeaturePipelineState): BaseUIElement {
const text = new SubstitutedTranslation(mapping.then, tagsSource, state)
if (mapping.icon === undefined) {
return text;
}
return new Combine([new Img(mapping.icon).SetClass("w-6 max-h-6 pr-2"), text]).SetClass("flex")
return new Combine([new Img(mapping.icon).SetClass("mapping-icon-"+(mapping.iconClass ?? "small")), text]).SetClass("flex")
}
private static GenerateFreeform(state, configuration: TagRenderingConfig, applicableUnit: Unit, tags: UIEventSource<any>, feedback: UIEventSource<Translation>)