Skip to content

Commit d5c6e05

Browse files
Merge pull request #314 from os2display/feature/5529-move-filters-and-buttons-around-in-the-list-view
Move filters and buttons around in the list view
2 parents 257aaf5 + 77c8fc9 commit d5c6e05

File tree

4 files changed

+54
-52
lines changed

4 files changed

+54
-52
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file.
2424
- Added command to migrate config.json files.
2525
- Fix data fetching bug
2626
- Refactored screen layout commands.
27+
- Moved list components (search and checkboxes) around
2728

2829
### NB! Prior to 3.x the project was split into separate repositories
2930

assets/admin/app.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ body {
1919
height: 100vh;
2020
height: -webkit-fill-available;
2121
max-height: 100vh;
22-
// overflow-x: auto;
23-
// overflow-y: hidden; // TODO: Why was this added?
2422
}
2523

2624
// To make multicomponent look like bootstrap for now
@@ -143,3 +141,10 @@ body {
143141
right: 0;
144142
margin: 2em;
145143
}
144+
145+
.delete-search-button {
146+
border-top-left-radius: 0;
147+
border-bottom-left-radius: 0;
148+
border-color: var(--bs-border-color);
149+
background-color: var(--bs-tertiary-bg);
150+
}

assets/admin/components/util/list/list.jsx

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ function List({
244244

245245
return (
246246
<>
247-
<Row className="my-2">
248-
<Col>
249-
{displaySearch && (
250-
<SearchBox value={searchParams} onChange={onSearch} />
251-
)}
252-
</Col>
253-
<>
254-
{enableScreenStatus && (
255-
<Col md="auto">
247+
<div className="my-2">
248+
<Row>
249+
<Col>
250+
{displaySearch && (
251+
<SearchBox value={searchParams} onChange={onSearch} />
252+
)}
253+
</Col>
254+
<Col className="d-flex justify-content-end">
255+
{enableScreenStatus && (
256256
<Select
257257
onChange={onScreenStatus}
258258
name="screenStatus"
@@ -281,41 +281,7 @@ function List({
281281
]}
282282
value={screenStatusParam}
283283
/>
284-
</Col>
285-
)}
286-
{displayPublished && publishedParams && (
287-
<Col md="auto">
288-
<>
289-
<FormCheckbox
290-
label={t("published")}
291-
onChange={onIsPublished}
292-
name="published"
293-
value={publishedParams === "published"}
294-
/>
295-
<FormCheckbox
296-
label={t("not-published")}
297-
name="not-published"
298-
onChange={onIsPublished}
299-
value={publishedParams === "not-published"}
300-
/>
301-
</>
302-
</Col>
303-
)}
304-
{createdByParams && showCreatedByFilter && (
305-
<Col md="auto">
306-
<>
307-
<FormCheckbox
308-
label={t("my-content")}
309-
name="current-user"
310-
onChange={onIsCreatedByChange}
311-
value={createdByParams === "current-user"}
312-
/>
313-
</>
314-
</Col>
315-
)}
316-
</>
317-
<Col md="auto" className="d-flex justify-content-end">
318-
<>
284+
)}
319285
{handleDelete && (
320286
<Button
321287
variant="danger"
@@ -327,7 +293,7 @@ function List({
327293
accept: deleteHandler,
328294
})
329295
}
330-
className="me-3"
296+
className="mx-2"
331297
>
332298
{t("delete-button")}
333299
</Button>
@@ -342,10 +308,40 @@ function List({
342308
{t("deselect-all")}
343309
</Button>
344310
)}
311+
</Col>
312+
</Row>
313+
<Row className="my-3">
314+
<>
315+
{createdByParams && showCreatedByFilter && (
316+
<div className="d-flex flex-row">
317+
<FormCheckbox
318+
label={t("my-content")}
319+
name="current-user"
320+
onChange={onIsCreatedByChange}
321+
value={createdByParams === "current-user"}
322+
/>
323+
{displayPublished && publishedParams && (
324+
<>
325+
<FormCheckbox
326+
formGroupClasses="mx-4"
327+
label={t("published")}
328+
onChange={onIsPublished}
329+
name="published"
330+
value={publishedParams === "published"}
331+
/>
332+
<FormCheckbox
333+
label={t("not-published")}
334+
name="not-published"
335+
onChange={onIsPublished}
336+
value={publishedParams === "not-published"}
337+
/>
338+
</>
339+
)}
340+
</div>
341+
)}
345342
</>
346-
</Col>
347-
</Row>
348-
<Row />
343+
</Row>
344+
</div>
349345
<Table data={data} columns={columns} isFetching={isFetching} />
350346
{!isFetching && (
351347
<Pagination

assets/admin/components/util/search-box/search-box.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function SearchBox({ onChange, value = "", showLabel = false }) {
2828
autoFocus
2929
placeholder={t("placeholder")}
3030
id="search-field"
31-
aria-label="search-box-aria-label"
31+
aria-label={t("search-box-aria-label")}
3232
role="search"
3333
name="search"
3434
value={value ?? ""}
@@ -37,7 +37,7 @@ function SearchBox({ onChange, value = "", showLabel = false }) {
3737
/>
3838
<div className="input-group-append">
3939
<button
40-
className="btn btn-outline-secondary"
40+
className="btn btn-outline-secondary delete-search-button"
4141
type="button"
4242
onClick={() => onChange("")}
4343
>

0 commit comments

Comments
 (0)