diff --git a/src/app/authoring-tool/edit-component-width/edit-component-width.component.ts b/src/app/authoring-tool/edit-component-width/edit-component-width.component.ts index afd02ef8bd6..a235ec70548 100644 --- a/src/app/authoring-tool/edit-component-width/edit-component-width.component.ts +++ b/src/app/authoring-tool/edit-component-width/edit-component-width.component.ts @@ -1,20 +1,46 @@ import { Component } from '@angular/core'; -import { EditComponentFieldComponent } from '../edit-component-field.component'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; import { FormsModule } from '@angular/forms'; +import { MatIconModule } from '@angular/material/icon'; +import { MatTooltipModule } from '@angular/material/tooltip'; +import { MatButtonToggleModule } from '@angular/material/button-toggle'; +import { EditComponentFieldComponent } from '../edit-component-field.component'; @Component({ - imports: [FormsModule, MatFormFieldModule, MatInputModule], + imports: [FormsModule, MatButtonToggleModule, MatIconModule, MatTooltipModule], selector: 'edit-component-width', - template: ` - Activity Width - - ` + template: `
+ Activity width + help +
+ + @for (value of possibleValues; track $index) { + {{ value }}% + } + ` }) -export class EditComponentWidthComponent extends EditComponentFieldComponent {} +export class EditComponentWidthComponent extends EditComponentFieldComponent { + protected possibleValues = [25, 33, 50, 67, 75, 100]; + protected selectedValue = '100'; + + public override ngOnInit(): void { + super.ngOnInit(); + this.selectedValue = String(this.componentContent.componentWidth ?? 100); + } + + protected onWidthChange(): void { + this.componentContent.componentWidth = Number(this.selectedValue); + this.inputChanged.next(Number(this.selectedValue)); + } +} diff --git a/src/messages.xlf b/src/messages.xlf index f2d59366f21..e5ea8b971f0 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -1096,11 +1096,19 @@ 85 - - Activity Width + + Activity width src/app/authoring-tool/edit-component-width/edit-component-width.component.ts - 11,15 + 12,15 + + + + The activity's width determines how it appears on the screen. If two adjacent + activities are set to 50% each (or 67% and 33%, for example), they will appear side-by-side. + + src/app/authoring-tool/edit-component-width/edit-component-width.component.ts + 15,19