-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the verse-prose button with a select
- Loading branch information
Showing
10 changed files
with
118 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/app/components/verse-prose-select/verse-prose-select.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<ng-select | ||
[items]="textFlowTypes" | ||
[multiple]="false" | ||
[closeOnSelect]="true" | ||
[searchable]="false" | ||
[placeholder]="'selectItems' | translate" | ||
[(ngModel)]="selectedType" | ||
[disabled]="textFlowTypes.length === 0" | ||
[clearable]="false" | ||
(change)="updateSelectedType($event)"> | ||
<ng-template ng-option-tmp let-item="item" let-item$="item$" let-index="index" let-search="searchTerm"> | ||
<evt-icon [iconInfo]="getProseVersesTogglerIcon(item)"></evt-icon> | ||
<span class="ng-value-label"> {{item | translate}}</span> | ||
</ng-template> | ||
<ng-template ng-label-tmp let-item="item"> | ||
<evt-icon | ||
[iconInfo]="getProseVersesTogglerIcon(item)" | ||
label-left> | ||
</evt-icon> | ||
{{item | translate}} | ||
</ng-template> | ||
</ng-select> |
34 changes: 34 additions & 0 deletions
34
src/app/components/verse-prose-select/verse-prose-select.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ng-select { | ||
width: 13.5rem; | ||
margin-left: 0.3rem; | ||
} | ||
|
||
// ng-select overrides | ||
::ng-deep .ng-select { | ||
min-width: 150px; | ||
} | ||
|
||
::ng-deep .ng-dropdown-panel { | ||
.ng-dropdown-panel-items { | ||
.ng-optgroup { | ||
font-size: 90%; | ||
font-variant: small-caps; | ||
} | ||
|
||
.ng-option { | ||
padding-left: 10px !important; | ||
} | ||
} | ||
} | ||
|
||
.entities-select-toolbar { | ||
display: flex; | ||
|
||
.btn { | ||
flex-grow: 1; | ||
} | ||
} | ||
|
||
.select-all-btn { | ||
cursor: pointer; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/app/components/verse-prose-select/verse-prose-select.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
|
||
import { VerseProseSelectComponent } from './verse-prose-select.component'; | ||
|
||
describe('VerseProseSelectComponent', () => { | ||
let component: VerseProseSelectComponent; | ||
let fixture: ComponentFixture<VerseProseSelectComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ VerseProseSelectComponent ], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(VerseProseSelectComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
src/app/components/verse-prose-select/verse-prose-select.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Component, EventEmitter, Output } from '@angular/core'; | ||
import { TextFlow } from 'src/app/app.config'; | ||
import { EvtIconInfo } from 'src/app/ui-components/icon/icon.component'; | ||
|
||
@Component({ | ||
selector: 'evt-verse-prose-select', | ||
templateUrl: './verse-prose-select.component.html', | ||
styleUrls: ['./verse-prose-select.component.scss'], | ||
}) | ||
|
||
export class VerseProseSelectComponent { | ||
|
||
@Output() textModeSelectionChange: EventEmitter<TextFlow> = new EventEmitter(); | ||
|
||
public textFlowTypes: TextFlow[] = ['prose', 'proseWithVerseNumbers', 'verses']; | ||
|
||
public selectedType: TextFlow = null; | ||
|
||
getProseVersesTogglerIcon(textFlowMode: TextFlow): EvtIconInfo { | ||
return { icon: textFlowMode === 'verses' ? 'align-justify' : 'align-left', iconSet: 'fas' }; | ||
} | ||
|
||
updateSelectedType(textFlowType: TextFlow) { | ||
this.textModeSelectionChange.emit(textFlowType); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters