Skip to content

Commit

Permalink
Merge pull request #289 from TAMULib/sprint17-270-tl-modal
Browse files Browse the repository at this point in the history
Sprint17 270 tl modal
  • Loading branch information
rmathew1011 committed Apr 13, 2021
2 parents f281e51 + b109a65 commit e131c0c
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/tl-button/tl-button.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
*ngIf="href!== ''"
[themeVariant]="themeVariant"
[btnSize]="btnSize"
[btnTxt]="btnTxt"
[dispatchAction]="dispatchAction"
[dispatchActionProps]="dispatchActionProps"
[href]="href"
[wvrBtnType]="wvrBtnType">
<ng-content select="wvre-text, wvr-text-component" ngProjectAs="wvre-btn-content"></ng-content>
Expand All @@ -11,6 +14,9 @@
*ngIf="href === ''"
[themeVariant]="themeVariant"
[btnSize]="btnSize"
[btnTxt]="btnTxt"
[dispatchAction]="dispatchAction"
[dispatchActionProps]="dispatchActionProps"
[wvrBtnType]="wvrBtnType">
<ng-content select="wvre-text, wvr-text-component" ngProjectAs="wvre-btn-content"></ng-content>
</wvr-button-component>
Expand Down
6 changes: 6 additions & 0 deletions src/app/tl-button/tl-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export class TlButtonComponent extends TamuAbstractBaseComponent {
/** Allows for the button component to be an anchor tag component if hrefUrl property present. */
@Input() href;

@Input() btnTxt;

@Input() dispatchAction;

@Input() dispatchActionProps;

// tslint:disable-next-line:unnecessary-constructor
constructor(injector: Injector) {
super(injector);
Expand Down
3 changes: 3 additions & 0 deletions src/app/tl-lib.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { TlIconComponent } from './tl-icon/tl-icon.component';
import { TamuItWorksComponent } from './tl-it-works/tl-it-works.component';
import { TlMegaMenuSectionComponent } from './tl-mega-menu/tl-mega-menu-section/tl-mega-menu-section.component';
import { TlMegaMenuComponent } from './tl-mega-menu/tl-mega-menu.component';
import { TlModalComponent } from './tl-modal/tl-modal.component';
import { TamuNavListComponent } from './tl-nav-list/tl-nav-list.component';
import { TlTabComponent } from './tl-tabs/tl-tab/tl-tab.component';
import { TlTabsComponent } from './tl-tabs/tl-tabs.component';
Expand All @@ -39,6 +40,7 @@ const TL_ELEMENTS = [
{ component: TlIconComponent, selector: 'tl-icon' },
{ component: TamuItWorksComponent, selector: 'tl-it-works' },
{ component: TlMegaMenuComponent, selector: 'tl-mega-menu' },
{ component: TlModalComponent, selector: 'tl-modal'},
{ component: TlMegaMenuSectionComponent, selector: 'tl-mega-menu-section' },
{ component: TamuNavListComponent, selector: 'tl-nav-list' },
{ component: TlTabsComponent, selector: 'tl-tabs' },
Expand All @@ -58,6 +60,7 @@ const TL_COMPONENTS = [
TlIconComponent,
TlMegaMenuComponent,
TlMegaMenuSectionComponent,
TlModalComponent,
TamuNavListComponent,
TlTabsComponent,
TlTabComponent,
Expand Down
7 changes: 7 additions & 0 deletions src/app/tl-modal/tl-modal.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<wvr-modal-component #animationRoot
[themeVariant]="btnThemeVariant"
[title]="title"
[btnText]="btnText">
<ng-content select="tl-modal-body" ngProjectAs="wvre-modal-body"></ng-content>
<ng-content select="tl-modal-footer" ngProjectAs="wvre-modal-footer"></ng-content>
</wvr-modal-component>
14 changes: 14 additions & 0 deletions src/app/tl-modal/tl-modal.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@import "../shared/styles/tl-encapsulated.scss";
@import "../shared/styles/tl-branded-btn.scss";

:host {

wvr-modal-component {
font-family: var(--tl-font-family-sans-serif);
::ng-deep {
.wvr-modal {
font-family: var(--tl-font-family-sans-serif);
}
}
}
}
42 changes: 42 additions & 0 deletions src/app/tl-modal/tl-modal.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { provideMockStore } from '@ngrx/store/testing';
import { APP_CONFIG, testAppConfig } from '@wvr/elements';
import { TlModalComponent } from './tl-modal.component';

describe('TlModalComponent', () => {
let component: TlModalComponent;
let fixture: ComponentFixture<TlModalComponent>;
const initialState = { theme: {
themes: {}
}};

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
BrowserAnimationsModule
],
providers: [
provideMockStore({initialState}),
{
provide: APP_CONFIG,
useValue: testAppConfig
}
],
declarations: [ TlModalComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(TlModalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component)
.toBeTruthy();
});

});
25 changes: 25 additions & 0 deletions src/app/tl-modal/tl-modal.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Component, Injector, Input } from '@angular/core';
import { TamuAbstractBaseComponent } from '../shared/tl-abstract-base.component';

@Component({
selector: 'tl-modal-component',
templateUrl: './tl-modal.component.html',
styleUrls: ['./tl-modal.component.scss']
})
export class TlModalComponent extends TamuAbstractBaseComponent {

btnThemeVariant = 'primary';

@Input() title;

@Input() btnText;

constructor(injector: Injector) {
super(injector);
}

ngOnInit(): void {
super.ngOnInit();
}

}
12 changes: 12 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,18 @@
<tl-it-works text="TAMU Library Components Work Really Well"></tl-it-works>

<hr><br><br><br>
<div class="container" style="text-align: center;margin: 10px 60px;">
<wvre-text value="Modal Component" text-decoration="underline"></wvre-text><br /><br />
<tl-modal title="Tl Modal Title" btn-text="Launch Tl Modal Button">
<tl-modal-body>
<wvre-text value="Tl Modal Message"></wvre-text>
</tl-modal-body>
<tl-modal-footer>
<tl-button btn-txt="Cancel" theme-variant="secondary" dispatch-action="Modal.closeModal" dispatch-action-props="{id: 'Tl Modal Title'}">
</tl-button>
</tl-modal-footer>
</tl-modal>
</div>
<div class="container" style="text-align: center;margin: 10px 60px;">
<wvre-text value="Editor Component" text-decoration="underline"></wvre-text><br /><br />
<tl-wysiwyg></tl-wysiwyg> <br /><br />
Expand Down

0 comments on commit e131c0c

Please sign in to comment.