-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
60 lines (54 loc) · 2.29 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub search</title>
<link rel="stylesheet" href="css/main.css">
<script src="https://unpkg.com/vue@3"></script>
</head>
<body>
<div id="app">
<!-- Favorites -->
<div class="favorites">
<div class="favorite" v-for="favorite in allFavorites">
<a @click.prevent="showFavorite(favorite)" href="#" target="_blank">
<img :src="favorite.avatar_url" :alt="favorite.name" class="favorite__avatar">
</a>
</div>
</div>
<!-- Content -->
<article class="content">
<h1 class="content__title">Search GitHub users</h1>
<!-- Search -->
<!-- V-ON es la directiva -->
<!-- Submit es el evento que quiero escuchar -->
<!-- Prevent es el modificador -->
<form class="search" v-on:submit.prevent="doSearch">
<input v-model="search" type="text" class="search__input" required placeholder="Search GitHub users">
<input type="submit" class="search__submit" value="Search">
</form>
<!-- Result -->
<Transition>
<div class="result" v-if="result">
<a v-if="isFavorite" href="#" class="result__toggle-favorite" @click="addFavorite">Add Favorite ⭐</a>
<a v-else href="#" class="result__toggle-favorite" @click="removeFavorite">Remove Favorite ⭐</a>
<h2 class="result__name">{{result.name}}</h2>
<img v-bind:src="result.avatar_url" :alt="result.name" class="result__avatar">
<p class="result__bio">{{result.bio}}
<br>
<a :href="result.blog" target="_blank" class="result__blog">{{result.blog}}</a>
</p>
</div>
</Transition>
<!--Error -->
<div class="result__error" v-if="error">{{error}}</div>
</article>
</div>
<script src="js/main.js"></script>
<script>
const mountedApp = app.mount("#app")
</script>
</body>
</html>