From 33b5df69d0ed8a666de499a4728ee9cba5161fe1 Mon Sep 17 00:00:00 2001 From: MuhammadUmer44 Date: Tue, 10 Sep 2024 04:38:23 +0500 Subject: [PATCH] fix(blue-print): update add edge modal --- .../Body/AddEdgeNode/Title/ToNode/index.tsx | 36 +++++++++++++++- .../Body/AddEdgeNode/Title/index.tsx | 39 +++++++++-------- .../BlueprintModal/Body/AddEdgeNode/index.tsx | 43 +++++++++++++++++-- src/components/common/AutoComplete/index.tsx | 6 +++ 4 files changed, 100 insertions(+), 24 deletions(-) diff --git a/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/Title/ToNode/index.tsx b/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/Title/ToNode/index.tsx index 52798f7da..911f29f2e 100644 --- a/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/Title/ToNode/index.tsx +++ b/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/Title/ToNode/index.tsx @@ -1,16 +1,19 @@ import { FC, useEffect, useState } from 'react' import { useForm } from 'react-hook-form' +import styled from 'styled-components' import { OPTIONS } from '~/components/AddItemModal/SourceTypeStep/constants' import { TOption } from '~/components/AddItemModal/SourceTypeStep/types' import { FormData } from '~/components/ModalsContainer/BlueprintModal/Body/Editor' import { AutoComplete, TAutocompleteOption } from '~/components/common/AutoComplete' import { getNodeSchemaTypes } from '~/network/fetchSourcesData' +import { colors } from '~/utils' type Props = { onSelect: (type: string) => void dataTestId?: string hideSelectAll?: boolean edgeLink?: string + placeholder?: string } const defaultValues = { @@ -18,7 +21,7 @@ const defaultValues = { parent: '', } -export const ToNode: FC = ({ onSelect, dataTestId, edgeLink, hideSelectAll }) => { +export const ToNode: FC = ({ onSelect, dataTestId, edgeLink, hideSelectAll, placeholder }) => { const form = useForm({ mode: 'onChange', defaultValues, @@ -88,13 +91,42 @@ export const ToNode: FC = ({ onSelect, dataTestId, edgeLink, hideSelectAl } return ( - ) } + +const StyledAutoComplete = styled(AutoComplete)` + .MuiInputBase-input { + font-family: Barlow; + font-size: 14px; + font-weight: 400; + line-height: 16px; + letter-spacing: 0.01em; + text-align: left; + color: ${colors.white}; + padding-right: -8px; + + &::placeholder { + font-family: Barlow; + font-size: 14px; + font-weight: 400; + line-height: 16px; + letter-spacing: 0.01em; + text-align: left; + color: ${colors.GRAY7}; + opacity: 1; + } + } + + && .MuiInput-input.MuiInputBase-input { + padding-left: 0; + } +` diff --git a/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/Title/index.tsx b/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/Title/index.tsx index 7990500c6..8c90f26a2 100644 --- a/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/Title/index.tsx +++ b/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/Title/index.tsx @@ -2,9 +2,10 @@ import { FC } from 'react' import styled from 'styled-components' import { Flex } from '~/components/common/Flex' import { Text } from '~/components/common/Text' -import { ToNode } from './ToNode' import { TextInput } from '~/components/common/TextInput' import { requiredRule } from '~/constants' +import { colors } from '~/utils' +import { ToNode } from './ToNode' type Props = { selectedType: string @@ -27,35 +28,30 @@ export const TitleEditor: FC = ({ const hideSelectAllInTarget = selectedFromNode === 'all' return ( - - - - {edgeLinkData?.refId ? 'Edit Edge' : 'Add Edge'} - - - + - - Source + + Source - - Edge Name + + Edge Name = ({ - - Destination + + Destination ) } -const StyledText = styled(Text)` - font-size: 22px; - font-weight: 600; +const StyledLabel = styled(Text)` + font-family: Barlow; + font-size: 12px; + font-weight: 400; + line-height: 18px; + letter-spacing: 0.01em; + text-align: left; + margin-left: 1px; + color: ${colors.mainBottomIcons}; ` diff --git a/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/index.tsx b/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/index.tsx index 2a97f644a..fa2326e31 100644 --- a/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/index.tsx +++ b/src/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode/index.tsx @@ -1,8 +1,9 @@ -import { Body } from './Body' +import styled from 'styled-components' import { Flex } from '~/components/common/Flex' +import { Text } from '~/components/common/Text' import ClearIcon from '~/components/Icons/ClearIcon' -import styled from 'styled-components' import { colors } from '~/utils' +import { Body } from './Body' export type Props = { setIsAddEdgeNode: (b: boolean) => void @@ -17,11 +18,13 @@ export const AddEdgeNode = ({ setIsAddEdgeNode, edgeData, setGraphLoading }: Pro return ( - + + {edgeData?.refId ? 'Edit Edge' : 'Add Edge'} - + + ) @@ -31,4 +34,36 @@ const CloseButton = styled(Flex)` font-size: 32px; color: ${colors.white}; cursor: pointer; + + svg { + color: ${colors.GRAY6}; + } + + &:hover { + svg { + color: ${colors.white}; + } + } +` + +const HeaderFlex = styled(Flex)` + margin-bottom: 16px; +` + +const LineBar = styled.div` + border-bottom: 1px solid ${colors.black}; + width: calc(100% + 32px); + margin: 0 -16px 16px; + opacity: 0.3; +` + +const StyledText = styled(Text)` + font-family: Barlow; + font-size: 22px; + font-weight: 600; + line-height: 16px; + letter-spacing: 0.01em; + text-align: left; + margin-left: 2px; + color: ${colors.white}; ` diff --git a/src/components/common/AutoComplete/index.tsx b/src/components/common/AutoComplete/index.tsx index 22ff8c0f8..bfdf62c0f 100644 --- a/src/components/common/AutoComplete/index.tsx +++ b/src/components/common/AutoComplete/index.tsx @@ -25,6 +25,8 @@ type Props = { disabled?: boolean dataTestId?: string dataId?: string + placeholder?: string + className?: string } const defaultProps = { @@ -43,6 +45,8 @@ export const AutoComplete: FC = ({ disabled = false, dataTestId, dataId, + placeholder, + className, }) => { const inputRef = useRef(null) const [open, setOpen] = useState(false) @@ -65,6 +69,7 @@ export const AutoComplete: FC = ({ autoFocus autoHighlight blurOnSelect + className={className} data-testid={dataId} disableClearable disabled={disabled} @@ -108,6 +113,7 @@ export const AutoComplete: FC = ({ <>{isLoading ? : params.InputProps.endAdornment} ), }} + placeholder={placeholder} size="medium" variant="standard" />