From dda2173adf1958fc21199ad8ba602c6ed9188246 Mon Sep 17 00:00:00 2001 From: Samuel Rowe Date: Sat, 30 Jul 2022 13:18:14 +0530 Subject: [PATCH] feat(frontend): updated UI of `Records` component * Removed `modal` prop. --- .../src/components/Modal/network/IPam.tsx | 2 -- .../src/components/Modal/network/Labels.tsx | 1 - .../src/components/Modal/service/General.tsx | 16 ++++++++++- services/frontend/src/components/Records.tsx | 28 +++++++++++-------- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/services/frontend/src/components/Modal/network/IPam.tsx b/services/frontend/src/components/Modal/network/IPam.tsx index 8016137..e9db9fa 100644 --- a/services/frontend/src/components/Modal/network/IPam.tsx +++ b/services/frontend/src/components/Modal/network/IPam.tsx @@ -49,7 +49,6 @@ const IPam = () => { [ @@ -131,7 +130,6 @@ const IPam = () => { [ diff --git a/services/frontend/src/components/Modal/network/Labels.tsx b/services/frontend/src/components/Modal/network/Labels.tsx index c0ef211..87e5e7c 100644 --- a/services/frontend/src/components/Modal/network/Labels.tsx +++ b/services/frontend/src/components/Modal/network/Labels.tsx @@ -13,7 +13,6 @@ const Labels: FunctionComponent = (): ReactElement => { [ diff --git a/services/frontend/src/components/Modal/service/General.tsx b/services/frontend/src/components/Modal/service/General.tsx index dc7bf36..49b93ed 100644 --- a/services/frontend/src/components/Modal/service/General.tsx +++ b/services/frontend/src/components/Modal/service/General.tsx @@ -30,7 +30,6 @@ const General = () => { [ @@ -67,6 +66,21 @@ const General = () => { protocol: "" }} /> + + [ + { + name: `profiles[${index}]`, + placeholder: "Name", + required: true, + type: "text" + } + ]} + newValue={""} + /> ); }; diff --git a/services/frontend/src/components/Records.tsx b/services/frontend/src/components/Records.tsx index 8b39568..0f36271 100644 --- a/services/frontend/src/components/Records.tsx +++ b/services/frontend/src/components/Records.tsx @@ -1,12 +1,12 @@ -import { Button, styled } from "@mui/joy"; +import { styled } from "@mui/joy"; import { Fragment, FunctionComponent, ReactElement, useCallback } from "react"; import { PlusIcon } from "@heroicons/react/outline"; import Record, { IFieldType } from "./Record"; import { useFormikContext } from "formik"; import lodash from "lodash"; +import IconButton from "@mui/joy/IconButton"; export interface IRecordsProps { - modal: string; title: string; referred: string; name: string; @@ -18,10 +18,15 @@ export interface IRecordsProps { renderBorder?: () => ReactElement; } -const Group = styled("div")` +interface IGroupProps { + empty: boolean; +} + +const Group = styled("div")` display: flex; flex-direction: column; - align-items: center; + align-items: ${({ empty }) => (empty ? "center" : "flex-end")}; + row-gap: ${({ theme }) => theme.spacing(1)}; `; const GroupTitle = styled("h5")` @@ -42,8 +47,9 @@ const RecordList = styled("div")` width: 100%; `; -const AddButton = styled(Button)` +const AddButton = styled(IconButton)` margin-top: ${({ theme }) => theme.spacing(1)}; + border-radius: ${({ theme }) => theme.spacing(2)}; `; const Description = styled("p")` @@ -51,13 +57,13 @@ const Description = styled("p")` text-align: center; color: #7a7a7a; font-size: 14px; + width: 100%; `; const Records: FunctionComponent = ( props: IRecordsProps ): ReactElement => { const { - modal, title, referred, name, @@ -89,7 +95,7 @@ const Records: FunctionComponent = ( const empty = items && items.length === 0; return ( - + {title} {!empty && ( @@ -108,11 +114,11 @@ const Records: FunctionComponent = ( ))} )} - {empty && No {referred}s.} - - - New {referred} + {empty && No items available} + + + );