Skip to content

Adding email form #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 29 additions & 33 deletions assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ body {
Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
margin: 0;
}

.container {
display: flex;
justify-content: center;
Expand All @@ -12,6 +13,11 @@ body {
width: 100vw;
height: 100vh;
}

#logo-image {
margin-bottom: 30px;
}

.github-link {
display: block;
background: url(github.svg) no-repeat;
Expand All @@ -20,40 +26,30 @@ body {
height: 30px;
overflow: hidden;
line-height: 200px;
margin-top: 60px;
margin-top: 20px;
}
@keyframes rotating {
from {
transform: rotate(0deg);
-o-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
}

to {
transform: rotate(360deg);
-o-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
}

#meetup-notification-form {
color: #fff;
margin: 20px 0;
text-align: center;
}
@-webkit-keyframes rotating {
from {
transform: rotate(0deg);
-webkit-transform: rotate(0deg);

#meetup-notification-form input {
border-radius: 5px;
padding: 10px;
font-size: 20px;
width: 400px;
text-align: center;
}

@media screen and (max-width: 500px) {
#logo-image, #logo-text, #meetup-notification-form {
width: 80%;
}
to {
transform: rotate(360deg);
-webkit-transform: rotate(360deg);

#meetup-notification-form input {
width: calc(100% - 20px);
font-size: 15px;
}
}
.rotating {
margin-bottom: 2rem;
-webkit-animation: rotating 10s linear infinite;
-moz-animation: rotating 10s linear infinite;
-ms-animation: rotating 10s linear infinite;
-o-animation: rotating 10s linear infinite;
animation: rotating 10s linear infinite;
}
}
47 changes: 44 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Expand All @@ -9,11 +10,51 @@
<link rel="stylesheet" href="assets/style.css">
<link rel="icon" sizes="192x192" href="assets/reactssa.png">
</head>

<body>
<div class="container">
<img src="assets/react-logo-fitas.png" alt="Logo do React Salvador composto por fitas do Senhor do Bomfim" class="rotating">
<img src="assets/react-ssa-text.png" alt="Logo do React Salvador composto por fitas do Senhor do Bomfim">
<img id="logo-image" src="assets/react-logo-fitas.png" alt="Logo do React Salvador composto por fitas do Senhor do Bomfim">
<img id="logo-text" src="assets/react-ssa-text.png" alt="Logo do React Salvador composto por fitas do Senhor do Bomfim">

<form id="meetup-notification-form">
<h2>Quer ser avisado sobre os próximos encontros?</h2>
<input type="email" id="email" placeholder="Digite seu email e pressione enter" />
</form>

<a href="https://github.com/ReactSSA" class="github-link">ReactSSA</a>
</div>

<script src="https://www.gstatic.com/firebasejs/5.4.2/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.4.2/firebase-database.js"></script>

<script>
var config = {
apiKey: "AIzaSyDthLRn1-FtkR9duSYmGO5vcxv27Mw6zfY",
authDomain: "reactssa-d6ce0.firebaseapp.com",
databaseURL: "https://reactssa-d6ce0.firebaseio.com",
projectId: "reactssa-d6ce0",
storageBucket: "reactssa-d6ce0.appspot.com",
messagingSenderId: "146802970530"
};
firebase.initializeApp(config);

var emailsStore = firebase.database().ref("emails");

document.getElementById("meetup-notification-form").addEventListener("submit", function(e) {
e.preventDefault();

var emailInputEl = document.getElementById("email");
emailsStore.push({
email: emailInputEl.value
}).then(function() {
emailInputEl.value = "Pronto, anotado!";
emailInputEl.disabled = true;
emailInputEl.style.color = "#229400";
}).catch(function() {
emailInputEl.value = "Erro, nos avise lá no github!";
});
})
</script>
</body>
</html>

</html>