1
1
<template >
2
- <div class =" flex-container" style = " display : flex " >
2
+ <div class =" flex-container" >
3
3
<div id =" left-column" >
4
4
<div >
5
5
<h1 >Select a feature to get started</h1 >
6
- <div v-for =" itemId in unlockedItemIds" >
6
+ <ul class = " service-item-list " v-for =" itemId in unlockedItemIds" >
7
7
<ServiceItem
8
8
:title =" getServiceItemProps(itemId).title"
9
9
:description =" getServiceItemProps(itemId).description"
10
10
:status =" 'UNLOCKED'"
11
11
:isSelected =" isServiceSelected(itemId)"
12
+ :isLandscape =" isLandscape"
12
13
:id =" itemId"
13
14
:key =" buildServiceItemKey(itemId, 'UNLOCKED')"
14
15
@service-item-clicked =" serviceWasSelected(itemId)"
15
16
>
17
+ <template v-slot :service-item-content-slot v-if =" isServiceSelected (itemId ) && ! isLandscape " >
18
+ <ServiceItemContent ></ServiceItemContent >
19
+ </template >
16
20
</ServiceItem >
17
- </div >
21
+ </ul >
18
22
</div >
19
23
20
24
<div >
21
25
<h3 >UNLOCK ADDITIONAL FEATURES</h3 >
22
26
<div >Some features have additional authentication requirements to use. <a >Read more.</a ></div >
23
27
24
- <div v-for =" itemId in lockedItemIds" >
28
+ <ul class = " service-item-list " v-for =" itemId in lockedItemIds" >
25
29
<ServiceItem
26
30
:title =" getServiceItemProps(itemId).title"
27
31
:description =" getServiceItemProps(itemId).description"
28
32
:status =" 'LOCKED'"
29
33
:isSelected =" isServiceSelected(itemId)"
34
+ :isLandscape =" isLandscape"
30
35
:id =" itemId"
31
36
:key =" buildServiceItemKey(itemId, 'LOCKED')"
32
37
@service-item-clicked =" serviceWasSelected(itemId)"
33
38
>
39
+ <template v-slot :service-item-content-slot v-if =" isServiceSelected (itemId ) && ! isLandscape " >
40
+ <ServiceItemContent ></ServiceItemContent >
41
+ </template >
34
42
</ServiceItem >
35
- </div >
43
+ </ul >
36
44
</div >
37
45
<h3 ></h3 >
38
46
</div >
39
- <div id =" right-column" ></div >
47
+ <div v-if =" isLandscape && isAnyServiceSelected" id =" right-column" >
48
+ <ServiceItemContent ></ServiceItemContent >
49
+ </div >
40
50
</div >
41
51
</template >
42
52
43
53
<script lang="ts">
44
54
import { defineComponent } from ' vue'
45
55
import ServiceItem , { ServiceItemsState , ServiceItemId , ServiceStatus , StaticServiceItemProps } from ' ./ServiceItem.vue'
56
+ import ServiceItemContent from ' ./ServiceItemContent.vue'
46
57
47
58
const serviceItemsState = new ServiceItemsState ()
48
59
49
60
export default defineComponent ({
50
- components: { ServiceItem },
61
+ components: { ServiceItem , ServiceItemContent },
51
62
name: ' AuthRoot' ,
52
63
data() {
53
64
return {
54
65
unlockedItemIds: [] as ServiceItemId [],
55
66
lockedItemIds: [] as ServiceItemId [],
67
+ currWindowWidth: window .innerWidth ,
56
68
}
57
69
},
58
70
created() {
59
71
this .renderItems ()
60
72
},
73
+ mounted() {
74
+ window .addEventListener (' resize' , this .updateWindowWidth )
75
+ },
76
+ unmounted() {
77
+ window .removeEventListener (' resize' , this .updateWindowWidth )
78
+ },
79
+ computed: {
80
+ isLandscape() {
81
+ return this .currWindowWidth > 1300
82
+ },
83
+ isAnyServiceSelected(): boolean {
84
+ return serviceItemsState .selected !== undefined
85
+ },
86
+ },
61
87
methods: {
62
88
/**
63
89
* Triggers a rendering of the service items.
@@ -86,6 +112,9 @@ export default defineComponent({
86
112
buildServiceItemKey(id : ServiceItemId , lockStatus : ServiceStatus ) {
87
113
return id + ' _' + (this .isServiceSelected (id ) ? ` ${lockStatus }_SELECTED ` : ` ${lockStatus } ` )
88
114
},
115
+ updateWindowWidth() {
116
+ this .currWindowWidth = window .innerWidth
117
+ },
89
118
},
90
119
})
91
120
</script >
@@ -95,32 +124,28 @@ export default defineComponent({
95
124
.flex-container {
96
125
display : flex ;
97
126
flex-direction : row ;
98
- width : 1200px ;
99
- }
100
-
101
- /* Makes webview responsive and changes to single column when necessary */
102
- @media (max-width : 1200px ) {
103
- .flex-container {
104
- flex-direction : column ;
105
-
106
- color : red ;
107
- }
108
127
}
109
128
110
129
#left-column {
111
- flex-grow : 1 ;
112
- max-width : 40% ;
130
+ width : 500px ;
113
131
box-sizing : border-box ;
114
132
margin : 10px ;
115
133
}
116
134
117
- #right-column {
118
- flex-grow : 1 ;
119
- max-width : 60% ;
135
+ .service-item-list {
136
+ list-style-type : none ;
137
+ margin : 0 ;
138
+ padding : 0 ;
139
+ }
120
140
141
+ .service-item-list li {
142
+ /* Creates an even separation between all list items*/
143
+ margin-top : 10px ;
144
+ }
145
+
146
+ #right-column {
121
147
/* This can be deleted, for development purposes */
122
- background-color : aqua ;
123
- color : black ;
124
- height : 200px ;
148
+ height : 800px ;
149
+ margin : 10px ;
125
150
}
126
151
</style >
0 commit comments