statki/views/pvp/join.handlebars

86 lines
2.6 KiB
Handlebars
Raw Normal View History

<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Statki</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400;1,700&family=Poppins:ital,wght@0,600;1,600&family=Roboto+Mono:ital@0;1&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/assets/css/board.css">
<style>
.modes {
display: flex;
gap: 2rem;
}
.modes div {
height: 7rem;
width: 15rem;
background: black;
border: solid 1px white;
border-radius: 15px;
user-select: none;
padding: 2rem 3rem;
}
form {
display: flex;
flex-direction: column;
gap: 2rem;
}
form input {
background: black;
color: white;
border-radius: 15px;
border: 1px solid white;
font-size: 1.5rem;
text-align: center;
padding: 0.5rem 2rem;
outline: none;
}
form input[type=submit] {
cursor: pointer;
font-size: 1rem;
transition: all 0.3s;
}
form input[type=submit]:hover {
background: white;
color: black;
}
</style>
</head>
<body>
<div class="container">
<div>
<h1>Statki</h1>
<h2>PvP / Dołącz</h2>
<div class="modes">
<div>
<form action="/api/joinme" id="form">
<input type="text" maxlength="6" id="input" placeholder="Kod pokoju">
<input type="submit" value="Dołącz">
</form>
</div>
</div>
<span class="designerTag">Designed by Maciejka</span>
<script>
const form = document.getElementById('form');
const input = document.getElementById('input');
form.addEventListener('submit', (e) => {
e.preventDefault();
if (input.value && input.value.length===6) {
socket.emit('join game', input.value);
input.value = '';
}
});
</script>
</div>
</div>
</body>
</html>