From 8f0c4394926e0764f6f75b4f6e00b15201ec36eb Mon Sep 17 00:00:00 2001 From: Matteo Manzinello Date: Mon, 16 Sep 2019 22:39:08 +0200 Subject: [PATCH] type introduction --- src/mailgo.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/mailgo.js b/src/mailgo.js index 499478b..cc94b19 100644 --- a/src/mailgo.js +++ b/src/mailgo.js @@ -636,22 +636,23 @@ const validateEmail = email => { }; // show the modal -const showMailgo = () => (getE("mailgo").style.display = "flex"); - -// show the tel modal -const showMailgoTel = () => (getE("mailgo-tel").style.display = "flex"); +const showMailgo = type => { + type === TEL_TYPE + ? setDisplay("mailgo", "flex") + : setDisplay("mailgo-tel", "flex"); +}; // hide the modal const hideMailgo = () => { - getE("mailgo").style.display = "none"; - getE("mailgo-tel").style.display = "none"; + setDisplay("mailgo", "none"); + setDisplay("mailgo-tel", "none"); }; // is the mailgo modal hidden? -const mailgoIsShowing = type => { +const mailgoIsShowing = (type = "mail") => { type === TEL_TYPE - ? getE("mailgo").style.display === "flex" - : getE("mailgo-tel").style.display === "flex"; + ? getDisplay("mailgo") === "flex" + : getDisplay("mailgo-tel") === "flex"; }; // decrypt email