Skip to content
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

fix: form error message #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
53 changes: 30 additions & 23 deletions docs/.vuepress/components/EmailForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,15 @@
<div>
<GradientBox>
<form class="newsletter-form-input" @submit.prevent="onSubmit()">
<input type="email" required placeholder="Your email" v-model="email"/>
<button v-if="!loading" type="submit" class="gradient-text">SIGN UP</button>
<input
type="email"
required
placeholder="Your email"
v-model="email"
/>
<button v-if="!loading" type="submit" class="gradient-text">
SIGN UP
</button>
</form>
</GradientBox>
<div v-show="message" class="newsletter-form-error">
Expand Down Expand Up @@ -91,26 +98,26 @@ export default {
},
methods: {
checkUserPreference() {
if (localStorage.getItem("dark-theme")) {
if (localStorage.getItem('dark-theme')) {
this.darkMode = true;
}
},
onSubmit() {
this.loading = true
this.loading = true;
const data = {
email: this.email,
}
fetch('https://umee.cc/.netlify/functions/subscribe', {method: 'post', body: JSON.stringify(data)})
.then(
(_response) => {
this.message = "You have been added to Umee's mailing list"
this.loading = false
},
(_response) => {
this.message = 'There was a problem adding you to the mailing list.'
this.loading = false
}
)
};
fetch('https://umee.cc/.netlify/functions/subscribe', {
method: 'post',
body: JSON.stringify(data),
})
.then((_response) => {
this.message = "You have been added to Umee's mailing list";
})
.catch((_response) => {
console.log(_response)
this.message = 'There was a problem adding you to the mailing list.';
}).finally(() => this.loading = false);
},
},
};
Expand Down Expand Up @@ -139,9 +146,9 @@ export default {
align-items: center;

.unsubscribe {
margin-top: .5rem;
margin-top: 0.5rem;
font-size: 0.9rem;
opacity: .5;
opacity: 0.5;
}

&:hover &-image-item {
Expand Down Expand Up @@ -200,7 +207,7 @@ export default {
width: 45%;
}

@media(max-width: 1024px) {
@media (max-width: 1024px) {
display: block;

& > div {
Expand All @@ -212,7 +219,7 @@ export default {
}
}

@media(max-width: 768px) {
@media (max-width: 768px) {
padding: 1.5rem;
}
}
Expand Down Expand Up @@ -241,13 +248,13 @@ export default {
}
}
&-error {
margin-top: .5rem;
margin-top: 0.5rem;
}

margin-left: 280px;
width: 100%;

@media(max-width: 768px) {
@media (max-width: 768px) {
margin-left: 0;
margin-top: 280px;
}
Expand Down