1 | import { Component, Input } from '@angular/core';
|
2 | var VaFaqsComponent = (function () {
|
3 | function VaFaqsComponent() {
|
4 | this.openFaqs = [];
|
5 | }
|
6 | VaFaqsComponent.prototype.toggleFaq = function (index) {
|
7 | if (this.openFaqs.indexOf(index) >= 0) {
|
8 | this.openFaqs.splice(this.openFaqs.indexOf(index), 1);
|
9 | }
|
10 | else {
|
11 | this.openFaqs.push(index);
|
12 | }
|
13 | };
|
14 | VaFaqsComponent.prototype.isFaqOpen = function (index) {
|
15 | return this.openFaqs.indexOf(index) >= 0;
|
16 | };
|
17 | VaFaqsComponent.prototype.faqIcon = function (index) {
|
18 | return this.isFaqOpen(index) ? 'keyboard_arrow_up' : 'keyboard_arrow_down';
|
19 | };
|
20 | VaFaqsComponent.decorators = [
|
21 | { type: Component, args: [{
|
22 | selector: 'va-faqs',
|
23 | template: "\n <div class=\"va-faq\" *ngFor=\"let faq of faqs; let i = index;\" (click)=\"toggleFaq(i)\">\n <div class=\"question\">\n <span>{{ faq.question }}</span>\n <md-icon>{{ faqIcon(i) }}</md-icon>\n </div>\n <span class=\"answer\" [ngClass]=\"{'show': isFaqOpen(i) }\" [innerHtml]=\"faq.answer | vaSafeHtml\"></span>\n </div>",
|
24 | styles: [".va-faq { font-size: 16px; display: flex; flex-direction: column; justify-content: flex-start; padding: 12px 0; border-bottom: 1px solid #e0e0e0; } .va-faq:first-of-type { border-top: 1px solid #e0e0e0; } .va-faq .question { display: flex; justify-content: space-between; align-items: center; color: #212121; } .va-faq .answer { color: #616161; height: 0; overflow: hidden; } .va-faq .show { padding-top: 12px; height: inherit; } "]
|
25 | },] },
|
26 | ];
|
27 |
|
28 | VaFaqsComponent.ctorParameters = function () { return []; };
|
29 | VaFaqsComponent.propDecorators = {
|
30 | 'faqs': [{ type: Input },],
|
31 | };
|
32 | return VaFaqsComponent;
|
33 | }());
|
34 | export { VaFaqsComponent };
|