<link rel="import" href="/bear-vs/public/assets/components/bear-overlay.html" />
<polymer-element name="bear-popup" attributes="width height fadeIn, fadeOut, zIndex modal modalColor modalOpacity">
<style>
:host {
display: block;
}
a.close {
display: inline-block;
position: absolute;
top: 10px;
right: 10px;
color: #FFFFFF;
background-color: #DD0000;
padding: 2px 10px;
cursor: pointer;
}
</style>
<template>
<bear-overlay id="overlay" on-click="{{hide}}" fadeIn="{{fadeIn}}" fadeOut="{{fadeOut}}" color="{{modalColor}}" opacity="{{modalOpacity}}" zIndex="{{zIndex - 1}}"></bear-overlay>
<div id="popup" class="bear-popup" style="display:none;width:{{width}};height:{{height}};z-index:{{zIndex}}">
<a on-click="{{hide}}" class="close"><i class="fa fa-times"></i></a>
<content></content>
</div>
</template>
<script>
(function() {
var active = false;
Polymer('bear-popup', {
width: '400px',
height: '200px',
fadeIn: 0,
fadeOut: 0,
zIndex: 1000,
modal: false,
modalOpacity: 0.5,
modalColor: '#000000',
show: function() {
if (!active) {
if (this.modal) {
this.$.overlay.show();
}
$(this.$.popup).fadeIn(this.fadeIn);
active = true;
}
},
hide: function() {
$(this.$.popup).fadeOut(this.fadeOut);
this.$.overlay.hide();
active = false;
}
});
})();
</script>
</polymer-element>