diff --git a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionName.module.scss b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionName.module.scss index 05ba9b001d70..689a99b2c03a 100644 --- a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionName.module.scss +++ b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionName.module.scss @@ -20,6 +20,8 @@ display: none; position: absolute; right: variables.$spacing-xl; + + // used to control svg size, not text size font-size: 18px; color: colors.$blue; } @@ -35,11 +37,7 @@ width: 100%; h2 { - font-weight: 700; - font-size: 24px; - line-height: 29px; text-align: center; - color: colors.$dark-blue-900; margin: variables.$spacing-md; word-wrap: break-word; } diff --git a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionName.tsx b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionName.tsx index 303699871935..8bb38d8df64f 100644 --- a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionName.tsx +++ b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionName.tsx @@ -3,6 +3,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import React, { ChangeEvent, useState } from "react"; import { Input } from "components"; +import { Text } from "components/ui/Text"; import { buildConnectionUpdate } from "core/domain/connection"; import { WebBackendConnectionRead } from "core/request/AirbyteClient"; @@ -85,7 +86,9 @@ export const ConnectionName: React.FC = ({ connection }) => ) : ( diff --git a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.module.scss b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.module.scss new file mode 100644 index 000000000000..10360aaf922e --- /dev/null +++ b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.module.scss @@ -0,0 +1,14 @@ +@use "../../../../scss/variables"; + +.tryArrow { + margin: 0 variables.$spacing-md -1px 0; + + // used to control svg size + font-size: 14px; +} + +.content { + max-width: 1279px; + margin: 0 auto; + padding-bottom: variables.$spacing-md; +} diff --git a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.tsx b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.tsx index 97bc17dac7ca..97cb8b508f6c 100644 --- a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.tsx +++ b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.tsx @@ -3,7 +3,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import React, { useMemo, useState } from "react"; import { FormattedMessage, useIntl } from "react-intl"; import { useAsyncFn, useUnmount } from "react-use"; -import styled from "styled-components"; import { LabeledSwitch } from "components/LabeledSwitch"; import LoadingSchema from "components/LoadingSchema"; @@ -27,6 +26,8 @@ import { equal, naturalComparatorBy } from "utils/objects"; import { CatalogDiffModal } from "views/Connection/CatalogDiffModal/CatalogDiffModal"; import { ConnectionForm } from "views/Connection/ConnectionForm"; +import styles from "./ConnectionReplicationTab.module.scss"; + interface ConnectionReplicationTabProps { onAfterSaveSchema: () => void; connectionId: string; @@ -74,17 +75,6 @@ const ResetWarningModal: React.FC = ({ onCancel, onClose ); }; -const Content = styled.div` - max-width: 1279px; - margin: 0 auto; - padding-bottom: 10px; -`; - -const TryArrow = styled(FontAwesomeIcon)` - margin: 0 10px -1px 0; - font-size: 14px; -`; - export const ConnectionReplicationTab: React.FC = ({ onAfterSaveSchema, connectionId, @@ -221,7 +211,7 @@ export const ConnectionReplicationTab: React.FC = }; return ( - +
{!isRefreshingCatalog && connection ? ( = onClick={onRefreshSourceSchema} type="button" variant="secondary" - icon={} + icon={} > @@ -249,6 +239,6 @@ export const ConnectionReplicationTab: React.FC = ) : ( )} - +
); }; diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.module.scss b/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.module.scss new file mode 100644 index 000000000000..ef0b0aa1659e --- /dev/null +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.module.scss @@ -0,0 +1,30 @@ +@use "../../../scss/variables"; + +.formContainer { + display: flex; + flex-direction: column; + gap: variables.$spacing-md; +} + +.readonly { + pointer-events: none; +} + +.flexRow { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: flex-start; + gap: variables.$spacing-md; +} + +.leftFieldCol { + flex: 1; + max-width: 640px; + padding-right: variables.$spacing-xl; +} + +.rightFieldCol { + flex: 1; + max-width: 300px; +} diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.tsx b/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.tsx index 10a2da74154c..d574fc05ee36 100644 --- a/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.tsx +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/ConnectionForm.tsx @@ -1,14 +1,14 @@ +import classNames from "classnames"; import { Field, FieldProps, Form, Formik } from "formik"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; import { useToggle } from "react-use"; import styled from "styled-components"; -import { H5 } from "components/base/Titles"; import { FormChangeTracker } from "components/FormChangeTracker"; import { ControlLabels } from "components/LabeledControl"; -import { Card } from "components/ui/Card"; import { Input } from "components/ui/Input"; +import { Text } from "components/ui/Text"; import { NamespaceDefinitionType } from "core/request/AirbyteClient"; import { useConnectionFormService } from "hooks/services/ConnectionForm/ConnectionFormService"; @@ -18,80 +18,21 @@ import EditControls from "./components/EditControls"; import { NamespaceDefinitionField } from "./components/NamespaceDefinitionField"; import { OperationsSection } from "./components/OperationsSection"; import ScheduleField from "./components/ScheduleField"; +import { Section } from "./components/Section"; import SchemaField from "./components/SyncCatalogField"; +import styles from "./ConnectionForm.module.scss"; import { connectionValidationSchema } from "./formConfig"; +// This is removed in KC's main refactor PR. Removing it would require major scope creep for this PR. const ConnectorLabel = styled(ControlLabels)` max-width: 328px; margin-right: 20px; vertical-align: top; `; -const NamespaceFormatLabel = styled(ControlLabels)` - flex: 5 0 0; - display: flex; - flex-direction: column; - justify-content: space-between; -`; - -export const FlexRow = styled.div` - display: flex; - flex-direction: row; - justify-content: flex-start; - align-items: flex-start; - gap: 10px; -`; - -export const LeftFieldCol = styled.div` - flex: 1; - max-width: 640px; - padding-right: 30px; -`; - -export const RightFieldCol = styled.div` - flex: 1; - max-width: 300px; -`; - -export const StyledSection = styled.div` - padding: 20px 20px; - display: flex; - flex-direction: column; - gap: 15px; - - &:not(:last-child) { - box-shadow: 0 1px 0 rgba(139, 139, 160, 0.25); - } -`; - -interface SectionProps { - title?: React.ReactNode; -} - -const LabelHeading = styled(H5)` - line-height: 16px; - display: inline; -`; - -const Section: React.FC> = ({ title, children }) => ( - - - {title &&
{title}
} - {children} -
-
-); - -const FormContainer = styled(Form)` - display: flex; - flex-direction: column; - gap: 10px; -`; - export type ConnectionFormMode = "create" | "edit" | "readonly"; export interface ConnectionFormProps { - className?: string; successMessage?: React.ReactNode; /** Should be passed when connection is updated with withRefreshCatalog flag */ @@ -100,7 +41,6 @@ export interface ConnectionFormProps { } export const ConnectionForm: React.FC = ({ - className, successMessage, canSubmitUntouchedForm, additionalSchemaControl, @@ -110,6 +50,10 @@ export const ConnectionForm: React.FC = ({ const [editingTransformation, toggleEditingTransformation] = useToggle(false); const { formatMessage } = useIntl(); + const readonlyClass = classNames({ + [styles.readonly]: mode === "readonly", + }); + return ( = ({ onSubmit={onFormSubmit} > {({ isSubmitting, isValid, dirty, resetForm, values }) => ( - +
{mode === "create" && (
{({ field, meta }: FieldProps) => ( - - +
+
+ - + } message={formatMessage({ id: "form.connectionName.message", })} /> - - +
+
= ({ id: "form.connectionName.placeholder", })} /> - - +
+
)}
@@ -157,77 +101,76 @@ export const ConnectionForm: React.FC = ({
}>
- - -
- -
- - - - {values.namespaceDefinition === NamespaceDefinitionType.customformat && ( - - {({ field, meta }: FieldProps) => ( - - - } - message={} - /> - - - - - - )} - - )} - - {({ field }: FieldProps) => ( - - +
+ + + + + + + {values.namespaceDefinition === NamespaceDefinitionType.customformat && ( + + {({ field, meta }: FieldProps) => ( +
+
} + message={} /> - - +
+
- - +
+
)}
- - - - - + )} + + {({ field }: FieldProps) => ( +
+
+ +
+
+ +
+
+ )} +
+
+
+ +
{mode === "edit" && ( = ({ /> )} - + )}
); diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/components/NamespaceDefinitionField.module.scss b/airbyte-webapp/src/views/Connection/ConnectionForm/components/NamespaceDefinitionField.module.scss new file mode 100644 index 000000000000..0a3d7654d1e2 --- /dev/null +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/components/NamespaceDefinitionField.module.scss @@ -0,0 +1 @@ +@forward "../ConnectionForm.module.scss"; diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/components/NamespaceDefinitionField.tsx b/airbyte-webapp/src/views/Connection/ConnectionForm/components/NamespaceDefinitionField.tsx index efc7888ad940..b1ff8ab1c5bb 100644 --- a/airbyte-webapp/src/views/Connection/ConnectionForm/components/NamespaceDefinitionField.tsx +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/components/NamespaceDefinitionField.tsx @@ -5,8 +5,7 @@ import { FormattedMessage } from "react-intl"; import { ControlLabels, DropDown } from "components"; import { NamespaceDefinitionType } from "../../../../core/request/AirbyteClient"; -import { FlexRow, LeftFieldCol, RightFieldCol } from "../ConnectionForm"; - +import styles from "./NamespaceDefinitionField.module.scss"; export const StreamOptions = [ { value: NamespaceDefinitionType.source, @@ -29,8 +28,8 @@ export const NamespaceDefinitionField: React.FC> = ({ field, const [, meta] = useField(field.name); return ( - - +
+
> = ({ field, label={} message={} /> - - +
+
> = ({ field, value={field.value} onChange={({ value }) => form.setFieldValue(field.name, value)} /> - - +
+
); }; diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/components/OperationsSection.tsx b/airbyte-webapp/src/views/Connection/ConnectionForm/components/OperationsSection.tsx index 6dfa6f10cfb0..1e5a77f78819 100644 --- a/airbyte-webapp/src/views/Connection/ConnectionForm/components/OperationsSection.tsx +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/components/OperationsSection.tsx @@ -2,14 +2,14 @@ import { Field, FieldArray } from "formik"; import React from "react"; import { useIntl } from "react-intl"; -import { H5 } from "components/base/Titles"; import { Card } from "components/ui/Card"; +import { Text } from "components/ui/Text"; import { useConnectionFormService } from "hooks/services/ConnectionForm/ConnectionFormService"; import { FeatureItem, useFeature } from "hooks/services/Feature"; -import { StyledSection } from "../ConnectionForm"; import { NormalizationField } from "./NormalizationField"; +import { Section } from "./Section"; import { TransformationField } from "./TransformationField"; interface OperationsSectionProps { @@ -35,16 +35,16 @@ export const OperationsSection: React.FC = ({ return ( - +
{supportsNormalization || supportsTransformations ? ( -
+ {[ supportsNormalization && formatMessage({ id: "connectionForm.normalization.title" }), supportsTransformations && formatMessage({ id: "connectionForm.transformation.title" }), ] .filter(Boolean) .join(" & ")} -
+ ) : null} {supportsNormalization && } {supportsTransformations && ( @@ -58,7 +58,7 @@ export const OperationsSection: React.FC = ({ )} )} - +
); }; diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/components/Section.module.scss b/airbyte-webapp/src/views/Connection/ConnectionForm/components/Section.module.scss new file mode 100644 index 000000000000..54c545da209f --- /dev/null +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/components/Section.module.scss @@ -0,0 +1,13 @@ +@use "../../../../scss/variables"; + +.section { + padding: variables.$spacing-xl; + display: flex; + flex-direction: column; + gap: variables.$spacing-lg; + + // TODO: We may be able to get rid of this. + &:not(:last-child) { + box-shadow: 0 1px 0 rgba(139, 139, 160, 25%); + } +} diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/components/Section.tsx b/airbyte-webapp/src/views/Connection/ConnectionForm/components/Section.tsx new file mode 100644 index 000000000000..57d28f56ed95 --- /dev/null +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/components/Section.tsx @@ -0,0 +1,21 @@ +import { Card } from "components/ui"; +import { Text } from "components/ui/Text"; + +import styles from "./Section.module.scss"; + +interface SectionProps { + title?: React.ReactNode; +} + +export const Section: React.FC> = ({ title, children }) => ( + +
+ {title && ( + + {title} + + )} + {children} +
+
+);