This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
SuggestedApps.vue
113 lines (104 loc) · 2.14 KB
/
SuggestedApps.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
<template>
<div :class="$style.wrap">
<button
v-for="app in apps"
:key="app.url"
:class="$style.btn"
@click="createTab(app)"
>
<div :class="$style.thumb">
<img
:class="$style.img"
:src="app.icon"
:alt="app.label"
>
</div>
<div :class="$style.label">
{{ app.label }}
</div>
</button>
<router-link
:class="$style.btn"
:to="{
name: 'tabs-create',
}"
>
<div :class="$style.thumb">
<app-icon
:size="8"
face="tab-plus"
/>
</div>
<div :class="$style.label">
Create
</div>
</router-link>
</div>
</template>
<script>
import shuffleArray from 'shuffle-array';
import apps from '@/data/recommended-apps.json';
export default {
computed: {
existingTabs() {
return this.$store.getters['Tabs/list'];
},
apps() {
const existing = this.existingTabs;
const filtered = apps.filter(app => !existing.some(e => e.url.includes(app.filter)));
return shuffleArray(filtered);
},
},
methods: {
createTab({ label, url }) {
this.$store.dispatch('Tabs/create', { label, url });
},
},
};
</script>
<style lang="postcss" module>
.wrap {
@apply p-8 pb-6 bg-gray-900 rounded;
display: grid;
grid-column-gap: theme('padding.8');
grid-row-gap: theme('padding.4');
grid-template-columns: repeat(auto-fill, minmax(theme('width.24'), 1fr));
}
.btn {
@apply
relative mb-8
text-center bg-gray-700 rounded shadow-lg;
}
.btn::before {
@apply block;
padding-top: 100%;
content: "";
}
.btn:hover::after {
@apply
absolute inset-0 flex flex-col justify-center
text-4xl text-white leading-none
opacity-75 bg-gray-700 rounded;
content: "+";
}
.thumb {
@apply
absolute block p-3
text-4xl text-gray-700 leading-none
bg-gray-100 rounded-full shadow;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.img {
@apply block w-8 h-8 max-w-5xl;
}
.label {
@apply
absolute pt-2 min-w-0
text-center text-gray-600 truncate;
top: 100%;
left: 0;
right: 0;
}
</style>