diff --git a/src/back/routes/common/show-first-row/show-first-row.css b/src/back/routes/common/show-first-row/show-first-row.css index 40da3ab..d82206c 100644 --- a/src/back/routes/common/show-first-row/show-first-row.css +++ b/src/back/routes/common/show-first-row/show-first-row.css @@ -27,4 +27,18 @@ margin: 0 auto; margin-top: 20px; } + + .show-first-row__show-less-button { + display: none; + } + + &:has(input:checked) { + .show-first-row__show-less-button { + display: block; + } + + .show-first-row__show-more-button { + display: none; + } + } } diff --git a/src/back/routes/common/show-first-row/show-first-row.tsx b/src/back/routes/common/show-first-row/show-first-row.tsx index cccee3d..616d486 100644 --- a/src/back/routes/common/show-first-row/show-first-row.tsx +++ b/src/back/routes/common/show-first-row/show-first-row.tsx @@ -18,18 +18,27 @@ export async function showFirstRow({ make_show_more_button = () => ( Show more ), - add_button_to_content = (content, button) => ( + make_show_less_button = () => ( + Show less + ), + add_button_to_content = (content, show_more_button, show_less_button) => ( <> {content} - {button} + {show_more_button} + {show_less_button} ), }: { items: FlatTemplatable[]; min_column_width_px?: number; make_show_more_button?: () => JSX.Element; + make_show_less_button?: () => JSX.Element; column_gap_px?: number; - add_button_to_content?: (content: JSX.Element, button: JSX.Element) => JSX.Element; + add_button_to_content?: ( + content: JSX.Element, + show_more_button: JSX.Element, + show_less_button: JSX.Element + ) => JSX.Element; }): Promise { const id = showFirstRowIds.next().value; const checkbox_id = "show-first-row__checkbox--" + id; @@ -62,8 +71,17 @@ export async function showFirstRow({ {add_button_to_content(
{items}
, -