From 51581ea27e43472f86a5ec28573d3aae2d839e8a Mon Sep 17 00:00:00 2001 From: Kerry Date: Thu, 14 Sep 2023 10:07:47 +1200 Subject: [PATCH] Profile: hide email pagination controls when no other pages (#1764) * make add email button small * hide pagination when only one page of emails * add autohide to paginationcontrols --- frontend/src/components/PaginationControls.tsx | 6 ++++++ .../src/components/UserProfile/AddEmailForm.tsx | 4 +++- .../src/components/UserProfile/UserEmailList.tsx | 14 ++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/PaginationControls.tsx b/frontend/src/components/PaginationControls.tsx index 0359bca99..e2df45b61 100644 --- a/frontend/src/components/PaginationControls.tsx +++ b/frontend/src/components/PaginationControls.tsx @@ -17,6 +17,8 @@ import { Button } from "@vector-im/compound-web"; type Props = { onNext: (() => void) | null; onPrev: (() => void) | null; + // automatically hide the component when there are no onNext/onPrev + autoHide?: boolean; count?: number; disabled?: boolean; }; @@ -24,9 +26,13 @@ type Props = { const PaginationControls: React.FC = ({ onNext, onPrev, + autoHide, count, disabled, }) => { + if (autoHide && !onNext && !onPrev) { + return null; + } return (