-
Notifications
You must be signed in to change notification settings - Fork 5
/
open-form.vue
46 lines (43 loc) · 1.75 KB
/
open-form.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<template>
<div>
<form class="flex flex-col items-center w-full mb-3 md:flex-row md:px-16" @submit.prevent="open">
<input placeholder="Diary Code" required="" type="text" v-model="diaryCode"
class="flex-grow w-full h-12 px-4 mb-3 transition duration-200 bg-white border border-gray-300 rounded shadow-sm appearance-none md:mr-2 md:mb-0 focus:border-simplydiarynew-secondary focus:outline-none focus:shadow-outline" />
<button type="submit" :href="`https://simply-diary.xyz/diarys/${this.diaryCode}`"
class="inline-flex items-center justify-center w-full h-12 px-6 font-medium tracking-wide text-white transition duration-200 rounded shadow-md md:w-auto bg-simplydiarynew-primary hover:bg-simplydiarynew-secondary focus:shadow-outline focus:outline-none">
Open
</button>
</form>
<div class="flex flex-col items-center w-full mb-4 md:flex-row md:px-16">
<input v-model="remember" type="checkbox"
class="form-checkbox text-simplydiarynew-primary bg-white border border-gray-500 focus:border-simplydiarynew-secondary focus:outline-none focus:shadow-outline"
checked>
<span class="ml-2 font-nunito text-gray-700 tracking-wide">Remember my Diary</span>
</div>
</div>
</template>
<script>
export default {
data() {
return {
diaryCode: '',
remember: ''
}
},
methods: {
async open() {
if (this.remember) {
if (process.client) {
localStorage.setItem("diaryCode", this.diaryCode)
}
}
this.$router.push(`/diarys/${this.diaryCode}`);
}
},
mounted: async function () {
if (process.client) {
this.diaryCode = localStorage.getItem("diaryCode") || "";
}
}
}
</script>