-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathHomeView.vue
124 lines (102 loc) · 2.45 KB
/
HomeView.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<template>
<div class="home-view">
<h1>Welcome, {{ isAuthenticated ? user.username : 'warriors' }}!</h1>
<p>
Bug Wars is an exciting battle simulator using pre-scripted bugs or bugs you can program
yourself. For more details on how to play take a look at the 'How to Play' button on the left.
For more information about us, checkout 'Credits'. Please log in or register to play.
</p>
<router-link
:to="isAuthenticated ? '/gamelobby' : '/login'"
class="image-container"
@mouseenter="showGoButton = true"
@mouseleave="showGoButton = false"
>
<div class="image-overlay"></div>
<img
src="../../public/images/home-img.jpg"
alt="Illustration of Bug Wars being played on a computer."
class="computer-illustration"
/>
<div
v-if="showGoButton"
class="go-button"
@click="$router.push(isAuthenticated ? '/gamelobby' : '/login')"
>
Let's Go!
</div>
</router-link>
</div>
</template>
<script setup lang="ts">
import { useAuthStore } from '../stores/auth';
import { ref } from 'vue';
const showGoButton = ref(false);
const { isAuthenticated, user } = useAuthStore();
</script>
<style scoped>
.home-view {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 50px;
text-align: center;
}
h1 {
font-family: 'Press Start 2P', 'Space Mono', Arial, Helvetica, sans-serif;
}
.image-container {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-decoration: none;
width: 50%;
}
.computer-illustration {
width: 100%;
border-radius: 15px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
display: block;
max-width: 100%;
height: auto;
}
.image-container:hover .image-overlay {
display: block;
}
.go-button {
background-color: #f77f00;
color: #f0eeec;
border: none;
border-radius: 5px;
cursor: pointer;
display: none;
position: absolute;
left: 50%;
top: 50%;
padding: 5px;
transform: translate(-50%, -50%);
z-index: 2;
box-shadow: 0px 9px 9px rgba(0, 0, 0, 0.8);
}
.image-container:hover .go-button {
display: flex;
}
.computer-illustration:hover {
transform: scale(0.9);
filter: blur(3px);
cursor: pointer;
}
.image-container:hover .computer-illustration {
transform: scale(0.9);
filter: blur(3px);
}
.go-button:hover {
filter: none;
}
p {
text-align: center;
}
</style>