import Vue, { CreateElement, VNode } from "vue";
import { Component, Prop } from "vue-property-decorator";
import variables from "../../../lib/variables.json";
@Component
class Ussd extends Vue {
@Prop({ default: "" }) status: String;
@Prop({ default: "" }) hintText: String;
@Prop({ default: "right" }) hintOrient: String;
@Prop({ default: null }) mobileHintOrient: String;
hintOrientLocal: String = this.hintOrient;
mobileHintOrientLocal: String = this.mobileHintOrient;
type: String;
checkResize() :void{
const width = document.body.clientWidth;
if (width <= parseInt(variables["tablet-upper-limit"])) {
if (width <= parseInt(variables["mobile-upper-limit"])) {
if(this.type != 'mobile') {
this.type = 'mobile'
}
}else{
if(this.type != 'mobile') {
this.type = 'mobile'
}
}
} else {
if(this.type != 'desktop') {
this.type = 'desktop'
}
}
}
mounted() {
// window.addEventListener("resize", this.checkResize);
this.mobileHintOrientLocal = this.mobileHintOrient;
this.hintOrientLocal = this.hintOrient;
if(!this.mobileHintOrient){
this.mobileHintOrientLocal = this.hintOrientLocal
}
}
render(h: CreateElement): VNode {
let iconClassName = "rt-validation-icon";
if(this.status.length > 0){
iconClassName += " rt-validation-icon--"+this.status
}
if(this.hintText.length > 0){
iconClassName += " rt-hint"
iconClassName += ` rt-hint--${this.hintOrientLocal}-orient rt-md-hint--${this.mobileHintOrientLocal}-orient`
}
switch (this.status) {
case 'error':
return
break;
case 'success':
return
break;
default:
return
}
}
}
export default {
component: Ussd,
name: "RtValidationIcon"
};