Skip to content
Snippets Groups Projects
Commit f5ac7a5b authored by rhenck's avatar rhenck
Browse files

Give likert element styling properties

Colors and font stuff.
parent 5813a35a
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,15 @@ import { LikertElement } from '../../models/compound-elements/likert-element'; ...@@ -6,7 +6,15 @@ import { LikertElement } from '../../models/compound-elements/likert-element';
selector: 'app-likert', selector: 'app-likert',
template: ` template: `
<div class="mat-typography" <div class="mat-typography"
[style.display]="'grid'" [style.grid-template-columns]="'5fr ' + '2fr '.repeat(elementModel.answers.length)"> [style.display]="'grid'" [style.grid-template-columns]="'5fr ' + '2fr '.repeat(elementModel.answers.length)"
[style.background-color]="elementModel.backgroundColor"
[style.color]="elementModel.fontColor"
[style.font-family]="elementModel.font"
[style.font-size.px]="elementModel.fontSize"
[style.font-weight]="elementModel.bold ? 'bold' : ''"
[style.font-style]="elementModel.italic ? 'italic' : ''"
[style.text-decoration]="elementModel.underline ? 'underline' : ''"
[style.height.px]="100">
<div class="headings" [style.display]="'grid'" <div class="headings" [style.display]="'grid'"
[style.grid-template-columns]="'5fr ' + '2fr '.repeat(elementModel.answers.length)" [style.grid-template-columns]="'5fr ' + '2fr '.repeat(elementModel.answers.length)"
[style.grid-column-start]="1" [style.grid-column-start]="1"
......
import { UIElement } from '../uI-element'; import { UIElement } from '../uI-element';
import { LikertElementRow } from './likert-element-row'; import { LikertElementRow } from './likert-element-row';
import { AnswerOption } from '../../interfaces/UIElementInterfaces'; import { AnswerOption, FontElement, SurfaceUIElement } from '../../interfaces/UIElementInterfaces';
import { initFontElement, initSurfaceElement } from '../../util/unit-interface-initializer';
export class LikertElement extends UIElement { export class LikertElement extends UIElement implements FontElement, SurfaceUIElement {
questions: LikertElementRow[] = []; questions: LikertElementRow[] = [];
answers: AnswerOption[] = []; answers: AnswerOption[] = [];
lineColoring: boolean = true; lineColoring: boolean = true;
fontColor: string = 'black';
font: string = 'Roboto';
fontSize: number = 18;
bold: boolean = false;
italic: boolean = false;
underline: boolean = false;
backgroundColor: string = 'transparent';
constructor(serializedElement: UIElement, coordinates?: { x: number; y: number }) { constructor(serializedElement: UIElement, coordinates?: { x: number; y: number }) {
super(serializedElement, coordinates); super(serializedElement, coordinates);
Object.assign(this, serializedElement); Object.assign(this, serializedElement);
Object.assign(this, initFontElement(serializedElement));
Object.assign(this, initSurfaceElement(serializedElement));
this.height = serializedElement.height || 200; this.height = serializedElement.height || 200;
this.width = serializedElement.width || 400; this.width = serializedElement.width || 400;
this.backgroundColor = serializedElement.backgroundColor as string || 'transparent';
} }
setProperty(property: string, value: string | number | boolean | string[] | AnswerOption[] | null): void { setProperty(property: string, value: string | number | boolean | string[] | AnswerOption[] | null): void {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment