Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪟 🎨 Connector Field UX Improvements #16152

Merged
merged 78 commits into from
Sep 26, 2022

Conversation

lmossman
Copy link
Contributor

@lmossman lmossman commented Aug 30, 2022

What

Relates to #12204

This PR addresses the following parts of the above ticket:

  1. Moves field descriptions and examples into InfoTooltips (open to feedback on the tooltip/examples styling here!):
    Screen Shot 2022-09-01 at 6 49 01 PM
  2. Changes invalid input behavior so that instead of just highlighting the description, it adds the actual form error text below the input and uses the existing error prop logic on the inputs to make their border red:
    Screen Shot 2022-09-01 at 6 09 30 PM
  3. Removes the confusing * or lack-thereof after property labels which was meant to indicate optionality, and instead adds an Optional text to the right of the label for any optional fields.
    • Note 1: Some field names in the connector specs themselves contain * or (Optional) at the end - the connectors should be updated to remove these redundant suffixes now that we have logic in place to add the Optional text after the field. Should I programmatically try to filter these strings out of the field names in the meantime?
    • Note 2: I have explicitly set the optional flag on the PropertyLabel to false for the LabeledSwitch, ConditionSection, and ArraySection components, because it felt confusing as a user to have Optional on each of these when there is not really a way to not use them -- the switch is always on or off, condition always has some dropdown value selected, and even if the array is empty it is still submitted as a value. So to me, optional only really seemed to make sense on the basic text input components.
    Screen Shot 2022-09-01 at 6 11 14 PM
  4. Removes the logic to use the first field example as the placeholder text for its input, as suggested by Tim since he felt that it was confusing, making users think that they had to use the example value.

TODO: modify the styling on Condition and Array section components to more closely match the styling in the original design, with the label being fully left-justified. This will allow us to hide the bounding line when there are no children in the condition group, since that case currently looks a bit strange now that the description has been moved into the InfoTooltip, e.g.:
Currently just waiting on a final confirmation of the design from Nico before implementing this. This could also be done in a follow-up PR if the current state in this PR is acceptable.

The styling of grouped fields has been updated to match the design provided by Nico:
Screen Shot 2022-09-12 at 2 37 55 PM

NOTE: This PR also does not do any of the field grouping / optional fields hidden behind an expandable dropdown changes present in the design. Field grouping will require some more changes to connector specs, and hiding optional fields can be done in a follow-up PR.

How

There are several places that I have tried to refactor or simplify some components to reduce duplication and remove unneeded logic.

I also tried to make sure that the changes I've made here won't affect other views that are using the same components that I've touched, such as the connection Replication view. Though, the changes I've made here should hopefully make it easy to update those places to use the new styling as well (e.g. use the PropertyLabel class I have introduced to get the description-in-tooltip and Optional flag styling)

Recommended reading order

  1. PropertySection.tsx - changes to the base input properties
  2. PropertyLabel.tsx - replacement of the airbyte-webapp/src/views/Connector/ServiceForm/components/Property/Label.tsx component, since I was getting confused at the fact that it was named the same as the airbyte-webapp/src/components/Label/Label.tsx component which is also used further down the component tree.
  3. LabelInfo.tsx / LabelInfo.module.scss - replacement of the LabelMessage component, since this information is no longer being displayed in label "message" but instead in the InfoTooltip. Used by the PropertyLabel component to display an InfoTooltip with the field description and examples.
  4. ControlLabels.tsx - main change here is to add the InfoTooltip and the Optional pieces after the field label, which are both configured through new props so that this does not modify other views that use this component
  5. ConnectorNameControl.tsx - modified this to use the new PropertyLabel to get the same info tooltip styling as other inputs
  6. Control.tsx - just removed the example-placeholder logic, and added an error prop which is applied to the TextArea and Input subcomponents to utilize the existing logic they have to make input borders red when there is an input error
  7. The rest of the changed files are somewhat small and hopefully the diff is enough!

🚨 User Impact 🚨

Just visual changes to the connector page, but with all of the same functionality kept the same.

@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Aug 30, 2022
@lmossman lmossman marked this pull request as ready for review September 2, 2022 01:50
@lmossman lmossman requested a review from a team as a code owner September 2, 2022 01:50
@Upmitt
Copy link
Contributor

Upmitt commented Sep 2, 2022

@lmossman I updated Figma with a new component for the group of fields : https://www.figma.com/file/gMNRYVJav25pdsoxAyW7Qp/00_01_WEB-APP-LIBRARIES?node-id=1107%3A1880 - and here: https://www.figma.com/file/AxqFXuHo2BoTY0QY12hxm1/00_02_WEB-APP-COMPONENTS?node-id=446%3A8860 (you can change the width of this group of fields on Figma)

@edmundito
Copy link
Contributor

@lmossman would it be possible to add storybooks for the areas impacted?

@krishnaglick
Copy link
Contributor

Looks like there's a conflict!

)}
{props.optional && (
<Text size="sm" className={styles.optionalText}>
Optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put this into a translatable string?

@@ -1,7 +1,7 @@
import React from "react";
import sanitizeHtml from "sanitize-html";

interface IProps {
interface IProps extends React.InputHTMLAttributes<HTMLInputElement> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two nits:

  1. We should change this to just Props
  2. Could we get rid of the default export while you're in here?


import styles from "./LabelInfo.module.scss";

interface IProps {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
interface IProps {
interface Props {

description?: string;
}

const LabelInfo: React.FC<IProps> = ({ label, examples, description }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const LabelInfo: React.FC<IProps> = ({ label, examples, description }) => {
export const LabelInfo: React.FC<Props> = ({ label, examples, description }) => {

);
};

export { LabelInfo };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export { LabelInfo };

}

const LabelInfo: React.FC<IProps> = ({ label, examples, description }) => {
const constructExamples = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a component. I'd argue for moving it above this one, renaming to Examples perhaps, and passing it the props so the use should look like:
<Examples examples={examples} />

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that suggestion, thanks!

@@ -64,13 +65,12 @@ export const ArraySection: React.FC<ArraySectionProps> = ({ formField, path, dis
};
}, [items, formField.properties]);

const label = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'd either move this down into title={<Property... or call this groupTitle or something.

fullWidthTitle
title={
<div className={styles.sectionTitle}>
{label ? <GroupLabel>{label}:</GroupLabel> : null}
{label ? <GroupLabel>{label}</GroupLabel> : null}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could label ever be undefined now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem like it -- I've removed the conditional here

@@ -24,7 +25,7 @@ const GroupLabel = styled(Label)`
`;

const ConditionControls = styled.div`
padding-top: 25px;
padding-top: 20px;
`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have a styles folder, we should get rid of ConditionControls and just use a style.

Copy link
Contributor

@krishnaglick krishnaglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really great work here Lake!

className?: string;
}

const PropertyLabel: React.FC<React.PropsWithChildren<PropertyLabelProps>> = ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should export here, not below.

@lmossman lmossman temporarily deployed to more-secrets September 22, 2022 07:25 Inactive
@lmossman lmossman temporarily deployed to more-secrets September 22, 2022 14:31 Inactive
@lmossman lmossman temporarily deployed to more-secrets September 23, 2022 04:58 Inactive
@lmossman lmossman merged commit c4fb6b7 into master Sep 26, 2022
@lmossman lmossman deleted the lmossman/connector-field-improvements branch September 26, 2022 20:19
robbinhan pushed a commit to robbinhan/airbyte that referenced this pull request Sep 29, 2022
* use Source name and Destination name

* move label messages into info tooltips

* pass tooltip props through IntoTooltip and set placement

* add error message to ControlLabels

* refactor to reduce duplication and add optional indicator

* add label as header in info tooltip and fix tooltip word wrapping

* remove placeholders and style tooltip a bit better

* make example background darker

* remove unnecessary style

* put examples in flex box

* use property label in labeled switch

* use info tool tip for condition section

* remove unused class name

* remove colon

* add styling to lists inside of tooltip

* move errors below inputs and add error flag to control input

* remove label css

* use new property label for array section as well

* fix css

* make examples a bit more circular

* put optional text into translatable string

* fix TextWithHTML props and export

* simplify CSS selector

* rename IProps to Props

* fix export

* move examples into its own component

* remove unnecessary var

* conditionSection feedback

* update design of group sections

* fix empty group control styling

* add comment

* fix position and sizing of group control sections

* adjust margin

* add main changed components to storybook

* linting fixes

* fix group section styling and clean up storybook

* fix stylelint errors

* wrap storybook components in cards

* use card prop to fix build error

* fix info tooltip positioning and prevent wrapping on group label

* adjust infotooltip styling again

* fix info tooltip position on safari as well

* fix styling of condition section dropdown

* small spacing adjustment

* another small padding adjustment

* switch display to block

* simplify scss classes

* rename props class

* fix casing of scss variables

* use scss variables in some places

* move PropertyError to Property folder

* replace displayError with hasError

* rename infoMessage to infoTooltipContent

* move stories to other folders

* fix display and local var

* update snapshots

* properly set htmlFor on group control label and fix nest group control styling

* fix tooltip border radius

* fix group controls border radius

* fix spacing of field forms

* fix input border and background colors

* fix display types in property section

* update snapshot classes
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
* use Source name and Destination name

* move label messages into info tooltips

* pass tooltip props through IntoTooltip and set placement

* add error message to ControlLabels

* refactor to reduce duplication and add optional indicator

* add label as header in info tooltip and fix tooltip word wrapping

* remove placeholders and style tooltip a bit better

* make example background darker

* remove unnecessary style

* put examples in flex box

* use property label in labeled switch

* use info tool tip for condition section

* remove unused class name

* remove colon

* add styling to lists inside of tooltip

* move errors below inputs and add error flag to control input

* remove label css

* use new property label for array section as well

* fix css

* make examples a bit more circular

* put optional text into translatable string

* fix TextWithHTML props and export

* simplify CSS selector

* rename IProps to Props

* fix export

* move examples into its own component

* remove unnecessary var

* conditionSection feedback

* update design of group sections

* fix empty group control styling

* add comment

* fix position and sizing of group control sections

* adjust margin

* add main changed components to storybook

* linting fixes

* fix group section styling and clean up storybook

* fix stylelint errors

* wrap storybook components in cards

* use card prop to fix build error

* fix info tooltip positioning and prevent wrapping on group label

* adjust infotooltip styling again

* fix info tooltip position on safari as well

* fix styling of condition section dropdown

* small spacing adjustment

* another small padding adjustment

* switch display to block

* simplify scss classes

* rename props class

* fix casing of scss variables

* use scss variables in some places

* move PropertyError to Property folder

* replace displayError with hasError

* rename infoMessage to infoTooltipContent

* move stories to other folders

* fix display and local var

* update snapshots

* properly set htmlFor on group control label and fix nest group control styling

* fix tooltip border radius

* fix group controls border radius

* fix spacing of field forms

* fix input border and background colors

* fix display types in property section

* update snapshot classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants