2018-05-17 14:30:17 +02:00
|
|
|
<template>
|
2018-06-07 00:01:29 +02:00
|
|
|
<div id="email-subscribe" class="newsletter-cta">
|
2018-06-13 01:28:30 +02:00
|
|
|
<h3 class="newsletter-cta__title">Don't Miss A Bit - Subscribe For LBRY Technical Updates</h3>
|
2018-06-21 00:08:47 +02:00
|
|
|
|
2018-06-07 00:01:29 +02:00
|
|
|
<div>
|
|
|
|
<input type="text" class="newsletter-cta__input" v-model="emailAddress" placeholder="you@domain.tld">
|
2018-06-19 00:09:11 +02:00
|
|
|
<a class="newsletter-cta__submit" href="#" v-on:click.prevent="subscribe" title="Subscribe to our technical newsletter">Subscribe</a>
|
2018-06-07 00:01:29 +02:00
|
|
|
</div>
|
2018-06-21 00:08:47 +02:00
|
|
|
|
2018-06-07 00:01:29 +02:00
|
|
|
<p v-if="message" class="newsletter-cta__message">{{ message }}</p>
|
2018-05-17 14:30:17 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-06-21 00:08:47 +02:00
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
emailAddress: "",
|
|
|
|
message: ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
subscribe () {
|
|
|
|
let component = this;
|
|
|
|
component.message = "";
|
|
|
|
|
|
|
|
if (!component.validateEmail(component.emailAddress)) {
|
|
|
|
component.message = "Your email is not valid!";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
component.$http.post("//api.lbry.io/list/subscribe", {
|
|
|
|
email: component.emailAddress,
|
|
|
|
tag: "developer"
|
2018-05-17 17:20:11 +02:00
|
|
|
}, {
|
|
|
|
emulateJSON: true
|
2018-06-21 00:08:47 +02:00
|
|
|
}).then(response => {
|
|
|
|
component.email = "";
|
|
|
|
component.message = "Thank you for subscribing!";
|
|
|
|
}, response => {
|
|
|
|
if (response.status === 409) component.message = "You have already subscribed to our mailing list!";
|
2018-05-17 14:30:17 +02:00
|
|
|
});
|
2018-06-21 00:08:47 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
validateEmail (email) {
|
|
|
|
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
|
|
return re.test(String(email).toLowerCase());
|
2018-05-17 14:30:17 +02:00
|
|
|
}
|
|
|
|
},
|
2018-06-21 00:08:47 +02:00
|
|
|
|
|
|
|
name: "EmailSubscribe"
|
|
|
|
};
|
2018-05-17 14:30:17 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2018-06-07 00:01:29 +02:00
|
|
|
@import "../scss/init/colors";
|
|
|
|
@import "../scss/init/extends";
|
|
|
|
@import "../scss/init/mixins";
|
2018-05-17 14:30:17 +02:00
|
|
|
|
2018-06-07 00:01:29 +02:00
|
|
|
.newsletter-cta {
|
|
|
|
background-color: rgba($black, 0.2);
|
|
|
|
padding-top: 1rem;
|
|
|
|
padding-bottom: 1rem;
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
> div:first-of-type {
|
|
|
|
margin-right: auto;
|
|
|
|
margin-left: auto;
|
2018-06-07 00:28:52 +02:00
|
|
|
|
|
|
|
@media (min-width: 551px) {
|
|
|
|
width: 500px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 550px) {
|
|
|
|
width: 90%;
|
|
|
|
}
|
2018-06-07 00:01:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
@include clearfix;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.newsletter-cta__title {
|
|
|
|
font-size: 0.8rem;
|
|
|
|
letter-spacing: 0.05rem;
|
|
|
|
margin-bottom: 0.75rem;
|
|
|
|
text-transform: uppercase;
|
|
|
|
}
|
|
|
|
|
|
|
|
.newsletter-cta__input,
|
|
|
|
.newsletter-cta__submit {
|
|
|
|
@extend .__button-padding-horizontal;
|
|
|
|
border-style: solid;
|
|
|
|
border-width: 1px;
|
2018-06-07 00:28:52 +02:00
|
|
|
|
|
|
|
@media (max-width: 550px) {
|
|
|
|
width: 100%;
|
|
|
|
}
|
2018-05-17 14:30:17 +02:00
|
|
|
}
|
2018-06-07 00:01:29 +02:00
|
|
|
|
|
|
|
.newsletter-cta__input {
|
|
|
|
background-color: $white;
|
2018-06-07 00:28:52 +02:00
|
|
|
font-size: 1rem;
|
|
|
|
height: 38px;
|
2018-06-07 00:01:29 +02:00
|
|
|
transition: border 0.2s;
|
|
|
|
|
2018-06-07 00:28:52 +02:00
|
|
|
@media (min-width: 551px) {
|
|
|
|
float: left;
|
|
|
|
width: calc(100% - 112px);
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 550px) {
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
2018-06-07 00:01:29 +02:00
|
|
|
&:not(:focus) {
|
|
|
|
border-top-color: $black;
|
|
|
|
border-left-color: $black;
|
2018-06-07 00:28:52 +02:00
|
|
|
|
|
|
|
@media (min-width: 551px) {
|
|
|
|
border-bottom-color: $black;
|
|
|
|
border-right-color: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 550px) {
|
|
|
|
border-bottom-color: transparent;
|
|
|
|
border-right-color: $black;
|
|
|
|
}
|
2018-06-07 00:01:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
border-top-color: mix($black, $teal, 20%);
|
|
|
|
border-left-color: mix($black, $teal, 20%);
|
2018-06-07 00:28:52 +02:00
|
|
|
|
|
|
|
@media (min-width: 551px) {
|
|
|
|
border-bottom-color: mix($black, $teal, 20%);
|
|
|
|
border-right-color: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 550px) {
|
|
|
|
border-bottom-color: transparent;
|
|
|
|
border-right-color: mix($black, $teal, 20%);
|
|
|
|
}
|
2018-06-07 00:01:29 +02:00
|
|
|
}
|
2018-05-17 14:30:17 +02:00
|
|
|
}
|
2018-06-07 00:01:29 +02:00
|
|
|
|
|
|
|
.newsletter-cta__submit {
|
|
|
|
@extend .__button-basic;
|
|
|
|
@extend .__button-padding-vertical;
|
|
|
|
color: $white;
|
2018-06-07 00:28:52 +02:00
|
|
|
|
|
|
|
@media (min-width: 551px) {
|
|
|
|
float: right;
|
|
|
|
left: -1px;
|
|
|
|
width: 112px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 550px) {
|
|
|
|
display: block;
|
|
|
|
top: -1px;
|
|
|
|
}
|
2018-06-07 00:01:29 +02:00
|
|
|
|
|
|
|
&:not(:hover) {
|
|
|
|
background-color: $black;
|
|
|
|
border-color: $black;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background-color: $teal;
|
|
|
|
border-color: mix($black, $teal, 20%);
|
|
|
|
}
|
2018-05-17 14:30:17 +02:00
|
|
|
}
|
|
|
|
|
2018-06-07 00:01:29 +02:00
|
|
|
.newsletter-cta__message {
|
2018-06-07 00:28:52 +02:00
|
|
|
@include clearfix;
|
|
|
|
color: $red;
|
2018-06-07 00:01:29 +02:00
|
|
|
padding-top: 1rem;
|
|
|
|
}
|
|
|
|
</style>
|