Commit 58466c6e4c3d91ed0b01658f786ba4252c51050e
1 parent
7dcb21e1ce
Exists in
master
Creado componente popover.
Showing
4 changed files
with
87 additions
and
0 deletions
Show diff stats
src/app/components/popover/popover.component.html
| File was created | 1 | <div class="card-body"> | |
| 2 | <div class="row"> | ||
| 3 | <div class="col"> | ||
| 4 | <p class="h5 card-title"> | ||
| 5 | Este producto forma parte<br> | ||
| 6 | de Combos y Promociones | ||
| 7 | </p> | ||
| 8 | </div> | ||
| 9 | </div> | ||
| 10 | |||
| 11 | <div class="row"> | ||
| 12 | <div class="col text-dark"> | ||
| 13 | <div class="bg-white rounded-sm p-2 px-3"> | ||
| 14 | <div class="row justify-content-between"> | ||
| 15 | <div class="col-auto"> | ||
| 16 | <p class="h4 font-weight-bold mb-0">Promo 2x1</p> | ||
| 17 | <p class="h6 mb-0">{{popoverContent}}</p> | ||
| 18 | </div> | ||
| 19 | <div class="col-4 text-right my-auto"> | ||
| 20 | <p class="h3 font-weight-bold mb-0">{{28 | currency}}</p> | ||
| 21 | </div> | ||
| 22 | </div> | ||
| 23 | </div> | ||
| 24 | </div> | ||
| 25 | </div> | ||
| 26 | |||
| 27 | <div class="row mt-3 justify-content-end"> | ||
| 28 | <div class="col-auto"> | ||
| 29 | <button | ||
| 30 | type="button" | ||
| 31 | class="btn btn-sm btn-light shadow" | ||
| 32 | (click)="hide()"> | ||
| 33 | <span class="pr-2">No, gracias</span> | ||
| 34 | <i class="fa fa-times text-danger" aria-hidden="true"></i> | ||
| 35 | </button> | ||
| 36 | </div> | ||
| 37 | </div> | ||
| 38 | |||
| 39 | </div> |
src/app/components/popover/popover.component.scss
src/app/components/popover/popover.component.spec.ts
| File was created | 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
| 2 | |||
| 3 | import { PopoverComponent } from './popover.component'; | ||
| 4 | |||
| 5 | describe('PopoverComponent', () => { | ||
| 6 | let component: PopoverComponent; | ||
| 7 | let fixture: ComponentFixture<PopoverComponent>; | ||
| 8 | |||
| 9 | beforeEach(async(() => { | ||
| 10 | TestBed.configureTestingModule({ | ||
| 11 | declarations: [ PopoverComponent ] | ||
| 12 | }) | ||
| 13 | .compileComponents(); | ||
| 14 | })); | ||
| 15 | |||
| 16 | beforeEach(() => { | ||
| 17 | fixture = TestBed.createComponent(PopoverComponent); | ||
| 18 | component = fixture.componentInstance; | ||
| 19 | fixture.detectChanges(); | ||
| 20 | }); | ||
| 21 | |||
| 22 | it('should create', () => { | ||
| 23 | expect(component).toBeTruthy(); | ||
| 24 | }); | ||
| 25 | }); | ||
| 26 |
src/app/components/popover/popover.component.ts
| File was created | 1 | import { Component, OnInit, Input } from '@angular/core'; | |
| 2 | import { PopoverDirective } from 'ngx-bootstrap/popover'; | ||
| 3 | |||
| 4 | @Component({ | ||
| 5 | selector: 'app-popover', | ||
| 6 | templateUrl: './popover.component.html', | ||
| 7 | styleUrls: ['./popover.component.scss'] | ||
| 8 | }) | ||
| 9 | export class PopoverComponent implements OnInit { | ||
| 10 | |||
| 11 | @Input() popover: PopoverDirective; | ||
| 12 | @Input() popoverContent: string; | ||
| 13 | |||
| 14 | constructor() { } | ||
| 15 | |||
| 16 | ngOnInit() { | ||
| 17 | } | ||
| 18 | |||
| 19 | hide() { | ||
| 20 | this.popover.hide(); | ||
| 21 | } | ||
| 22 | |||
| 23 | } | ||
| 24 |