Skip to content

Commit 370e15f

Browse files
committed
feat: update layout and structure of search options in facets page
1 parent 71facde commit 370e15f

File tree

1 file changed

+49
-47
lines changed

1 file changed

+49
-47
lines changed

src/routes/facets/[facet]/[value]/+page.svelte

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
<h2 class="my-8 text-3xl font-bold">Exploring {facet.name}: {facet.value}</h2>
3636

37-
<div class="my-8 grid w-full gap-4 lg:grid-cols-2">
37+
<div class="my-8 flex w-full flex-col gap-4">
3838
{#if Object.entries(knowledgePanels).length > 0}
3939
<div class="w-full">
4040
<h2 class="mb-2 grow text-2xl font-bold">Knowledge Panels</h2>
@@ -43,54 +43,56 @@
4343
{/if}
4444

4545
<div class="w-full space-y-2">
46-
<h2 class="grow text-2xl font-bold">Search Options</h2>
47-
<label class="select w-full">
48-
<span class="label w-50">{$_('search.page_size')}</span>
49-
<select
50-
value={`${results.page_size}`}
51-
oninput={(e) => {
52-
const params = new SvelteURLSearchParams(page.url.search);
53-
params.set('page_size', e.currentTarget.value);
54-
goto(`?${params}`);
55-
}}
56-
>
57-
<option value="10">10</option>
58-
<option value="50">50</option>
59-
<option value="100">100</option>
60-
<option value="200">200</option>
61-
</select>
62-
</label>
46+
<h2 class="mb-2 grow text-2xl font-bold">Search Options</h2>
47+
<div class="grid gap-4 md:grid-cols-3">
48+
<label class="select w-full">
49+
<span class="label w-50">{$_('search.page_size')}</span>
50+
<select
51+
value={`${results.page_size}`}
52+
oninput={(e) => {
53+
const params = new SvelteURLSearchParams(page.url.search);
54+
params.set('page_size', e.currentTarget.value);
55+
goto(`?${params}`);
56+
}}
57+
>
58+
<option value="10">10</option>
59+
<option value="50">50</option>
60+
<option value="100">100</option>
61+
<option value="200">200</option>
62+
</select>
63+
</label>
6364

64-
<label class="select w-full">
65-
<span class="label w-50">{$_('search.sort_by_label')}</span>
66-
<select
67-
value={searchOptions.sortBy || 'last_modified_t'}
68-
oninput={(e) => {
69-
const params = new SvelteURLSearchParams(page.url.search);
70-
params.set('sort_by', e.currentTarget.value);
71-
goto(`?${params}`);
72-
}}
73-
>
74-
<option value="popularity">Popularity</option>
75-
<option value="nutriscore_score">{$_('nutriscore')}</option>
76-
<option value="environmental_score_score">{$_('ecoscore')}</option>
77-
<option value="created_t">{$_('search.creation_date')}</option>
78-
<option value="last_modified_t">{$_('search.last_modified_date')}</option>
79-
</select>
80-
</label>
65+
<label class="select w-full">
66+
<span class="label w-50">{$_('search.sort_by_label')}</span>
67+
<select
68+
value={searchOptions.sortBy || 'last_modified_t'}
69+
oninput={(e) => {
70+
const params = new SvelteURLSearchParams(page.url.search);
71+
params.set('sort_by', e.currentTarget.value);
72+
goto(`?${params}`);
73+
}}
74+
>
75+
<option value="popularity">Popularity</option>
76+
<option value="nutriscore_score">{$_('nutriscore')}</option>
77+
<option value="environmental_score_score">{$_('ecoscore')}</option>
78+
<option value="created_t">{$_('search.creation_date')}</option>
79+
<option value="last_modified_t">{$_('search.last_modified_date')}</option>
80+
</select>
81+
</label>
8182

82-
<label class="select mb-2 w-full">
83-
<span class="label w-50">{$_('search.advanced_view')}</span>
84-
<select
85-
value={`${listView}`}
86-
oninput={(e) => {
87-
listView = e.currentTarget.value === 'true';
88-
}}
89-
>
90-
<option value="false">Off</option>
91-
<option value="true">On</option>
92-
</select>
93-
</label>
83+
<label class="select w-full">
84+
<span class="label w-50">{$_('search.advanced_view')}</span>
85+
<select
86+
value={`${listView}`}
87+
oninput={(e) => {
88+
listView = e.currentTarget.value === 'true';
89+
}}
90+
>
91+
<option value="false">Off</option>
92+
<option value="true">On</option>
93+
</select>
94+
</label>
95+
</div>
9496
</div>
9597
</div>
9698

0 commit comments

Comments
 (0)