-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
187 lines (135 loc) · 8.66 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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=4, initial-scale=1.0">
<title>Delivery Services</title>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
</head>
<body class="bg-gray-200">
<div class="container mx-auto">
<div class="flex flex-col justify-center items-center py-10" x-data="loadShops()" x-init="fetch('./shops.json')
.then(response => response.json())
.then(data => shops = data)">
<div class="flex flex-col items-center">
<h1 class="text-gray-800 font-bold text-4xl">Delivery Services</h1>
<p class="text">Your local delivery services.</p>
</div>
<div class="px-3 mb-6 mt-6">
<input x-ref="searchField" x-model="search"
class="text-gray-700 border rounded py-3 px-10 mb-3 leading-tight focus:outline-none focus:bg-gray-300"
type="search" placeholder="Search">
</div>
<div class="bg-white rounded shadow-sm flex mt-2">
<ul>
<template x-for="item in filteredShops" :key="item">
<li class="border border-gray-300">
<div class="flex justify-between px-12 py-2">
<div>
<h3 class="text-blue-500 font-bold text-sm mb-1" x-text="item.name"></h3>
<div class="flex items-center">
<svg class="flex-shrink-0 mr-1 h-5 w-5 text-gray-400" fill="currentColor"
viewBox="0 0 20 20">
<path
d="M2 3a1 1 0 011-1h2.153a1 1 0 01.986.836l.74 4.435a1 1 0 01-.54 1.06l-1.548.773a11.037 11.037 0 006.105 6.105l.774-1.548a1 1 0 011.059-.54l4.435.74a1 1 0 01.836.986V17a1 1 0 01-1 1h-2C7.82 18 2 12.18 2 5V3z">
</path>
</svg>
<p class="text-gray-700" x-text="item.number"></p>
</div>
</div>
<div class="ml-16 flex">
<template x-if="!item.cash">
<div>
<span
class="flex relative inline-block px-3 py-1 font-semibold text-green-900 leading-tight">
<span aria-hidden
class="absolute inset-0 bg-red-200 opacity-50 rounded-full"></span>
<span class="relative">Cash</span>
<svg class="flex-shrink-0 mr-1.5 h-5 w-5 text-red-400"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clip-rule="evenodd" fill-rule="evenodd"></path>
</svg>
</span>
</div>
</template>
<template x-if="item.cash">
<div>
<span
class="flex relative inline-block px-3 py-1 font-semibold text-green-900 leading-tight">
<span aria-hidden
class="absolute inset-0 bg-green-200 opacity-50 rounded-full"></span>
<span class="relative">Cash</span>
<svg class="flex-shrink-0 mr-1.5 h-5 w-5 text-green-400"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clip-rule="evenodd" fill-rule="evenodd"></path>
</svg>
</span>
</div>
</template>
<template x-if="item.transfer">
<div>
<span
class="flex relative inline-block px-3 py-1 font-semibold text-green-900 leading-tight">
<span aria-hidden
class="absolute inset-0 bg-green-200 opacity-50 rounded-full"></span>
<span class="relative">Transfer</span>
<svg class="flex-shrink-0 mr-1.5 h-5 w-5 text-green-400"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clip-rule="evenodd" fill-rule="evenodd"></path>
</svg>
</span>
</div>
</template>
<template x-if="!item.transfer">
<div>
<span
class="flex relative inline-block px-3 py-1 font-semibold text-green-900 leading-tight">
<span aria-hidden
class="absolute inset-0 bg-red-200 opacity-50 rounded-full"></span>
<span class="relative">Transfer</span>
<svg class="flex-shrink-0 mr-1.5 h-5 w-5 text-red-400"
fill="currentColor" viewBox="0 0 20 20">
<path
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clip-rule="evenodd" fill-rule="evenodd"></path>
</svg>
</span>
</div>
</template>
</div>
</div>
</li>
</template>
</ul>
</div>
</div>
<footer class="text-center">
<p class="text-gray-700 font-semibold">Developed by <a class="text-blue-700"
href="https://baraveli.xyz/">Baraveli</a></p>
</footer>
</div>
<script>
function loadShops() {
return {
search: '',
shops: [],
get filteredShops() {
if (this.search === '') {
return this.shops
}
return this.shops.filter(item => {
return item.name.toLowerCase().includes(this.search.toLowerCase())
})
}
}
}
</script>
</body>
</html>