Skip to content

Commit 9ba5e7d

Browse files
author
Sharma
committed
Added an override for the ActionButtons component
1 parent 1f746a5 commit 9ba5e7d

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<div class="button-bar" *ngIf="arMainButtons$ && arSecondaryButtons$">
2+
<div class="left-group">
3+
<button
4+
*ngFor="let aButton of arSecondaryButtons$"
5+
mat-stroked-button
6+
class="secondary-button"
7+
(click)="buttonClick(aButton.jsAction, 'secondary')"
8+
>
9+
{{ localizedVal(aButton.name, localeCategory) }}
10+
</button>
11+
<button *ngFor="let aButton of arMainButtons$" mat-stroked-button class="main-button" (click)="buttonClick(aButton.jsAction, 'secondary')">
12+
{{ localizedVal(aButton.name, localeCategory) }}
13+
</button>
14+
</div>
15+
</div>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.button-bar {
2+
margin-top: 1.2rem;
3+
box-sizing: border-box;
4+
display: flex;
5+
flex-direction: row;
6+
align-items: center;
7+
width: 100%;
8+
padding: 1rem;
9+
}
10+
11+
.left-group,
12+
.right-group {
13+
display: flex;
14+
gap: 1rem;
15+
}
16+
17+
.right-group {
18+
margin-left: auto;
19+
}
20+
21+
.secondary-button {
22+
background-color: var(--app-sys-secondary-button-background) !important;
23+
border-color: var(--app-sys-secondary-button-border) !important;
24+
}
25+
26+
.main-button {
27+
background-color: var(--mat-sys-primary) !important;
28+
color: var(--mat-sys-on-primary) !important;
29+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2+
3+
import { ActionButtonsComponent } from './action-buttons.component';
4+
5+
describe('ActionButtonsComponent', () => {
6+
let component: ActionButtonsComponent;
7+
let fixture: ComponentFixture<ActionButtonsComponent>;
8+
9+
beforeEach(waitForAsync(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ActionButtonsComponent]
12+
}).compileComponents();
13+
}));
14+
15+
beforeEach(() => {
16+
fixture = TestBed.createComponent(ActionButtonsComponent);
17+
component = fixture.componentInstance;
18+
fixture.detectChanges();
19+
});
20+
21+
it('should create', () => {
22+
expect(component).toBeTruthy();
23+
});
24+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Component, Input, Output, EventEmitter } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
import { MatButtonModule } from '@angular/material/button';
4+
5+
@Component({
6+
selector: 'app-action-buttons',
7+
templateUrl: './action-buttons.component.html',
8+
styleUrls: ['./action-buttons.component.scss'],
9+
imports: [CommonModule, MatButtonModule]
10+
})
11+
export class ActionButtonsComponent {
12+
@Input() arMainButtons$: any[];
13+
@Input() arSecondaryButtons$: any[];
14+
15+
@Output() actionButtonClick: EventEmitter<any> = new EventEmitter();
16+
17+
localizedVal = PCore.getLocaleUtils().getLocaleValue;
18+
localeCategory = 'Assignment';
19+
20+
buttonClick(sAction, sButtonType) {
21+
this.actionButtonClick.emit({ action: sAction, buttonType: sButtonType });
22+
}
23+
}

src/app/_samples/mediaco/sdk-mediaco-component-map.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Statically load all "MediaCo" components.
2+
import { ActionButtonsComponent } from './components/action-buttons/action-buttons.component';
23
import { AppShellComponent } from './components/app-shell/app-shell.component';
34
import { BannerComponent } from './components/banner/banner.component';
45
import { ListViewComponent } from './components/list-view/list-view.component';
@@ -13,6 +14,7 @@ import { WssNavBarComponent } from './components/wss-nav-bar/wss-nav-bar.compone
1314
// specific to MediaCo application.
1415

1516
const sdkMediaCoComponentMap = {
17+
ActionButtons: ActionButtonsComponent,
1618
AppShell: AppShellComponent,
1719
Banner: BannerComponent,
1820
ListView: ListViewComponent,

0 commit comments

Comments
 (0)