fansunited-frontend-components 0.0.1-RC4 → 0.0.1-RC5
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.
- package/{components.js → classic-quiz-play.es.js} +1 -1
- package/classic-quiz-play.umd.js +174 -0
- package/index.d.ts +3 -0
- package/package.json +2 -2
- package/src/components/ClassicQuizNotFound.d.ts +4 -0
- package/src/components/ClassicQuizNotFound.d.ts.map +1 -0
- package/src/components/ClassicQuizNotFound.js +55 -0
- package/src/components/ClassicQuizPlay.d.ts +5 -0
- package/src/components/ClassicQuizPlay.d.ts.map +1 -0
- package/src/components/ClassicQuizPlay.js +321 -0
- package/src/components/Leads/CollectLead.d.ts +22 -0
- package/src/components/Leads/CollectLead.d.ts.map +1 -0
- package/src/components/Leads/CollectLead.js +20 -0
- package/src/components/Leads/LeadAgreementCheckbox.d.ts +10 -0
- package/src/components/Leads/LeadAgreementCheckbox.d.ts.map +1 -0
- package/src/components/Leads/LeadAgreementCheckbox.js +45 -0
- package/src/components/Leads/LeadForm.d.ts +20 -0
- package/src/components/Leads/LeadForm.d.ts.map +1 -0
- package/src/components/Leads/LeadForm.js +289 -0
- package/src/components/Shared/AlertMessage.d.ts +10 -0
- package/src/components/Shared/AlertMessage.d.ts.map +1 -0
- package/src/components/Shared/AlertMessage.js +37 -0
- package/src/components/Shared/Answers/Answers.d.ts +14 -0
- package/src/components/Shared/Answers/Answers.d.ts.map +1 -0
- package/src/components/Shared/Answers/Answers.js +31 -0
- package/src/components/Shared/Answers/Option.d.ts +13 -0
- package/src/components/Shared/Answers/Option.d.ts.map +1 -0
- package/src/components/Shared/Answers/Option.js +118 -0
- package/src/components/Shared/Button.d.ts +12 -0
- package/src/components/Shared/Button.d.ts.map +1 -0
- package/src/components/Shared/Button.js +43 -0
- package/src/components/Shared/MainCard.d.ts +10 -0
- package/src/components/Shared/MainCard.d.ts.map +1 -0
- package/src/components/Shared/MainCard.js +24 -0
- package/src/components/Shared/Pagination.d.ts +10 -0
- package/src/components/Shared/Pagination.d.ts.map +1 -0
- package/src/components/Shared/Pagination.js +118 -0
- package/src/components/Shared/PresentedBy.d.ts +8 -0
- package/src/components/Shared/PresentedBy.d.ts.map +1 -0
- package/src/components/Shared/PresentedBy.js +51 -0
- package/src/components/Shared/ScoreStateWrapper.d.ts +13 -0
- package/src/components/Shared/ScoreStateWrapper.d.ts.map +1 -0
- package/src/components/Shared/ScoreStateWrapper.js +254 -0
- package/src/components/Shared/Stepper.d.ts +11 -0
- package/src/components/Shared/Stepper.d.ts.map +1 -0
- package/src/components/Shared/Stepper.js +75 -0
- package/src/components/Shared/Stopwatch.d.ts +12 -0
- package/src/components/Shared/Stopwatch.d.ts.map +1 -0
- package/src/components/Shared/Stopwatch.js +103 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.d.ts +8 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.d.ts.map +1 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.js +68 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.d.ts +118 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.d.ts.map +1 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.js +103 -0
- package/src/components/Variants/Overlay/OverlayVariant.d.ts +5 -0
- package/src/components/Variants/Overlay/OverlayVariant.d.ts.map +1 -0
- package/src/components/Variants/Overlay/OverlayVariant.js +100 -0
- package/src/components/Variants/Overlay/OverlayVariant.styles.d.ts +286 -0
- package/src/components/Variants/Overlay/OverlayVariant.styles.d.ts.map +1 -0
- package/src/components/Variants/Overlay/OverlayVariant.styles.js +266 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.d.ts +16 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.d.ts.map +1 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.js +90 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.d.ts +364 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.d.ts.map +1 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.js +374 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.d.ts +8 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.d.ts.map +1 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.js +44 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.d.ts +126 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.d.ts.map +1 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.js +95 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.d.ts +16 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.d.ts.map +1 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.js +84 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.d.ts +403 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.d.ts.map +1 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.js +400 -0
- package/src/components/Variants/Split/SplitVariant.d.ts +5 -0
- package/src/components/Variants/Split/SplitVariant.d.ts.map +1 -0
- package/src/components/Variants/Split/SplitVariant.js +79 -0
- package/src/components/Variants/Split/SplitVariant.styles.d.ts +252 -0
- package/src/components/Variants/Split/SplitVariant.styles.d.ts.map +1 -0
- package/src/components/Variants/Split/SplitVariant.styles.js +216 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.d.ts +9 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.d.ts.map +1 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.js +43 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.d.ts +231 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.d.ts.map +1 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.js +201 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.d.ts +17 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.d.ts.map +1 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.js +78 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.d.ts +350 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.d.ts.map +1 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.js +349 -0
- package/src/components/Variants/Standard/StandardVariant.d.ts +10 -0
- package/src/components/Variants/Standard/StandardVariant.d.ts.map +1 -0
- package/src/components/Variants/Standard/StandardVariant.js +82 -0
- package/src/components/Variants/Standard/StandardVariant.styles.d.ts +414 -0
- package/src/components/Variants/Standard/StandardVariant.styles.d.ts.map +1 -0
- package/src/components/Variants/Standard/StandardVariant.styles.js +373 -0
- package/src/constants/constants.d.ts +7 -0
- package/src/constants/constants.d.ts.map +1 -0
- package/src/constants/constants.js +446 -0
- package/src/hooks/useClassicQuizById.d.ts +3 -0
- package/src/hooks/useClassicQuizById.d.ts.map +1 -0
- package/src/hooks/useClassicQuizById.js +20 -0
- package/src/hooks/useEmbedCodeContainer.d.ts +2 -0
- package/src/hooks/useEmbedCodeContainer.d.ts.map +1 -0
- package/src/hooks/useEmbedCodeContainer.js +38 -0
- package/src/hooks/useMyParticipation.d.ts +3 -0
- package/src/hooks/useMyParticipation.d.ts.map +1 -0
- package/src/hooks/useMyParticipation.js +22 -0
- package/src/hooks/useScoreStateHelpers.d.ts +18 -0
- package/src/hooks/useScoreStateHelpers.d.ts.map +1 -0
- package/src/hooks/useScoreStateHelpers.js +156 -0
- package/src/index.d.ts +2 -3
- package/src/index.d.ts.map +1 -1
- package/src/index.js +2 -0
- package/src/main.d.ts +5 -0
- package/src/main.d.ts.map +1 -0
- package/src/main.js +53 -0
- package/src/services/service.d.ts +1 -0
- package/src/services/service.d.ts.map +1 -0
- package/src/services/service.js +1 -0
- package/src/styles/form.styles.d.ts +19 -0
- package/src/styles/form.styles.d.ts.map +1 -0
- package/src/styles/form.styles.js +18 -0
- package/src/types/types.d.ts +28 -0
- package/src/types/types.d.ts.map +1 -0
- package/src/types/types.js +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/components.d.ts +0 -1
- package/src/indexUmd.d.ts +0 -2
- package/src/indexUmd.d.ts.map +0 -1
- package/vite.config.d.ts +0 -3
- package/vite.config.d.ts.map +0 -1
- package/vite.config.umd.d.ts +0 -3
- package/vite.config.umd.d.ts.map +0 -1
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
export const createStyles = (props) => ({
|
|
2
|
+
// Desktop image section with overlay
|
|
3
|
+
desktopImageSection: (isTabulated) => ({
|
|
4
|
+
display: { lg: "flex", xs: "none" },
|
|
5
|
+
flexDirection: "column",
|
|
6
|
+
justifyContent: "space-between",
|
|
7
|
+
gap: "10px",
|
|
8
|
+
flex: "0.5",
|
|
9
|
+
backgroundImage: `url(${props.quizImage || props.imagePlaceholder})`,
|
|
10
|
+
backgroundSize: "cover",
|
|
11
|
+
backgroundPosition: "center",
|
|
12
|
+
borderTopLeftRadius: isTabulated ? 0 : props.borderRadius.md,
|
|
13
|
+
borderTopRightRadius: {
|
|
14
|
+
xs: isTabulated ? 0 : props.borderRadius.md,
|
|
15
|
+
md: "0",
|
|
16
|
+
},
|
|
17
|
+
borderBottomLeftRadius: {
|
|
18
|
+
xs: 0,
|
|
19
|
+
md: props.borderRadius.md,
|
|
20
|
+
},
|
|
21
|
+
overflow: "hidden",
|
|
22
|
+
height: "auto",
|
|
23
|
+
position: "relative",
|
|
24
|
+
minHeight: { xs: "210px", md: "430px" },
|
|
25
|
+
"&::before": {
|
|
26
|
+
content: '""',
|
|
27
|
+
position: "absolute",
|
|
28
|
+
width: "100%",
|
|
29
|
+
height: "100%",
|
|
30
|
+
background: "linear-gradient(rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.7) 100%)",
|
|
31
|
+
borderTopLeftRadius: "5px",
|
|
32
|
+
borderTopRightRadius: "5px",
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
// Image section content
|
|
36
|
+
imageSectionContent: {
|
|
37
|
+
zIndex: 1,
|
|
38
|
+
height: "100%",
|
|
39
|
+
p: props.spacingScale.xl,
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
justifyContent: "space-between",
|
|
43
|
+
},
|
|
44
|
+
// Quiz headline typography
|
|
45
|
+
quizHeadlineText: {
|
|
46
|
+
fontWeight: 500,
|
|
47
|
+
lineHeight: "166%",
|
|
48
|
+
letterSpacing: "1px",
|
|
49
|
+
fontSize: "0.75rem",
|
|
50
|
+
color: props.brandingColors?.secondaryColor || props.darkTextColor,
|
|
51
|
+
opacity: "70%",
|
|
52
|
+
textTransform: "uppercase",
|
|
53
|
+
fontFamily: props.fontFamilySecondary,
|
|
54
|
+
textAlign: { xs: "center", md: "left" },
|
|
55
|
+
},
|
|
56
|
+
// Content container
|
|
57
|
+
contentContainer: {
|
|
58
|
+
display: "flex",
|
|
59
|
+
flexDirection: "column",
|
|
60
|
+
gap: props.spacingScale["3xs"],
|
|
61
|
+
},
|
|
62
|
+
// Quiz title typography
|
|
63
|
+
quizTitleText: {
|
|
64
|
+
fontWeight: 700,
|
|
65
|
+
lineHeight: "133%",
|
|
66
|
+
fontSize: "1.5rem",
|
|
67
|
+
letterSpacing: "0.15px",
|
|
68
|
+
color: props.brandingColors?.contentColor || props.darkTextColor,
|
|
69
|
+
fontFamily: props.fontFamilyPrimary,
|
|
70
|
+
textAlign: { xs: "center", md: "left" },
|
|
71
|
+
},
|
|
72
|
+
// Quiz description typography
|
|
73
|
+
quizDescriptionText: {
|
|
74
|
+
fontWeight: 500,
|
|
75
|
+
lineHeight: "140%",
|
|
76
|
+
fontSize: "1.25rem",
|
|
77
|
+
letterSpacing: "0.15px",
|
|
78
|
+
color: props.brandingColors?.secondaryColor || props.darkTextColor,
|
|
79
|
+
opacity: "70%",
|
|
80
|
+
fontFamily: props.fontFamilyPrimary,
|
|
81
|
+
textAlign: { xs: "center", md: "left" },
|
|
82
|
+
},
|
|
83
|
+
// Presented by desktop container
|
|
84
|
+
presentedByDesktop: {
|
|
85
|
+
display: { xs: "none", md: "block" },
|
|
86
|
+
},
|
|
87
|
+
// Main question area
|
|
88
|
+
questionArea: {
|
|
89
|
+
flex: { lg: "0.5", xs: "1" },
|
|
90
|
+
},
|
|
91
|
+
// Question area content wrapper
|
|
92
|
+
questionAreaContent: {
|
|
93
|
+
p: props.spacingScale.lg,
|
|
94
|
+
display: "flex",
|
|
95
|
+
flexDirection: "column",
|
|
96
|
+
justifyContent: "center",
|
|
97
|
+
gap: "16px",
|
|
98
|
+
},
|
|
99
|
+
// Score container (main card)
|
|
100
|
+
scoreContainer: {
|
|
101
|
+
p: props.spacingScale.lg,
|
|
102
|
+
gap: props.spacingScale.md,
|
|
103
|
+
display: "flex",
|
|
104
|
+
flexDirection: "column",
|
|
105
|
+
backdropFilter: "blur(4px)",
|
|
106
|
+
bgcolor: `rgba(${props.bgcolor ? props.bgcolor.replace(/[^\d,]/g, "") : ""}, 0.5)`,
|
|
107
|
+
borderRadius: props.borderRadius.sm,
|
|
108
|
+
boxShadow: "lg",
|
|
109
|
+
},
|
|
110
|
+
// Score content wrapper
|
|
111
|
+
scoreContentWrapper: {
|
|
112
|
+
display: "flex",
|
|
113
|
+
flexDirection: "column",
|
|
114
|
+
justifyContent: "center",
|
|
115
|
+
alignItems: "center",
|
|
116
|
+
alignSelf: "stretch",
|
|
117
|
+
},
|
|
118
|
+
// Score content container
|
|
119
|
+
scoreContentContainer: {
|
|
120
|
+
display: "flex",
|
|
121
|
+
flexDirection: "column",
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
gap: props.spacingScale["3xl"],
|
|
124
|
+
alignSelf: "stretch",
|
|
125
|
+
},
|
|
126
|
+
// Score section
|
|
127
|
+
scoreSection: {
|
|
128
|
+
display: "flex",
|
|
129
|
+
gap: props.spacingScale.xs,
|
|
130
|
+
justifyContent: "center",
|
|
131
|
+
alignSelf: "stretch",
|
|
132
|
+
alignItems: "center",
|
|
133
|
+
},
|
|
134
|
+
// Score section wrapper
|
|
135
|
+
scoreSectionWrapper: {
|
|
136
|
+
display: "flex",
|
|
137
|
+
flexDirection: { xs: "column", md: "row" },
|
|
138
|
+
minWidth: "200px",
|
|
139
|
+
p: props.spacingScale.xs,
|
|
140
|
+
justifyContent: "center",
|
|
141
|
+
alignItems: "center",
|
|
142
|
+
gap: props.spacingScale.md,
|
|
143
|
+
flex: "1 0 0",
|
|
144
|
+
},
|
|
145
|
+
// Achievement badge container
|
|
146
|
+
achievementBadgeContainer: {
|
|
147
|
+
display: "flex",
|
|
148
|
+
width: { xs: "172px", md: "auto" },
|
|
149
|
+
height: { xs: "160px", md: "auto" },
|
|
150
|
+
flexDirection: "column",
|
|
151
|
+
justifyContent: "center",
|
|
152
|
+
alignItems: "center",
|
|
153
|
+
position: "relative",
|
|
154
|
+
},
|
|
155
|
+
// Hexagon background
|
|
156
|
+
hexagonBackground: {
|
|
157
|
+
width: "160px",
|
|
158
|
+
height: "160px",
|
|
159
|
+
position: "absolute",
|
|
160
|
+
top: "55%",
|
|
161
|
+
left: "50%",
|
|
162
|
+
transform: "translate(-50%, -50%)",
|
|
163
|
+
},
|
|
164
|
+
// Achievement emoji
|
|
165
|
+
achievementEmoji: {
|
|
166
|
+
maxWidth: "80px",
|
|
167
|
+
maxHeight: "80px",
|
|
168
|
+
position: "relative",
|
|
169
|
+
},
|
|
170
|
+
// Text section
|
|
171
|
+
textSection: {
|
|
172
|
+
display: "flex",
|
|
173
|
+
flexDirection: "column",
|
|
174
|
+
alignItems: "center",
|
|
175
|
+
boxSizing: "border-box",
|
|
176
|
+
},
|
|
177
|
+
// Congratulations text
|
|
178
|
+
congratulationsText: {
|
|
179
|
+
color: props.textPrimary,
|
|
180
|
+
textAlign: "center",
|
|
181
|
+
fontFamily: props.fontFamilyPrimary,
|
|
182
|
+
fontSize: "1.5rem",
|
|
183
|
+
fontStyle: "normal",
|
|
184
|
+
fontWeight: 400,
|
|
185
|
+
lineHeight: "133.4%",
|
|
186
|
+
px: 2,
|
|
187
|
+
},
|
|
188
|
+
// Score numbers container
|
|
189
|
+
scoreNumbersContainer: {
|
|
190
|
+
display: "flex",
|
|
191
|
+
alignItems: "center",
|
|
192
|
+
gap: "4px",
|
|
193
|
+
},
|
|
194
|
+
// Score numbers wrapper
|
|
195
|
+
scoreNumbersWrapper: {
|
|
196
|
+
display: "flex",
|
|
197
|
+
alignItems: "flex-end",
|
|
198
|
+
gap: "4px",
|
|
199
|
+
},
|
|
200
|
+
// Correct score text
|
|
201
|
+
correctScoreText: (correct) => ({
|
|
202
|
+
textAlign: "center",
|
|
203
|
+
color: correct > 0 ? props.successColor : props.dangerColor,
|
|
204
|
+
fontFamily: props.fontFamilyPrimary,
|
|
205
|
+
fontSize: "3.75rem",
|
|
206
|
+
fontStyle: "normal",
|
|
207
|
+
fontWeight: 500,
|
|
208
|
+
lineHeight: "120%",
|
|
209
|
+
letterSpacing: "-0.5px",
|
|
210
|
+
}),
|
|
211
|
+
// Total score text
|
|
212
|
+
totalScoreText: (correct) => ({
|
|
213
|
+
textAlign: "center",
|
|
214
|
+
color: correct > 0 ? props.successColor : props.dangerColor,
|
|
215
|
+
fontFamily: props.fontFamilyPrimary,
|
|
216
|
+
fontSize: "3.75rem",
|
|
217
|
+
fontStyle: "normal",
|
|
218
|
+
fontWeight: 500,
|
|
219
|
+
lineHeight: "120%",
|
|
220
|
+
letterSpacing: "-0.5px",
|
|
221
|
+
}),
|
|
222
|
+
// Time text
|
|
223
|
+
timeText: {
|
|
224
|
+
textAlign: "center",
|
|
225
|
+
color: props.textPrimary,
|
|
226
|
+
fontFamily: props.fontFamilySecondary,
|
|
227
|
+
fontSize: "0.875rem",
|
|
228
|
+
fontStyle: "normal",
|
|
229
|
+
fontWeight: 700,
|
|
230
|
+
lineHeight: "143%",
|
|
231
|
+
letterSpacing: "0.024px",
|
|
232
|
+
},
|
|
233
|
+
// Points text
|
|
234
|
+
pointsText: {
|
|
235
|
+
textAlign: "center",
|
|
236
|
+
color: props.textPrimary,
|
|
237
|
+
fontFamily: props.fontFamilyPrimary,
|
|
238
|
+
fontSize: "1.25rem",
|
|
239
|
+
fontStyle: "normal",
|
|
240
|
+
fontWeight: 500,
|
|
241
|
+
lineHeight: "120%",
|
|
242
|
+
letterSpacing: "0.15px",
|
|
243
|
+
},
|
|
244
|
+
// CTA container
|
|
245
|
+
ctaContainer: {
|
|
246
|
+
display: "flex",
|
|
247
|
+
flexDirection: "column",
|
|
248
|
+
alignItems: "center",
|
|
249
|
+
gap: "24px",
|
|
250
|
+
},
|
|
251
|
+
// CTA content wrapper
|
|
252
|
+
ctaContentWrapper: {
|
|
253
|
+
display: "flex",
|
|
254
|
+
flexDirection: "column",
|
|
255
|
+
justifyContent: "center",
|
|
256
|
+
alignItems: "center",
|
|
257
|
+
gap: "16px",
|
|
258
|
+
},
|
|
259
|
+
// Thanks for playing text
|
|
260
|
+
thanksText: {
|
|
261
|
+
color: props.textPrimary,
|
|
262
|
+
textAlign: "center",
|
|
263
|
+
fontFamily: props.fontFamilyPrimary,
|
|
264
|
+
fontSize: "1.25rem",
|
|
265
|
+
fontStyle: "normal",
|
|
266
|
+
fontWeight: 500,
|
|
267
|
+
lineHeight: "120%",
|
|
268
|
+
letterSpacing: "0.15px",
|
|
269
|
+
},
|
|
270
|
+
// Buttons container
|
|
271
|
+
buttonsContainer: {
|
|
272
|
+
display: "flex",
|
|
273
|
+
flexDirection: { xs: "column", md: "row" },
|
|
274
|
+
gap: "16px",
|
|
275
|
+
},
|
|
276
|
+
// Play again button
|
|
277
|
+
playAgainButton: {
|
|
278
|
+
display: "flex",
|
|
279
|
+
py: props.spacingScale.xs,
|
|
280
|
+
px: "16px",
|
|
281
|
+
flexDirection: "column",
|
|
282
|
+
justifyContent: "center",
|
|
283
|
+
alignItems: "center",
|
|
284
|
+
gap: "8px",
|
|
285
|
+
borderRadius: props.borderRadius.xl,
|
|
286
|
+
color: props.textPrimary,
|
|
287
|
+
bgcolor: props.surfaceColor,
|
|
288
|
+
"&:hover": {
|
|
289
|
+
bgcolor: props.onSurfaceColor,
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
// Play again button content
|
|
293
|
+
playAgainButtonContent: {
|
|
294
|
+
display: "flex",
|
|
295
|
+
justifyContent: "center",
|
|
296
|
+
alignItems: "center",
|
|
297
|
+
gap: "8px",
|
|
298
|
+
alignSelf: "stretch",
|
|
299
|
+
},
|
|
300
|
+
// Play again icon
|
|
301
|
+
playAgainIcon: {
|
|
302
|
+
display: "flex",
|
|
303
|
+
width: "16px",
|
|
304
|
+
height: "16px",
|
|
305
|
+
justifyContent: "flex-end",
|
|
306
|
+
alignItems: "center",
|
|
307
|
+
color: props.textPrimary,
|
|
308
|
+
},
|
|
309
|
+
// Play again text
|
|
310
|
+
playAgainText: {
|
|
311
|
+
color: props.textPrimary,
|
|
312
|
+
textAlign: "center",
|
|
313
|
+
fontFamily: props.fontFamilyPrimary,
|
|
314
|
+
fontSize: "0.8125rem",
|
|
315
|
+
fontStyle: "normal",
|
|
316
|
+
fontWeight: 500,
|
|
317
|
+
lineHeight: "22px",
|
|
318
|
+
letterSpacing: "0.46px",
|
|
319
|
+
textTransform: "uppercase",
|
|
320
|
+
},
|
|
321
|
+
// Share button
|
|
322
|
+
shareButton: {
|
|
323
|
+
display: "flex",
|
|
324
|
+
py: props.spacingScale.xs,
|
|
325
|
+
px: "16px",
|
|
326
|
+
flexDirection: "column",
|
|
327
|
+
justifyContent: "center",
|
|
328
|
+
alignItems: "center",
|
|
329
|
+
gap: "10px",
|
|
330
|
+
borderRadius: props.borderRadius.xl,
|
|
331
|
+
bgcolor: props.primaryColor,
|
|
332
|
+
"&:hover": {
|
|
333
|
+
bgcolor: props.primaryColor,
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
// Share button content
|
|
337
|
+
shareButtonContent: {
|
|
338
|
+
display: "flex",
|
|
339
|
+
justifyContent: "center",
|
|
340
|
+
alignItems: "center",
|
|
341
|
+
gap: "8px",
|
|
342
|
+
alignSelf: "stretch",
|
|
343
|
+
},
|
|
344
|
+
// Share icon
|
|
345
|
+
shareIcon: {
|
|
346
|
+
display: "flex",
|
|
347
|
+
width: "16px",
|
|
348
|
+
height: "16px",
|
|
349
|
+
justifyContent: "center",
|
|
350
|
+
alignItems: "center",
|
|
351
|
+
color: props.onPrimaryColor,
|
|
352
|
+
},
|
|
353
|
+
// Share text
|
|
354
|
+
shareText: {
|
|
355
|
+
color: props.onPrimaryColor,
|
|
356
|
+
textAlign: "center",
|
|
357
|
+
fontFamily: props.fontFamilyPrimary,
|
|
358
|
+
fontSize: "0.8125rem",
|
|
359
|
+
fontStyle: "normal",
|
|
360
|
+
fontWeight: 500,
|
|
361
|
+
lineHeight: "22px",
|
|
362
|
+
letterSpacing: "0.46px",
|
|
363
|
+
textTransform: "uppercase",
|
|
364
|
+
},
|
|
365
|
+
// Presented by mobile
|
|
366
|
+
presentedByMobile: {
|
|
367
|
+
display: { xs: "block", md: "none" },
|
|
368
|
+
},
|
|
369
|
+
// Lead collection container
|
|
370
|
+
leadCollectionContainer: {
|
|
371
|
+
p: props.spacingScale.lg,
|
|
372
|
+
gap: props.spacingScale.md,
|
|
373
|
+
display: "flex",
|
|
374
|
+
flexDirection: "column",
|
|
375
|
+
backdropFilter: "blur(4px)",
|
|
376
|
+
bgcolor: `rgba(${props.bgcolor ? props.bgcolor.replace(/[^\d,]/g, "") : ""}, 0.5)`,
|
|
377
|
+
borderRadius: props.borderRadius.sm,
|
|
378
|
+
boxShadow: "lg",
|
|
379
|
+
},
|
|
380
|
+
// Lead content wrapper
|
|
381
|
+
leadContentWrapper: {
|
|
382
|
+
display: "flex",
|
|
383
|
+
flexDirection: "column",
|
|
384
|
+
justifyContent: "center",
|
|
385
|
+
alignItems: "center",
|
|
386
|
+
alignSelf: "stretch",
|
|
387
|
+
},
|
|
388
|
+
alertMessageArea: {
|
|
389
|
+
flex: {
|
|
390
|
+
lg: 0.5,
|
|
391
|
+
xs: 1,
|
|
392
|
+
},
|
|
393
|
+
display: "flex",
|
|
394
|
+
flexDirection: "column",
|
|
395
|
+
justifyContent: "center",
|
|
396
|
+
},
|
|
397
|
+
alertMessageWrapper: {
|
|
398
|
+
p: props.spacingScale.lg,
|
|
399
|
+
},
|
|
400
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplitVariant.d.ts","sourceRoot":"","sources":["../../../../../src/components/Variants/Split/SplitVariant.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAYhD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqO3C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Box, Typography, Button as JoyButton, AspectRatio } from "@mui/joy";
|
|
4
|
+
import { hexToRgb, stripHtmlTags, useImageUrl, isMobile, useColors, useCornerRadius, useFontFamily, useInternalTheme, useSpacingScale, } from "@fansunited/common";
|
|
5
|
+
import Answers from "../../Shared/Answers/Answers";
|
|
6
|
+
import Button from "../../Shared/Button";
|
|
7
|
+
import ArrowRightAltIcon from "@mui/icons-material/ArrowRightAlt";
|
|
8
|
+
import Stopwatch from "../../Shared/Stopwatch";
|
|
9
|
+
import MainCard from "../../Shared/MainCard";
|
|
10
|
+
import bgImage from "../../../assets/default-quiz-bg.png";
|
|
11
|
+
import mobileBgImage from "../../../assets/default-quiz-bg-vertical.jpg";
|
|
12
|
+
import { useTranslation } from "react-i18next";
|
|
13
|
+
import PresentedBy from "../../Shared/PresentedBy";
|
|
14
|
+
import CollectLead from "../../Leads/CollectLead";
|
|
15
|
+
import { quizTypes } from "../../../constants/constants";
|
|
16
|
+
import { useEmbedCode } from "../../../hooks/useEmbedCodeContainer";
|
|
17
|
+
import { createStyles } from "./SplitVariant.styles";
|
|
18
|
+
const SplitVariant = (props) => {
|
|
19
|
+
const [showLead, setShowLead] = React.useState(props.leads?.position === "before" &&
|
|
20
|
+
props.classicQuiz.authRequirement === "LEAD");
|
|
21
|
+
const theme = useInternalTheme();
|
|
22
|
+
const quizImage = useImageUrl(props.classicQuiz.images);
|
|
23
|
+
const questionImage = useImageUrl(props.question.images);
|
|
24
|
+
const { t } = useTranslation();
|
|
25
|
+
const brandingColors = props.classicQuiz.branding?.colors || null;
|
|
26
|
+
const brandingLogo = isMobile()
|
|
27
|
+
? props.classicQuiz.branding?.images.mobileLogo ||
|
|
28
|
+
props.classicQuiz.branding?.images.mainLogo ||
|
|
29
|
+
""
|
|
30
|
+
: props.classicQuiz.branding?.images.mainLogo || "";
|
|
31
|
+
const imagePlaceholder = isMobile() ? mobileBgImage : bgImage;
|
|
32
|
+
const embedContainerRef = useEmbedCode(props.question.embedCode, props.applyFilterScreen);
|
|
33
|
+
// Styling variables
|
|
34
|
+
const secondaryColor = brandingColors?.contentColor || useColors().textColor;
|
|
35
|
+
const fontFamilySecondary = useFontFamily().secondary;
|
|
36
|
+
const opacity = "60%";
|
|
37
|
+
const fontFamilyPrimary = useFontFamily().primary;
|
|
38
|
+
const buttonRadius = useCornerRadius().xl;
|
|
39
|
+
const backgroundColor = brandingColors?.backgroundColor || useColors().surfaceVariant;
|
|
40
|
+
const primaryColor = brandingColors?.primaryColor || useColors().palette?.primary?.plainColor;
|
|
41
|
+
const onPrimaryColor = useColors().palette?.primary?.onPrimary;
|
|
42
|
+
const textColor = useColors().textColor;
|
|
43
|
+
const spacingScale = useSpacingScale();
|
|
44
|
+
const borderRadius = useCornerRadius();
|
|
45
|
+
const bgcolor = hexToRgb(backgroundColor || "");
|
|
46
|
+
// Create styles with current props/theme values
|
|
47
|
+
const styles = createStyles({
|
|
48
|
+
quizImage,
|
|
49
|
+
questionImage,
|
|
50
|
+
imagePlaceholder,
|
|
51
|
+
spacingScale,
|
|
52
|
+
borderRadius,
|
|
53
|
+
fontFamilyPrimary,
|
|
54
|
+
fontFamilySecondary,
|
|
55
|
+
secondaryColor,
|
|
56
|
+
opacity,
|
|
57
|
+
buttonRadius,
|
|
58
|
+
bgcolor,
|
|
59
|
+
primaryColor,
|
|
60
|
+
onPrimaryColor,
|
|
61
|
+
textColor,
|
|
62
|
+
brandingColors,
|
|
63
|
+
darkTextColor: theme.colorSchemes.dark.textColor,
|
|
64
|
+
applyFilterScreen: props.applyFilterScreen,
|
|
65
|
+
});
|
|
66
|
+
const closeLeadForm = () => {
|
|
67
|
+
setShowLead(false);
|
|
68
|
+
};
|
|
69
|
+
const renderPresentedBy = (textColor) => (_jsx(PresentedBy, { brandingLogo: brandingLogo, textColor: textColor }));
|
|
70
|
+
return (_jsxs(MainCard, { brandingBorderColor: brandingColors?.borderColor || null, children: [_jsx(Box, { sx: styles.headlineSection, children: _jsxs(Box, { sx: styles.headlineContent, children: [_jsxs(Box, { children: [_jsx(Typography, { level: "body-sm", sx: styles.quizHeadlineText, children: t("classicQuiz.headline") }), _jsxs(Box, { sx: styles.contentContainer, children: [_jsx(Typography, { level: "body-lg", sx: styles.quizTitleText, children: props.classicQuiz.title }), _jsx(Typography, { level: "body-md", sx: styles.quizDescriptionText, children: stripHtmlTags(props.classicQuiz.description) })] })] }), props.applyFilterScreen ? (_jsx(Box, { children: _jsxs(Box, { sx: styles.filterScreenBottomContainer, children: [renderPresentedBy(brandingColors?.contentColor ||
|
|
71
|
+
theme.colorSchemes.dark.textColor), _jsx(JoyButton, { variant: "soft", sx: {
|
|
72
|
+
...styles.startButton,
|
|
73
|
+
...styles.pulseAnimation,
|
|
74
|
+
}, endDecorator: _jsx(ArrowRightAltIcon, {}), onClick: props.startPlaying, children: _jsx(Typography, { sx: styles.startButtonText, children: t("classicQuiz.buttons.start") }) })] }) })) : (_jsx(Box, { sx: styles.presentedByDesktop, children: renderPresentedBy(brandingColors?.contentColor ||
|
|
75
|
+
theme.colorSchemes.dark.textColor) }))] }) }), _jsx(Box, { sx: styles.questionArea, children: showLead ? (_jsx(Box, { sx: styles.leadContentContainer, children: _jsx(CollectLead, { sdk: props.sdk, contentType: "quiz", startGame: closeLeadForm, contentId: props.classicQuiz.id, contentName: props.classicQuiz.title, brandingColors: props.classicQuiz.branding?.colors, brandingUrls: props.classicQuiz.branding?.urls, campaignId: props.leads?.campaignId, campaignName: props.leads?.campaignName, fields: props.leads?.fields, leadTitle: props.classicQuiz.labels?.leadTitle, leadDescription: props.classicQuiz.labels?.leadDescription, leadCta: props.classicQuiz.labels?.leadCta, leadSuccessTitle: props.classicQuiz.labels?.leadSuccessTitle, leadSuccessDescription: props.classicQuiz.labels?.leadSuccessDescription }) })) : (_jsxs(_Fragment, { children: [quizTypes.includes(props.classicQuiz.type?.toLocaleLowerCase()) && (_jsx(Box, { sx: styles.stopwatchContainer, children: _jsx(Stopwatch, { brandingPrimaryColor: brandingColors?.primaryColor || null, isRunning: props.isStopwatchRunning, timer: props.stopwatchTime, quizType: props.classicQuiz.type, initialTime: props.classicQuiz.time || 10, onTimeUpdate: props.onTimeUpdate }) })), _jsxs(Box, { sx: styles.mainContentContainer, children: [props.question.embedCode && (_jsx(AspectRatio, { ratio: "16/9", sx: styles.aspectRatioContainer, children: _jsx(Box, { ref: embedContainerRef }) })), !props.question.embedCode && questionImage && (_jsx(AspectRatio, { ratio: "16/9", sx: styles.questionImageContainer, children: _jsx(Box, { sx: styles.questionImageBox, children: _jsx("img", { src: questionImage, alt: "Question illustration", style: styles.questionImage }) }) })), _jsxs(Box, { sx: styles.questionSection, children: [_jsxs(Typography, { level: "body-lg", sx: styles.questionStepsText, children: [props.currentQuestion, "/", props.classicQuiz.questionsCount] }), _jsx(Typography, { level: "body-lg", sx: styles.questionText, children: props.question.question })] }), _jsx(Answers, { options: props.question.options || [], answerQuestion: props.answerQuestion, selectedOption: props.selectedOption, showAnswer: props.showAnswer, twoByTwo: true, questionImage: questionImage, brandingColors: brandingColors }), _jsxs(Box, { sx: styles.buttonFooterContainer, children: [_jsx(Button, { showAnswer: props.showAnswer, selectedOption: props.selectedOption, endDecorator: _jsx(ArrowRightAltIcon, {}), label: props.currentQuestion === props.classicQuiz.questionsCount
|
|
76
|
+
? t("classicQuiz.buttons.finish")
|
|
77
|
+
: t("classicQuiz.buttons.next"), buttonColor: primaryColor, onClick: props.handleNext }), _jsx(Box, { sx: styles.presentedByMobile, children: renderPresentedBy(brandingColors?.contentColor || textColor) })] })] })] })) })] }));
|
|
78
|
+
};
|
|
79
|
+
export default SplitVariant;
|