Newer
Older
export interface PhaseValue {
heading: string;
description: string;
links: ProcessBoxLinkValue[];
}
export interface ProcessBoxLinkValue {
label: string;
url: string;
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
}
import {Component, ComponentInterface, h, Prop, Watch} from '@stencil/core';
@Component({
tag: 'hy-large-process-flow-phase',
styleUrl: 'hy-large-process-flow-phase.scss',
shadow: true,
})
export class HyLargeProcessFlowPhase implements ComponentInterface {
private _dataItems: PhaseValue[];
@Prop() dataItems: PhaseValue[] | string;
@Watch('dataItems')
arrayDataWatcher(newValue: PhaseValue[] | string) {
if (typeof newValue === 'string') {
this._dataItems = JSON.parse(newValue);
} else {
this._dataItems = newValue;
}
}
componentWillLoad() {
this.arrayDataWatcher(this.dataItems);
}
render() {
const classAttributes = ['hy-large-process-flow__phase-container'].join(' ');
return (
<div class={classAttributes}>
{this._dataItems.map((x, index) => {
var items;
if (x.links && x.links.length > 0) {
let linkItems = x.links;
let linkItemsCount = x.links.length;
items = linkItems.map((item, index) => {
let classLinks = index == linkItemsCount - 1 ? 'phase-link last' : 'phase-link';
return item ? (
<hy-cta-link
class={classLinks}
link-content={item.label}
sc-label={item.ariaLabel}
is-external={item.isExternal}
url={item.url}
/>
) : null;
});
}
return [
<div class="hy-large-process-flow__phase-container__phase">
<div class="hy-large-process-flow__phase-container__phase__number">
<h2 class="hy-large-process-flow__phase-container__phase__number__number">
<div class="hy-large-process-flow__phase-container__phase__number__title">{index + 1}</div>
</h2>
</div>
<div class="hy-large-process-flow__phase-container__phase__content">
<div class="hy-large-process-flow__phase-container__phase__content__heading">{x.heading}</div>
<div
class="hy-large-process-flow__phase-container__phase__content__description"
innerHTML={x.description}
></div>