diff --git a/app/client/src/components/ads/formFields/CopyUrlForm.tsx b/app/client/src/components/ads/formFields/CopyUrlForm.tsx index bc8b38b687..fe771af50d 100644 --- a/app/client/src/components/ads/formFields/CopyUrlForm.tsx +++ b/app/client/src/components/ads/formFields/CopyUrlForm.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from "react"; -import { InjectedFormProps, reduxForm } from "redux-form"; +import { Field, InjectedFormProps, reduxForm } from "redux-form"; import { HelpIcons } from "icons/HelpIcons"; -import UneditableField from "components/ads/formFields/UneditableField"; +import { UneditableField } from "design-system"; import styled from "styled-components"; import copy from "copy-to-clipboard"; import { Toaster } from "components/ads/Toast"; @@ -93,12 +93,15 @@ function CopyUrlForm( )} - diff --git a/app/client/src/components/ads/formFields/UneditableField.test.tsx b/app/client/src/components/ads/formFields/UneditableField.test.tsx deleted file mode 100644 index 5eca22df2b..0000000000 --- a/app/client/src/components/ads/formFields/UneditableField.test.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { render } from "test/testUtils"; -import React from "react"; -import UneditableField from "./UneditableField"; -import { REDIRECT_URL_FORM } from "@appsmith/constants/forms"; -import { reduxForm } from "redux-form"; - -let container: any = null; -const setting = { - id: "SETTING_UNEDITABLE_FIELD_ID", - name: "SETTING_UNEDITABLE_FIELD_ID", - category: "test category", - helpText: "some helper text", - label: "test label", -}; - -const clickHandler = jest.fn(); - -function renderComponent() { - function UneditableFieldComponent() { - return ( - - ); - } - const Parent = reduxForm({ - validate: () => { - return {}; - }, - form: REDIRECT_URL_FORM, - touchOnBlur: true, - })(UneditableFieldComponent); - - render(, { - initialState: { - form: { - [REDIRECT_URL_FORM]: { - values: { - "uneditable-field": "value to be copied", - }, - }, - }, - }, - }); -} - -describe("Uneditabled Field", () => { - beforeEach(() => { - container = document.createElement("div"); - document.body.appendChild(container); - }); - - it("is rendered", () => { - renderComponent(); - window.prompt = jest.fn(); - const inputEl = document.querySelector("input"); - const value = `value to be copied`; - expect(inputEl?.value).toBeDefined(); - expect(inputEl?.value).toEqual(value); - expect(inputEl?.hasAttribute("disabled")); - expect(inputEl?.hasAttribute("iscopy")).toEqual(true); - const copyIcon = document.querySelector(".copy-icon") as HTMLElement; - expect(copyIcon).toBeDefined(); - copyIcon?.click(); - }); -}); diff --git a/app/client/src/components/ads/formFields/UneditableField.tsx b/app/client/src/components/ads/formFields/UneditableField.tsx deleted file mode 100644 index a59e8f2344..0000000000 --- a/app/client/src/components/ads/formFields/UneditableField.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import React from "react"; -import { - Field, - WrappedFieldMetaProps, - WrappedFieldInputProps, -} from "redux-form"; -import { TextInput, InputType } from "design-system"; -import { Intent } from "constants/DefaultTheme"; -import { Colors } from "constants/Colors"; -import styled from "styled-components"; -import { HelpIcons } from "icons/HelpIcons"; - -const CopyIcon = HelpIcons.COPY_ICON; - -const Label = styled.div` - font-size: 14px; - margin: 8px 0; - color: ${Colors.CHARCOAL}; -`; - -const InputCopyWrapper = styled.div` - display: flex; - align-items: center; - - input { - width: 40rem; - } - - .copy-icon { - margin-left: 12px; - } -`; - -const renderComponent = ( - componentProps: FormTextFieldProps & { - meta: Partial; - input: Partial; - }, -) => { - return ( - <> - {componentProps.label && } - - - {componentProps.iscopy === "true" && ( - - componentProps.handleCopy(componentProps.input.value) - } - width={16} - /> - )} - - - ); -}; - -export type FormTextFieldProps = { - name: string; - type?: InputType; - label?: string; - intent?: Intent; - disabled?: boolean; - autoFocus?: boolean; - value?: string; - helperText?: string; - iscopy?: string; - handleCopy: (value: string) => void; -}; - -function UneditableField(props: FormTextFieldProps) { - return ; -} - -export default UneditableField; diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index fb57ccd13a..0000000000 --- a/yarn.lock +++ /dev/null @@ -1,4 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - -