Skip to content

Commit 57a49d4

Browse files
Merge pull request #184 from OneBusAway/survey-fnf
Survey fit and finish
2 parents d36806e + 7212d83 commit 57a49d4

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

src/components/surveys/SurveyModal.svelte

+9-10
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,13 @@
111111
</script>
112112
113113
{#if $showSurveyModal && currentSurvey}
114-
<Modal open={$showSurveyModal} size="3xl" class="max-w-5xl rounded-2xl">
115-
<div
116-
class="flex items-center justify-between rounded-t-2xl border-b border-gray-200 p-6 dark:border-gray-700"
117-
>
118-
<h2 class="text-2xl font-bold text-gray-900 dark:text-white">{currentSurvey.name}</h2>
119-
</div>
120-
121-
<div class="flex flex-col space-y-6 p-6">
114+
<Modal
115+
title={currentSurvey.name}
116+
open={$showSurveyModal}
117+
size="3xl"
118+
class="max-w-5xl rounded-2xl"
119+
>
120+
<div class="flex flex-col space-y-2">
122121
{#if surveySubmitted}
123122
<div class="flex flex-1 flex-col items-center justify-center p-12">
124123
<svg
@@ -141,7 +140,7 @@
141140
</p>
142141
</div>
143142
{:else}
144-
<div class="max-h-[60vh] overflow-y-auto p-6">
143+
<div class="max-h-[60vh] overflow-y-auto p-2">
145144
{#if !heroQuestionAnswered && !skipHeroQuestion}
146145
<SurveyQuestion
147146
question={heroQuestion}
@@ -168,7 +167,7 @@
168167
</div>
169168
170169
<div
171-
class="sticky bottom-0 flex justify-end gap-4 rounded-b-2xl border-t border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800"
170+
class="sticky bottom-0 flex justify-end gap-4 rounded-b-2xl border-t border-gray-200 bg-white pt-4 dark:border-gray-700 dark:bg-gray-800"
172171
>
173172
{#if !heroQuestionAnswered && !skipHeroQuestion}
174173
<Button

src/components/surveys/SurveyQuestion.svelte

+9-10
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
};
1919
2020
const sizeClasses = {
21-
label: variant === 'compact' ? 'mb-2 text-xl' : 'mb-4 text-3xl',
21+
label: variant === 'compact' ? 'mb-2 text-xl' : 'mb-4 text-2xl',
2222
input: variant === 'compact' ? 'mt-1 px-3 py-2 text-lg' : 'mt-2 px-5 py-4 text-xl',
23-
option: variant === 'compact' ? 'p-2 text-lg' : 'p-3 text-xl'
23+
option: variant === 'compact' ? 'p-1 text-lg' : 'p-2 text-lg'
2424
};
2525
2626
const errorClasses = {
27-
label: variant === 'compact' ? 'text-red-500' : 'text-2xl text-red-500'
27+
label: variant === 'compact' ? 'text-red-500' : 'text-xl text-red-500'
2828
};
2929
3030
function handleInput(event) {
@@ -34,12 +34,11 @@
3434
</script>
3535

3636
<label class={`${baseClasses.label} ${sizeClasses.label}`} for="question-{index}">
37-
<span class="absolute inset-0 -z-10 rounded-md bg-gray-100 px-3 py-2 dark:bg-gray-800"></span>
3837
{#if question.content.type !== 'label'}
3938
{question.content.label_text}
4039
{/if}
4140
{#if required && question.content.type !== 'label'}
42-
<span class="ml-1 text-red-500">*</span>
41+
<span class="ml-1 text-red-500" aria-label="Required question">*</span>
4342
{/if}
4443
</label>
4544

@@ -53,7 +52,7 @@
5352
class={`${baseClasses.input} ${sizeClasses.input} ${error ? 'border-red-500' : ''}`}
5453
/>
5554
{:else if question.content.type === 'radio'}
56-
<div class={`mt-2 space-y-${variant === 'compact' ? '1' : '4'}`}>
55+
<div class={`mt-2 space-y-${variant === 'compact' ? '0' : '2'}`}>
5756
{#each question.content.options as option}
5857
<Radio
5958
name="radio-{index}"
@@ -67,7 +66,7 @@
6766
{/each}
6867
</div>
6968
{:else if question.content.type === 'checkbox'}
70-
<div class={`mt-2 space-y-${variant === 'compact' ? '1' : '4'}`}>
69+
<div class={`mt-2 space-y-${variant === 'compact' ? '0' : '2'}`}>
7170
{#each question.content.options as option}
7271
<Checkbox
7372
name="checkbox-{index}"
@@ -81,7 +80,7 @@
8180
{/each}
8281
</div>
8382
{:else if question.content.type === 'label'}
84-
<p class={`${sizeClasses.label} mt-4 font-bold text-black dark:text-white`}>
83+
<p class={`${sizeClasses.label} text-semibold mt-4 font-bold dark:text-white`}>
8584
{question.content.label_text}
8685
</p>
8786
{:else if question.content.type === 'external_survey'}
@@ -90,12 +89,12 @@
9089
href={question.content.url}
9190
target="_blank"
9291
rel="noopener noreferrer"
93-
class="inline-block text-2xl font-semibold text-blue-500 underline transition-all hover:text-blue-600"
92+
class="inline-block text-xl font-semibold text-blue-500 underline transition-all hover:text-blue-600"
9493
>
9594
{question.content.label_text}
9695
</a>
9796
{#if question.content.survey_provider}
98-
<p class="mt-1 text-2xl text-gray-500">
97+
<p class="mt-1 text-gray-500">
9998
Powered by {question.content.survey_provider}
10099
</p>
101100
{/if}

src/routes/+page.svelte

+5-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@
225225
{handleViewAllRoutes}
226226
{clearPolylines}
227227
{handleTripPlan}
228-
/>
228+
>
229+
{#snippet childContent()}
230+
<!-- optional child content -->
231+
{/snippet}
232+
</SearchPane>
229233
230234
<div class="mt-4 flex-1">
231235
{#if stop}

0 commit comments

Comments
 (0)