Skip to content

Commit 6a0110f

Browse files
committed
wip vpn update view
1 parent 2e196c1 commit 6a0110f

5 files changed

Lines changed: 357 additions & 86 deletions

File tree

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<script setup>
2+
import CheckIcon from '../../../components/icons/CheckIcon.vue'
3+
import { RadioGroup, RadioGroupDescription, RadioGroupLabel, RadioGroupOption } from '@headlessui/vue'
4+
import { defineModel, defineProps } from 'vue'
5+
6+
defineProps({
7+
disabled: Boolean,
8+
singleUserDisabled: Boolean,
9+
multiuserDisabled: Boolean
10+
})
11+
12+
const model = defineModel()
13+
</script>
14+
15+
<template>
16+
<!-- Single/multi-user -->
17+
<RadioGroup v-model="model">
18+
<div class="box__grid mb-8">
19+
<RadioGroupOption as="template" :value="false" :disabled="disabled || singleUserDisabled" v-slot="{ active, checked, disabled }">
20+
<div :class="{ radioOption: true, active, checked, disabled }">
21+
<div :class="{ checkmark: true, active, checked }">
22+
<CheckIcon class="checkmark__icon" />
23+
</div>
24+
<div class="optionDetails">
25+
<RadioGroupLabel as="h4" class="optionDetails__name">
26+
Single-user VPN
27+
</RadioGroupLabel>
28+
<RadioGroupDescription as="span" class="optionDetails__description">
29+
<span>Ideal for individual use.</span>
30+
</RadioGroupDescription>
31+
</div>
32+
</div>
33+
</RadioGroupOption>
34+
35+
<RadioGroupOption as="template" :value="true" :disabled="disabled || multiuserDisabled" v-slot="{ active, checked, disabled }">
36+
<div :class="{ radioOption: true, active, checked, disabled }">
37+
<div :class="{ checkmark: true, active, checked }">
38+
<CheckIcon class="checkmark__icon" />
39+
</div>
40+
<div class="optionDetails">
41+
<RadioGroupLabel as="h4" class="optionDetails__name">
42+
Multi-user VPN
43+
</RadioGroupLabel>
44+
<RadioGroupDescription as="span" class="optionDetails__description">
45+
<span>Multi-user VPN includes up to five users. You can pay for additional users.</span>
46+
</RadioGroupDescription>
47+
</div>
48+
</div>
49+
</RadioGroupOption>
50+
</div>
51+
</RadioGroup>
52+
</template>
53+
54+
55+
<style scoped>
56+
.box__grid {
57+
@apply mt-6 w-full grid grid-cols-1 gap-4;
58+
@apply sm:grid-cols-2 lg:grid-cols-2;
59+
}
60+
61+
/* radio option */
62+
.radioOption {
63+
@apply relative flex space-x-3 items-start p-5 border border-gray-300 rounded-md cursor-pointer;
64+
@apply hover:bg-gray-100 hover:bg-opacity-50;
65+
@apply focus:outline-none;
66+
}
67+
.radioOption.active {
68+
@apply border-green border-opacity-40;
69+
}
70+
.radioOption.checked {
71+
@apply bg-gray-100 border-green bg-opacity-75;
72+
@apply ring-4 ring-green ring-opacity-10;
73+
}
74+
.radioOption.disabled {
75+
@apply cursor-not-allowed opacity-50;
76+
}
77+
78+
/* radio option details */
79+
.optionDetails {
80+
@apply flex flex-col flex-1 text-sm;
81+
}
82+
.optionDetails__city {
83+
@apply text-sm text-gray-500;
84+
}
85+
86+
/* checkmark */
87+
.checkmark {
88+
@apply flex items-center justify-center text-white flex-shrink-0 rounded-full w-5 h-5 bg-gray-100 border border-gray-300;
89+
}
90+
.checkmark.active {
91+
@apply border-green border-opacity-40 bg-opacity-20;
92+
}
93+
.checkmark.checked {
94+
@apply border-green bg-green;
95+
}
96+
.checkmark .checkmark__icon {
97+
@apply opacity-0 w-3 h-3;
98+
}
99+
.checkmark.active .checkmark__icon {
100+
@apply opacity-40;
101+
}
102+
.checkmark.checked .checkmark__icon {
103+
@apply opacity-100;
104+
}
105+
</style>

src/modules/vpns/components/SpeedSlider.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<script setup>
22
import Slider from '../../../layout/Slider.vue'
3-
import { defineModel, defineProps } from 'vue'
3+
import { defineModel, defineProps, effect, ref } from 'vue'
44
55
defineProps({
66
disabled: Boolean
77
})
88
99
const model = defineModel()
10+
const ready = ref(false)
1011
1112
const rawMarks = [
1213
['fast', 'Fast'],
@@ -15,7 +16,7 @@ const rawMarks = [
1516
]
1617
1718
const marks = rawMarks.reduce((ms, m, i) => {
18-
ms[i] = m[0]
19+
ms[i] = m[1]
1920
return ms
2021
}, {})
2122
@@ -26,6 +27,13 @@ function formatter(i) {
2627
function setSpeed(i) {
2728
model.value = rawMarks[i][0]
2829
}
30+
31+
effect(() => {
32+
if (!ready.value) {
33+
/** WIP */
34+
ready.value = true
35+
}
36+
})
2937
</script>
3038

3139
<template>

src/modules/vpns/components/VPNResize.vue

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)