JSFiddle - React, Tailwind, and code Playground

by joplomacedo

HTML

<div class="harken-loginBoxMask harken-is-inactive">
    <form class="harken-loginBox">
        <p class="harken-loginBoxTitle">Login</p>
    
        <label>O seu email</label>
        <input type="text" />
        
        <label>Password</label>
        <input type="password" />
    
        <p class="harken-errorMsg harken-is-inactive">email e/ou password inválido/s</p>
    
        <button>Login</button>
    </form>
</div>


<button id="login">Login</button>

CSS

.harken-loginBoxMask,
.harken-loginBoxMask * {
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.harken-loginBoxMask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.08);
}

.harken-loginBoxMask.harken-is-inactive {
    display: none;
}

.harken-loginBoxMask.harken-is-active {
    display: block;
}

.harken-loginBox {
    position: relative;
    margin: 25% auto 50px;
    width: 300px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 0 0 4px #f9f9f9;
    font-family: Arial,Tahoma,Helvetica,sans-serif;
    font-size: 14px;
    color: #555;
}

.harken-loginBox .harken-loginBoxTitle {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 10px;
    font-size: 20px;
    color: #4A75A2;
}

.harken-loginBox label,
.harken-loginBox input,
.harken-loginBox button {
    display: block;
}

.harken-loginBox input,
.harken-loginBox button {
    width: 100%;
}

.harken-loginBox label {
    margin-bottom: 2px;
    color: rgb(114, 115, 115);
}

.harken-loginBox input {
    border-radius: 3px;
    border: 1px solid #ccc;
    height: 26px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #727373;
    padding: 0 5px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    outline: none;
}

.harken-loginBox input:hover {
    box-shadow: 0 0 3px #ccc;
    border: 1px solid #838383;
}

.harken-loginBox input:focus {
    box-shadow: 0 0 5px #c9dfe7;
    border: 1px solid #56b4e7;
    -webkit-transition: all .2s ease-in-out .1s;
}

.harken-loginBox .harken-errorMsg {
    font-size: 13px;
    color: red;
    margin-bottom: 10px;
}

.harken-loginBox .harken-errorMsg.harken-is-inactive {
    display: none;
}

.harken-loginBox .harken-errorMsg.harken-is-active {
    display: block;
}

.harken-loginBox .harken-errorMsg:before {
    content: "x ";
    font-size: 14px;
    font-weight: bold;
    color: rgb(189, 4,...

JavaScript

function openLoginBox() {
    $('.harken-loginBoxMask')
        .removeClass('harken-is-inactive')
        .addClass('harken-is-active');
}

function closeLoginBox() {
    $('.harken-loginBoxMask')
        .removeClass('harken-is-active')
        .addClass('harken-is-inactive');
}

function displayErrorMsg() {
    $('.harken-errorMsg')
        .removeClass('harken-is-inactive')
        .addClass('harken-is-active');
}

$('#login').on('click', openLoginBox);