From 88a7181695bff11bba48bd972b347eff93c6cd94 Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Fri, 15 Sep 2023 23:29:52 +0300 Subject: [PATCH] Refactor UI elements positioning and minor UI fixes --- .../frontend/src/components/Common/Button.tsx | 8 +- .../frontend/src/components/Common/Card.tsx | 16 --- .../src/components/Common/Checkbox.tsx | 6 +- .../src/components/Common/Dropdown.tsx | 6 +- .../components/Common/DropdownCheckbox.tsx | 2 +- .../src/components/Common/FileInput.tsx | 6 +- .../frontend/src/components/Common/Form.tsx | 20 ++- .../src/components/Common/MiniButton.tsx | 15 +- .../frontend/src/components/Common/Modal.tsx | 4 +- .../src/components/Common/SubmitButton.tsx | 6 +- .../src/components/Common/TextArea.tsx | 12 +- .../src/components/Common/TextInput.tsx | 8 +- .../src/components/Common/Tristate.tsx | 4 +- .../src/components/Help/HelpConstituenta.tsx | 2 +- .../components/Navigation/UserDropdown.tsx | 2 +- .../frontend/src/pages/CreateRSFormPage.tsx | 57 ++++---- .../src/pages/LibraryPage/PickerStrategy.tsx | 2 +- rsconcept/frontend/src/pages/LoginPage.tsx | 10 +- .../src/pages/RSFormPage/DlgCloneRSForm.tsx | 4 +- .../src/pages/RSFormPage/DlgCreateCst.tsx | 16 +-- .../src/pages/RSFormPage/DlgDeleteCst.tsx | 4 +- .../src/pages/RSFormPage/DlgGraphOptions.tsx | 4 +- .../src/pages/RSFormPage/DlgRenameCst.tsx | 4 +- .../src/pages/RSFormPage/DlgUploadRSForm.tsx | 4 +- .../pages/RSFormPage/EditorConstituenta.tsx | 112 ++++++++------- .../src/pages/RSFormPage/EditorItems.tsx | 25 ++-- .../pages/RSFormPage/EditorRSExpression.tsx | 98 ++++++------- .../src/pages/RSFormPage/EditorRSForm.tsx | 131 +++++++++--------- .../src/pages/RSFormPage/EditorTermGraph.tsx | 27 ++-- .../src/pages/RSFormPage/RSTabsMenu.tsx | 6 +- .../RSFormPage/elements/RSTokenButton.tsx | 2 +- .../elements/ViewSideConstituents.tsx | 2 +- rsconcept/frontend/src/pages/RegisterPage.tsx | 6 +- .../pages/UserProfilePage/EditorPassword.tsx | 18 ++- .../pages/UserProfilePage/EditorProfile.tsx | 52 ++++--- rsconcept/frontend/src/utils/staticUI.ts | 2 +- 36 files changed, 348 insertions(+), 355 deletions(-) delete mode 100644 rsconcept/frontend/src/components/Common/Card.tsx diff --git a/rsconcept/frontend/src/components/Common/Button.tsx b/rsconcept/frontend/src/components/Common/Button.tsx index b6ba3023..3ba5ce94 100644 --- a/rsconcept/frontend/src/components/Common/Button.tsx +++ b/rsconcept/frontend/src/components/Common/Button.tsx @@ -5,7 +5,7 @@ extends Omit, 'className' | 'child tooltip?: string dense?: boolean loading?: boolean - widthClass?: string + dimensions?: string borderClass?: string colorClass?: string } @@ -15,7 +15,7 @@ function Button({ dense, disabled, borderClass = 'border rounded', colorClass = 'clr-btn-default', - widthClass = 'w-fit h-fit', + dimensions = 'w-fit h-fit', loading, onClick, ...props }: ButtonProps) { @@ -27,10 +27,10 @@ function Button({ disabled={disabled ?? loading} onClick={onClick} title={tooltip} - className={`inline-flex items-center gap-2 align-middle justify-center select-none ${padding} ${colorClass} ${widthClass} ${borderClass} ${cursor}`} + className={`inline-flex items-center gap-2 align-middle justify-center select-none ${padding} ${colorClass} ${dimensions} ${borderClass} ${cursor}`} {...props} > - {icon && {icon}} + {icon && icon} {text && {text}} ); diff --git a/rsconcept/frontend/src/components/Common/Card.tsx b/rsconcept/frontend/src/components/Common/Card.tsx deleted file mode 100644 index 652a2142..00000000 --- a/rsconcept/frontend/src/components/Common/Card.tsx +++ /dev/null @@ -1,16 +0,0 @@ -interface CardProps { - title?: string - widthClass?: string - children: React.ReactNode -} - -function Card({ title, widthClass = 'min-w-fit', children }: CardProps) { - return ( -
- { title &&

{title}

} - {children} -
- ); -} - -export default Card; diff --git a/rsconcept/frontend/src/components/Common/Checkbox.tsx b/rsconcept/frontend/src/components/Common/Checkbox.tsx index e1fb5076..b3bd74de 100644 --- a/rsconcept/frontend/src/components/Common/Checkbox.tsx +++ b/rsconcept/frontend/src/components/Common/Checkbox.tsx @@ -9,7 +9,7 @@ extends Omit, 'className' | 'child label?: string required?: boolean disabled?: boolean - widthClass?: string + dimensions?: string tooltip?: string value: boolean @@ -18,7 +18,7 @@ extends Omit, 'className' | 'child function Checkbox({ id, required, disabled, tooltip, label, - widthClass = 'w-fit', value, setValue, ...props + dimensions = 'w-fit', value, setValue, ...props }: CheckboxProps) { const cursor = useMemo( () => { @@ -46,7 +46,7 @@ function Checkbox({ return ( ); } diff --git a/rsconcept/frontend/src/components/Common/Modal.tsx b/rsconcept/frontend/src/components/Common/Modal.tsx index 3f943b9b..8be6bc10 100644 --- a/rsconcept/frontend/src/components/Common/Modal.tsx +++ b/rsconcept/frontend/src/components/Common/Modal.tsx @@ -51,7 +51,7 @@ function Modal({