diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.module.scss b/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.module.scss new file mode 100644 index 000000000000..d911c0f61b3f --- /dev/null +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.module.scss @@ -0,0 +1,37 @@ +@use "../../../../scss/colors"; + +.content { + display: flex; + justify-content: space-between; + align-items: center; + flex-direction: row; + margin-top: 16px; + gap: 18px; +} + +.controlButton { + margin-left: 10px; +} + +.message { + font-size: 14px; + line-height: 17px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + flex: 1; + + & .success { + color: colors.$green; + } + & .error { + color: colors.$red; + } +} + +.line { + min-width: 100%; + height: 1px; + background: colors.$grey; + margin: 16px -27px 0 -24px; +} diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.tsx b/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.tsx index edc1d81d95a9..528eedde42da 100644 --- a/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.tsx +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.tsx @@ -1,9 +1,11 @@ +import classnames from "classnames"; import React from "react"; import { FormattedMessage } from "react-intl"; -import styled from "styled-components"; import { Button, LoadingButton } from "components"; +import styles from "./EditControls.module.scss"; + interface EditControlProps { isSubmitting: boolean; dirty: boolean; @@ -15,40 +17,6 @@ interface EditControlProps { withLine?: boolean; } -const Content = styled.div` - display: flex; - justify-content: space-between; - align-items: center; - flex-direction: row; - margin-top: 16px; - gap: 18px; -`; - -const ControlButton = styled(LoadingButton)` - margin-left: 10px; -`; - -const Success = styled.span` - color: ${({ theme }) => theme.successColor}; - font-size: 14px; - line-height: 17px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - flex: 1; -`; - -const Error = styled(Success)` - color: ${({ theme }) => theme.dangerColor}; -`; - -const Line = styled.div` - min-width: 100%; - height: 1px; - background: ${({ theme }) => theme.greyColor20}; - margin: 16px -27px 0 -24px; -`; - const EditControls: React.FC = ({ isSubmitting, dirty, @@ -60,33 +28,43 @@ const EditControls: React.FC = ({ withLine, }) => { const showStatusMessage = () => { + const messageStyle = classnames(styles.message, { + [styles.success]: !!successMessage, + [styles.error]: !!errorMessage, + }); if (errorMessage) { - return {errorMessage}; + return
{errorMessage}
; } + if (successMessage && !dirty) { - return {successMessage}; + return ( +
+ {successMessage} +
+ ); } return null; }; return ( <> - {withLine && } - + {withLine &&
} +
{showStatusMessage()}
- - +
- +
); };