Skip to content
Snippets Groups Projects
Commit 95e7853c authored by jojohoch's avatar jojohoch
Browse files

Replace Flex layout module with own class in ToggleButtonComponent

- Reformat styles
parent 0260eedd
No related branches found
No related tags found
No related merge requests found
...@@ -18,10 +18,9 @@ import { ToggleButtonElement } from 'common/models/elements/compound-elements/cl ...@@ -18,10 +18,9 @@ import { ToggleButtonElement } from 'common/models/elements/compound-elements/cl
(focusout)="elementFormControl.markAsTouched()"> (focusout)="elementFormControl.markAsTouched()">
<!--Add dummy div - otherwise toggle button with empty options will not be in one line--> <!--Add dummy div - otherwise toggle button with empty options will not be in one line-->
<div *ngIf="elementModel.options.length === 0" <div *ngIf="elementModel.options.length === 0"
class="fx-row-center-center"
[style.min-height.px]="elementModel.height - 2" [style.min-height.px]="elementModel.height - 2"
[style.width]="100" [style.width]="100">
fxLayout="row"
[fxLayoutAlign]="'center center'">
<span>&nbsp;</span> <span>&nbsp;</span>
</div> </div>
<mat-button-toggle *ngFor="let option of elementModel.options; let i = index" <mat-button-toggle *ngFor="let option of elementModel.options; let i = index"
...@@ -47,17 +46,38 @@ import { ToggleButtonElement } from 'common/models/elements/compound-elements/cl ...@@ -47,17 +46,38 @@ import { ToggleButtonElement } from 'common/models/elements/compound-elements/cl
</mat-button-toggle> </mat-button-toggle>
</mat-button-toggle-group> </mat-button-toggle-group>
`, `,
styles: [ styles: [`
'.errors {border: 2px solid #f44336 !important;}', .errors {
'mat-button-toggle-group {display: inline-flex; min-width: 70px; min-height: 20px; max-width: 100%;}', border: 2px solid #f44336 !important;
'mat-button-toggle-group {justify-content: center; box-sizing: border-box;}', }
':host ::ng-deep .mat-button-toggle-label-content {line-height: unset}', mat-button-toggle-group {
':host ::ng-deep .mat-button-toggle-button {height: 100%}', display: inline-flex;
':host ::ng-deep .strike-selected-option.mat-button-toggle-checked .mat-button-toggle-label-content' + min-width: 70px;
'{text-decoration: line-through}', min-height: 20px;
':host ::ng-deep .strike-other-options:not(.mat-button-toggle-checked) .mat-button-toggle-label-content' + max-width: 100%;
'{text-decoration: line-through}' justify-content: center;
] box-sizing: border-box;
}
:host ::ng-deep .mat-button-toggle-label-content {
line-height: unset;
}
:host ::ng-deep .mat-button-toggle-button {
height: 100%;
}
:host ::ng-deep .strike-selected-option.mat-button-toggle-checked .mat-button-toggle-label-content {
text-decoration: line-through;
}
:host ::ng-deep .strike-other-options:not(.mat-button-toggle-checked) .mat-button-toggle-label-content {
text-decoration: line-through;
}
.fx-row-center-center {
box-sizing: border-box;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
`]
}) })
export class ToggleButtonComponent extends FormElementComponent { export class ToggleButtonComponent extends FormElementComponent {
@Input() elementModel!: ToggleButtonElement; @Input() elementModel!: ToggleButtonElement;
......
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