From fc31a0f4c6287633c0c05e446b563b50c6e6a877 Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Thu, 28 Oct 2021 15:32:14 +0200
Subject: [PATCH] Add line-height to element component which can make use of it

Other elements do implement the interface but do nothing with the
property. This make all the interface handling a lot easier at the cost
of having useless variables in some contexts.
---
 .../common/element-components/checkbox.component.ts    |  2 +-
 .../compound-elements/likert.component.ts              |  1 +
 .../element-components/radio-button-group.component.ts | 10 ++++++----
 .../common/element-components/text-area.component.ts   |  1 +
 projects/common/element-components/text.component.ts   |  1 +
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/projects/common/element-components/checkbox.component.ts b/projects/common/element-components/checkbox.component.ts
index 5b01402cc..39b425f34 100644
--- a/projects/common/element-components/checkbox.component.ts
+++ b/projects/common/element-components/checkbox.component.ts
@@ -18,7 +18,7 @@ import { CheckboxElement } from '../models/checkbox-element';
                     [style.font-weight]="elementModel.bold ? 'bold' : ''"
                     [style.font-style]="elementModel.italic ? 'italic' : ''"
                     [style.text-decoration]="elementModel.underline ? 'underline' : ''">
-        <div [innerHTML]="elementModel.label"></div>
+        <div [style.line-height.%]="elementModel.lineHeight" [innerHTML]="elementModel.label"></div>
       </mat-checkbox>
       <mat-error *ngIf="elementFormControl.errors && elementFormControl.touched"
                  class="error-message">
diff --git a/projects/common/element-components/compound-elements/likert.component.ts b/projects/common/element-components/compound-elements/likert.component.ts
index 9d196a77b..d032f386e 100644
--- a/projects/common/element-components/compound-elements/likert.component.ts
+++ b/projects/common/element-components/compound-elements/likert.component.ts
@@ -13,6 +13,7 @@ import { LikertElementRow } from '../../models/compound-elements/likert-element-
          [style.color]="elementModel.fontColor"
          [style.font-family]="elementModel.font"
          [style.font-size.px]="elementModel.fontSize"
+         [style.line-height.%]="elementModel.lineHeight"
          [style.font-weight]="elementModel.bold ? 'bold' : ''"
          [style.font-style]="elementModel.italic ? 'italic' : ''"
          [style.text-decoration]="elementModel.underline ? 'underline' : ''"
diff --git a/projects/common/element-components/radio-button-group.component.ts b/projects/common/element-components/radio-button-group.component.ts
index cbf924732..997971911 100644
--- a/projects/common/element-components/radio-button-group.component.ts
+++ b/projects/common/element-components/radio-button-group.component.ts
@@ -15,14 +15,16 @@ import { RadioButtonGroupElement } from '../models/radio-button-group-element';
          [style.font-weight]="elementModel.bold ? 'bold' : ''"
          [style.font-style]="elementModel.italic ? 'italic' : ''"
          [style.text-decoration]="elementModel.underline ? 'underline' : ''">
-      <label [innerHTML]="elementModel.label"
-             class="white-space-break"
-             id="radio-group-label"></label>
+      <label id="radio-group-label" class="white-space-break"
+             [innerHTML]="elementModel.label">
+      </label>
       <mat-radio-group aria-labelledby="radio-group-label"
                        [style.margin-bottom.px]="25"
                        [fxLayout]="elementModel.alignment"
                        [formControl]="elementFormControl">
-        <mat-radio-button *ngFor="let option of elementModel.options; let i = index" [value]="i">
+        <mat-radio-button *ngFor="let option of elementModel.options; let i = index"
+                          [value]="i"
+                          [style.line-height.%]="elementModel.lineHeight">
           {{option}}
         </mat-radio-button>
         <mat-error *ngIf="elementFormControl.errors && elementFormControl.touched"
diff --git a/projects/common/element-components/text-area.component.ts b/projects/common/element-components/text-area.component.ts
index d172aa78b..a1d934e9d 100644
--- a/projects/common/element-components/text-area.component.ts
+++ b/projects/common/element-components/text-area.component.ts
@@ -21,6 +21,7 @@ import { TextAreaElement } from '../models/text-area-element';
                 autocomplete="off"
                 placeholder="{{elementModel.label}}"
                 [style.min-width.%]="100"
+                [style.line-height.%]="elementModel.lineHeight"
                 [style.resize]="elementModel.resizeEnabled ? 'both' : 'none'">
       </textarea>
       <mat-error *ngIf="elementFormControl.errors">
diff --git a/projects/common/element-components/text.component.ts b/projects/common/element-components/text.component.ts
index 23595bc63..5e47a4d27 100644
--- a/projects/common/element-components/text.component.ts
+++ b/projects/common/element-components/text.component.ts
@@ -31,6 +31,7 @@ import { TextElement } from '../models/text-element';
       <div [style.background-color]="elementModel.backgroundColor"
            [style.color]="elementModel.fontColor"
            [style.font-family]="elementModel.font"
+           [style.line-height.%]="elementModel.lineHeight"
            [style.font-weight]="elementModel.bold ? 'bold' : ''"
            [style.font-style]="elementModel.italic ? 'italic' : ''"
            [style.text-decoration]="elementModel.underline ? 'underline' : ''"
-- 
GitLab