@pocketprep/ui-kit 3.4.2 → 3.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,351 @@
1
+ <template>
2
+ <div
3
+ v-if="question.passage || passageImageUrl"
4
+ ref="uikit-question-passage-and-image-dropdown"
5
+ v-breakpoint:questionEl="breakpoints"
6
+ v-dark="isDarkMode"
7
+ class="uikit-question-passage-and-image-dropdown"
8
+ :class="{ 'uikit-question-passage-and-image-dropdown__passage-and-image-dropdown--review-mode': reviewMode }"
9
+ >
10
+ <div
11
+ v-dark="isDarkMode"
12
+ class="uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-btn"
13
+ tabindex="0"
14
+ role="button"
15
+ :aria-expanded="showPassageImageDropdown ? 'true' : 'false'"
16
+ @click.stop="showPassageImageDropdown = !showPassageImageDropdown"
17
+ @keydown.enter.stop="showPassageImageDropdown = !showPassageImageDropdown"
18
+ @mousedown.prevent
19
+ >
20
+ <Icon
21
+ v-if="question.passage"
22
+ class="uikit-question-passage-and-image-dropdown__passage-dropdown-icon"
23
+ type="passage"
24
+ />
25
+ <Icon
26
+ v-else
27
+ class="uikit-question-passage-and-image-dropdown__image-dropdown-icon"
28
+ type="image"
29
+ />
30
+ <span
31
+ v-dark="isDarkMode"
32
+ class="uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-text"
33
+ >
34
+ {{ showPassageImageDropdown ? 'Hide' : 'Show' }}
35
+ {{ passageAndImageTitle }}
36
+ </span>
37
+ <Icon
38
+ v-dark="isDarkMode"
39
+ class="uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-arrow"
40
+ :class="{
41
+ 'uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-arrow--up':
42
+ showPassageImageDropdown,
43
+ }"
44
+ type="accordionArrow"
45
+ />
46
+ </div>
47
+ <div
48
+ v-if="showPassageImageDropdown"
49
+ v-breakpoint:questionEl="breakpoints"
50
+ class="uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-container"
51
+ >
52
+ <div
53
+ v-if="question.passage"
54
+ v-breakpoint:questionEl="breakpoints"
55
+ class="uikit-question-passage-and-image-dropdown__passage-dropdown-passage"
56
+ :class="{
57
+ 'uikit-question-passage-and-image-dropdown__passage-dropdown-passage--with-image': passageImageUrl,
58
+ }"
59
+ v-html="question.passage"
60
+ />
61
+ <img
62
+ v-if="passageImageUrl"
63
+ v-dark="isDarkMode"
64
+ class="uikit-question-passage-and-image-dropdown__image-dropdown-image"
65
+ :class="{
66
+ 'uikit-question-passage-and-image-dropdown__image-dropdown-image--with-passage': question.passage,
67
+ }"
68
+ :src="passageImageUrl"
69
+ :alt="`${passageImageAlt}. Extended image description below.`"
70
+ >
71
+ <PocketButton
72
+ v-if="passageImageLongAlt"
73
+ v-breakpoint:questionEl="breakpoints"
74
+ type="tertiary-small"
75
+ class="uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description"
76
+ :class="{
77
+ 'uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description--open':
78
+ showPassageImageLongAlt,
79
+ }"
80
+ :is-dark-mode="isDarkMode"
81
+ :aria-expanded="showPassageImageLongAlt ? 'true' : 'false'"
82
+ @click="emitTogglePassageImageLongAlt"
83
+ @mousedown.prevent
84
+ >
85
+ <span
86
+ class="uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description-text"
87
+ >
88
+ Image Description
89
+ </span>
90
+ <Icon
91
+ class="uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description-icon"
92
+ :class="{
93
+ 'uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description-icon--up':
94
+ showPassageImageLongAlt,
95
+ }"
96
+ type="accordionArrow"
97
+ />
98
+ </PocketButton>
99
+ <div
100
+ v-if="showPassageImageLongAlt"
101
+ ref="uikit-question-passage-and-image-dropdown__img-dropdown-img-description"
102
+ v-breakpoint:questionEl="breakpoints"
103
+ v-dark="isDarkMode"
104
+ class="uikit-question-passage-and-image-dropdown__img-dropdown-img-description"
105
+ tabindex="-1"
106
+ v-html="passageImageLongAlt"
107
+ />
108
+ </div>
109
+ </div>
110
+ </template>
111
+
112
+ <script lang="ts">
113
+ import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
114
+ import type { Study } from '@pocketprep/types'
115
+ import Icon from '../../Icons/Icon.vue'
116
+ import PocketButton from '../../Buttons/Button.vue'
117
+ import { breakpoint, dark } from '../../../directives'
118
+ import type { TQuestionPassageAndImageTitle, TBreakPointsObject } from './../question'
119
+
120
+ @Component({
121
+ components: {
122
+ Icon,
123
+ PocketButton,
124
+ },
125
+ directives: {
126
+ dark,
127
+ breakpoint,
128
+ },
129
+ })
130
+ export default class PassageAndImageDropdown extends Vue {
131
+ @Prop({ default: false }) isDarkMode!: boolean
132
+ @Prop() question!: Study.Class.QuestionJSON
133
+ @Prop({ default: false }) reviewMode!: boolean
134
+ @Prop({ default: '' }) imageUrlPrefix!: string
135
+ @Prop({ default: null }) passageImageUrl!: string | null
136
+ @Prop({ default: '' }) passageImageLongAlt!: string | undefined
137
+ @Prop({ default: '' }) passageImageAlt!: string | undefined
138
+ @Prop({ default: 'Passage' }) passageAndImageTitle!: TQuestionPassageAndImageTitle
139
+ @Prop({ default: null }) questionEl!: Element | null
140
+ @Prop({ default: {
141
+ 'mobile': 767,
142
+ 'tablet-portrait': 1023,
143
+ 'tablet-landscape': 1439,
144
+ } }) breakpoints!: TBreakPointsObject
145
+
146
+ showPassageImageDropdown = false
147
+ showPassageImageLongAlt = false
148
+
149
+ @Emit('emitTogglePassageImageLongAlt')
150
+ emitTogglePassageImageLongAlt () {
151
+ this.showPassageImageLongAlt = !this.showPassageImageLongAlt
152
+ return this.showPassageImageLongAlt
153
+ }
154
+ }
155
+ </script>
156
+
157
+ <style lang="scss">
158
+ @import '../../../styles/colors';
159
+ @import '../../../styles/breakpoints';
160
+
161
+ .uikit-question-passage-and-image-dropdown {
162
+ &__passage-and-image-dropdown-btn {
163
+ position: relative;
164
+ display: flex;
165
+ align-items: center;
166
+ border: 1px solid rgba($pewter, 0.85);
167
+ border-radius: 5px;
168
+ box-shadow: 0 1px 4px 0 rgba($ash, 0.3);
169
+ box-sizing: border-box;
170
+ height: 50px;
171
+ padding: 15px 57px 16px 48px;
172
+ margin: -1px;
173
+ cursor: pointer;
174
+ outline: none;
175
+
176
+ &:hover {
177
+ .uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-text {
178
+ color: mix($brand-blue, black, 90%);
179
+ }
180
+
181
+ .uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-arrow {
182
+ color: mix($brand-blue, black, 90%);
183
+ }
184
+
185
+ &::before {
186
+ content: '';
187
+ left: -2px;
188
+ top: -2px;
189
+ width: 100%;
190
+ height: 100%;
191
+ border: 2px solid $slate;
192
+ position: absolute;
193
+ border-radius: 5px;
194
+ }
195
+ }
196
+
197
+ &:focus::before {
198
+ content: '';
199
+ left: -3px;
200
+ top: -3px;
201
+ width: calc(100% + 4px);
202
+ height: calc(100% + 4px);
203
+ border: 1px solid $brand-blue;
204
+ position: absolute;
205
+ border-radius: 8px;
206
+ }
207
+
208
+ &--dark {
209
+ box-shadow: 0 1px 4px 0 rgba($jet, 0.3);
210
+ border-color: $slate;
211
+
212
+ &:hover {
213
+ .uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-text {
214
+ color: $butterscotch;
215
+ }
216
+
217
+ .uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-arrow {
218
+ color: $butterscotch;
219
+ }
220
+
221
+ &::before {
222
+ border-color: rgba($white, 0.6);
223
+ }
224
+ }
225
+
226
+ &:focus::before {
227
+ border-color: $banana-bread;
228
+ }
229
+ }
230
+ }
231
+
232
+ &__passage-dropdown-icon,
233
+ &__image-dropdown-icon {
234
+ position: absolute;
235
+ left: 17px;
236
+ width: 19px;
237
+ }
238
+
239
+ &__passage-and-image-dropdown-text {
240
+ font-size: 16px;
241
+ line-height: 24px;
242
+ font-weight: 600;
243
+ color: $brand-blue;
244
+
245
+ &--dark {
246
+ color: $banana-bread;
247
+ }
248
+ }
249
+
250
+ &__passage-and-image-dropdown-arrow {
251
+ position: absolute;
252
+ right: 20px;
253
+ color: $brand-blue;
254
+
255
+ &--dark {
256
+ color: $banana-bread;
257
+ }
258
+
259
+ &--up {
260
+ transform: rotate(180deg);
261
+ }
262
+ }
263
+
264
+ &__passage-and-image-dropdown-container {
265
+ padding: 14px 15px 16px 16px;
266
+
267
+ &--mobile {
268
+ padding: 12px 15px 16px 15px;
269
+ }
270
+ }
271
+
272
+ &__passage-dropdown-passage {
273
+ box-sizing: border-box;
274
+ margin: 14px 20px 24px 17px;
275
+ line-height: 24px;
276
+ font-size: 16px;
277
+ font-weight: 400;
278
+ letter-spacing: -0.1;
279
+
280
+ &--mobile {
281
+ line-height: 24px;
282
+ font-size: 16px;
283
+ }
284
+
285
+ &--with-image {
286
+ margin-bottom: 16px;
287
+ }
288
+ }
289
+
290
+ &__image-dropdown-image {
291
+ display: block;
292
+ box-sizing: border-box;
293
+ width: 100%;
294
+ border: 1px solid $fog;
295
+
296
+ &--with-passage {
297
+ padding-top: 0;
298
+ }
299
+
300
+ &--dark {
301
+ border: 1px solid $jet;
302
+ }
303
+ }
304
+
305
+ &__toggle-img-dropdown-img-description {
306
+ margin-top: 16px;
307
+
308
+ &--open {
309
+ margin-bottom: 8px;
310
+ }
311
+ }
312
+
313
+ &__toggle-img-dropdown-img-description-text {
314
+ outline: none;
315
+ }
316
+
317
+
318
+ &__toggle-img-dropdown-img-description-icon {
319
+ margin-left: 8px;
320
+
321
+ &--up {
322
+ transform: rotate(180deg);
323
+ }
324
+ }
325
+
326
+ &__img-dropdown-img-description {
327
+ outline: none;
328
+ color: $ash;
329
+ font-size: 15px;
330
+ line-height: 22px;
331
+ font-weight: 500;
332
+ letter-spacing: -0.2;
333
+
334
+ &--dark {
335
+ color: $fog;
336
+ }
337
+
338
+ &--tablet-landscape {
339
+ margin-bottom: 4px;
340
+ }
341
+
342
+ &--tablet-portrait {
343
+ margin-bottom: 0;
344
+ }
345
+
346
+ p {
347
+ margin: 0;
348
+ }
349
+ }
350
+ }
351
+ </style>
@@ -0,0 +1,153 @@
1
+ <template>
2
+ <div
3
+ class="uikit-question-paywall"
4
+ >
5
+ <div
6
+ v-dark="isDarkMode"
7
+ v-breakpoint:questionEl="breakpoints"
8
+ class="uikit-question-paywall__paywall"
9
+ :class="{ 'uikit-question-paywall__paywall--review': reviewMode }"
10
+ >
11
+ <img
12
+ v-breakpoint:questionEl="breakpoints"
13
+ :src="isDarkMode ? paywallImages['dark'] : paywallImages['light']"
14
+ alt=""
15
+ class="uikit-question-paywall__paywall-image"
16
+ >
17
+ <div
18
+ v-dark="isDarkMode"
19
+ v-breakpoint:questionEl="breakpoints"
20
+ class="uikit-question-paywall__paywall-text"
21
+ >
22
+ You need a Premium Subscription to view this question's answer and explanation.
23
+ </div>
24
+ <PocketButton
25
+ :is-dark-mode="isDarkMode"
26
+ class="uikit-question-paywall__paywall-button"
27
+ @click="emitUpgradeClick"
28
+ >
29
+ Upgrade to Premium
30
+ </PocketButton>
31
+ </div>
32
+ </div>
33
+ </template>
34
+
35
+ <script lang="ts">
36
+ import { Component, Vue, Prop, Emit } from 'vue-facing-decorator'
37
+ import Icon from '../../Icons/Icon.vue'
38
+ import PocketButton from '../../Buttons/Button.vue'
39
+ import { dark, breakpoint } from '../../../directives'
40
+ import type { TBreakPointsObject } from './../question'
41
+ import PaywallImageLight from '../../../assets/question/paywall-light.png'
42
+ import PaywallImageDark from '../../../assets/question/paywall-dark.png'
43
+
44
+ @Component({
45
+ components: {
46
+ Icon,
47
+ PocketButton,
48
+ },
49
+ directives: {
50
+ dark,
51
+ breakpoint,
52
+ },
53
+ })
54
+ export default class Paywall extends Vue {
55
+ @Prop({ default: false }) reviewMode!: boolean
56
+ @Prop({ default: false }) isDarkMode!: boolean
57
+ @Prop({ default: null }) questionEl!: Element | null
58
+ @Prop({ default: {
59
+ 'mobile': 767,
60
+ 'tablet-portrait': 1023,
61
+ 'tablet-landscape': 1439,
62
+ } }) breakpoints!: TBreakPointsObject
63
+
64
+ get paywallImages () {
65
+ return {
66
+ light: PaywallImageLight,
67
+ dark: PaywallImageDark,
68
+ }
69
+ }
70
+
71
+ @Emit('upgradeClicked')
72
+ emitUpgradeClick () {
73
+ return true
74
+ }
75
+ }
76
+
77
+ </script>
78
+
79
+ <style lang="scss">
80
+ @import '../../../styles/colors';
81
+ @import '../../../styles/breakpoints';
82
+
83
+ .uikit-question-paywall {
84
+ width: 100%;
85
+ display: flex;
86
+ justify-content: center;
87
+
88
+ &__paywall {
89
+ width: 100%;
90
+ max-width: 500px;
91
+ background: $white;
92
+ border-radius: 8px;
93
+ border: 1px solid $steel;
94
+ display: flex;
95
+ flex-direction: column;
96
+ align-items: center;
97
+ justify-content: center;
98
+
99
+ &--dark {
100
+ background: $brand-black;
101
+ }
102
+
103
+ &--tablet-portrait {
104
+ max-width: 430px;
105
+ }
106
+
107
+ &--review {
108
+ margin-bottom: 20px;
109
+ }
110
+ }
111
+
112
+ &__paywall-image {
113
+ width: 305px;
114
+ height: 230px;
115
+ margin: 25px auto 21px;
116
+
117
+ &--mobile {
118
+ width: 262px;
119
+ height: 199px;
120
+ margin: 14px auto 18px;
121
+ }
122
+ }
123
+
124
+ &__paywall-text {
125
+ font-size: 18px;
126
+ line-height: 22px;
127
+ color: $brand-black;
128
+ margin-bottom: 24px;
129
+ font-weight: 600;
130
+ text-align: center;
131
+ max-width: 372px;
132
+
133
+ &--dark {
134
+ color: $white;
135
+ }
136
+
137
+ &--tablet-portrait {
138
+ max-width: 302px;
139
+ }
140
+
141
+ &--mobile {
142
+ max-width: 293px;
143
+ margin-bottom: 22px;
144
+ font-size: 16px;
145
+ line-height: 19px;
146
+ }
147
+ }
148
+
149
+ &__paywall-button {
150
+ margin-bottom: 36px;
151
+ }
152
+ }
153
+ </style>