Skip to content

Commit

Permalink
Simplify the way of showing order-status-badge icon
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed Feb 16, 2018
1 parent efa978a commit f64beac
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
padding: 2px 8px;
}

:host([status="delivered"]) #wrapper span,
:host(:not([status="delivered"])) #wrapper iron-icon {
display: none;
}

:host([small]) #wrapper {
padding: 0 5px;
}
Expand All @@ -49,7 +54,11 @@
}
</style>

<div id="wrapper" inner-h-t-m-l="{{_getContent(status)}}"></div>
<div id="wrapper">
<span>[[status]]</span>
<iron-icon icon="vaadin:check"></iron-icon>
</div>

</template>

<script>
Expand All @@ -69,19 +78,9 @@
}

_onStatusChanged(current) {
const lowercase = current ? current.toLowerCase() : current;
if (lowercase != current) {
this.status = lowercase;
}
this.status = current && current.toLowerCase();
}

_getContent(status) {
if (status === 'delivered') {
return '<iron-icon icon="vaadin:check"></iron-icon>';
}

return status;
}
}

window.customElements.define(OrderStatusBadge.is, OrderStatusBadge);
Expand Down

0 comments on commit f64beac

Please sign in to comment.