generated from antfu-collective/vitesse-webext
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPopup.vue
157 lines (139 loc) · 3.89 KB
/
Popup.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
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
<script setup lang="ts">
import { storageDemo } from '~/logic/storage'
import IconClean from '~icons/carbon/clean'
import { useAddKeyword } from '~/composables/useAddKeyword'
const newKeyword = ref('')
const { addKeyword } = useAddKeyword()
const handleChange = () => {
addKeyword(newKeyword.value)
newKeyword.value = ''
}
const handleRemoveKeyword = (index: number) => {
storageDemo.value.keywords.splice(index, 1)
}
</script>
<template>
<main class="w-[360px] text-gray-700">
<div class="px-6 py-4 flex items-center">
<IconClean class="text-xl" color="#1d9bf0" />
<h1 class="text-base font-bold ml-2">
Clean twitter (X.com)
</h1>
</div>
<hr>
<div class="px-7 pt-4 flex flex-col">
<h3 class="text-sm font-bold">
Keywords
</h3>
<div
class="border border-gray100 rounded mt-1 p-2 flex flex-wrap items-start h-160px overflow-auto"
>
<div class="flex flex-wrap items-start overflow-y-auto gap-1">
<div
v-for="(keyword, index) in storageDemo.keywords"
:key="keyword"
class="pill"
>
{{ keyword }}
<button
class="cursor-pointer text-base"
@click="handleRemoveKeyword(index)"
>
×
</button>
</div>
</div>
</div>
<textarea
v-model="newKeyword"
autofocus
class="border border-gray300 mt-3 rounded p-2 resize-none"
placeholder="Enter a new keyword and press enter to add it"
@keyup.enter="handleChange"
/>
<button
:disable="!newKeyword"
class="mt-2 bg-#1d9bf0 text-white px-4 py-2 rounded font-bold"
@click="handleChange"
>
Add keyword
</button>
</div>
<hr class="my-4">
<div class="px-7 pb-4 flex flex-col">
<h3 class="text-sm font-bold">
Options
</h3>
<div class="mt-1 flex gap-2">
<input
id="hide-ads"
v-model="storageDemo.hideTwitterAds"
type="checkbox"
name="hide-ads"
>
<label for="hide-ads">Hide Ads</label>
</div>
<div class="mt-1 flex gap-2">
<input
id="hide-follow-people"
v-model="storageDemo.hidePeopleToFollowSuggestion"
type="checkbox"
name="hide-follow-people"
>
<label for="hide-follow-people">Hide "People to follow" suggestions</label>
</div>
<div class="mt-1 flex gap-2">
<input
id="hide-subscribe"
v-model="storageDemo.hideSubscriptionSuggesstion"
type="checkbox"
name="hide-subscribe"
>
<label for="hide-subscribe">Hide "Subscribe" suggestions</label>
</div>
<hr class="my-2">
<div class="mt-1 flex gap-2">
<input
id="show-icon"
v-model="storageDemo.showFloatingIcon"
type="checkbox"
name="show-icon"
>
<label for="show-icon">Show floating icon</label>
</div>
<div class="mt-1 flex gap-2">
<input
id="hide-tweet"
v-model="storageDemo.showPlaceholderForHiddenTweet"
type="checkbox"
name="hide-tweet"
>
<label for="hide-tweet">Show Placeholder When Tweet is Hidden</label>
</div>
<div class="mt-1 flex gap-2">
<input
id="hide-ads"
v-model="storageDemo.showPlaceholderForHiddenAds"
type="checkbox"
name="hide-ads"
>
<label for="hide-ads">Show Placeholder When Ad/suggestion is Hidden </label>
</div>
</div>
</main>
</template>
<style scoped>
.pill {
display: flex;
align-items: center;
background-color: #f1f1f1;
border-radius: 12px;
padding: 0 8px;
height: min-content;
word-break: break-all;
gap: 8px
}
input[type="checkbox"] {
accent-color: #1d9bf0;
}
</style>