-
-
Notifications
You must be signed in to change notification settings - Fork 622
Expand file tree
/
Copy pathSiteSelector.vue
More file actions
48 lines (42 loc) · 1.2 KB
/
SiteSelector.vue
File metadata and controls
48 lines (42 loc) · 1.2 KB
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
<template>
<div v-if="sites.length > 1" class="flex h-full items-center animate-in fade-in duration-750 fill-mode-forwards" data-ui-global-site-selector>
<Select
:model-value="active"
:options="sites"
:searchable="false"
@update:model-value="selected"
option-label="name"
option-value="handle"
size="sm"
variant="ghost"
icon="globe-arrow"
align="end"
:adaptive-width="true"
class="[&_[data-ui-combobox-trigger]]:text-white/85"
/>
</div>
</template>
<script>
import { Select } from '@/components/ui';
export default {
components: { Select },
computed: {
sites() {
return Statamic.$config.get('sites');
},
active() {
return Statamic.$config.get('selectedSite');
},
activeName() {
return this.sites.find((s) => s.handle === this.active).name;
},
},
methods: {
selected(siteHandle) {
if (siteHandle !== this.active) {
window.location = cp_url(`select-site/${siteHandle}`);
}
},
},
};
</script>