-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🎨 Connector Field UX Improvements (#16152)
* 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
- Loading branch information
Showing
42 changed files
with
556 additions
and
329 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
airbyte-webapp/src/components/GroupControls/GroupControls.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@use "../../scss/colors"; | ||
@use "../../scss/variables"; | ||
|
||
$title-height: 34px; | ||
$group-spacing: variables.$spacing-xl; | ||
$border-width: variables.$border-thick; | ||
|
||
.container { | ||
margin-bottom: 27px; | ||
min-height: $title-height; | ||
position: relative; | ||
padding-top: calc($title-height / 2); | ||
} | ||
|
||
.title { | ||
padding-right: $group-spacing; | ||
display: flex; | ||
align-items: center; | ||
height: $title-height; | ||
position: absolute; | ||
left: 0; | ||
right: 0; | ||
top: 0; | ||
|
||
label { | ||
padding-bottom: 0; | ||
} | ||
} | ||
|
||
.content { | ||
border-color: colors.$grey-100; | ||
border-style: solid; | ||
border-width: 0 $border-width $border-width; | ||
border-radius: variables.$border-radius-md; | ||
|
||
// box-shadow is used for the top border, so that it overlaps with bottom border when height is 0 | ||
box-shadow: 0 $border-width colors.$grey-100 inset; | ||
padding: 0 $group-spacing; | ||
|
||
// only apply padding when there are children, so that empty group sections border is just a single line | ||
> :first-child { | ||
padding-top: calc($group-spacing + $title-height/2); | ||
} | ||
|
||
> div { | ||
margin-bottom: $group-spacing; | ||
} | ||
} |
45 changes: 11 additions & 34 deletions
45
airbyte-webapp/src/components/GroupControls/GroupControls.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
airbyte-webapp/src/components/GroupControls/index.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
|
||
import { Card } from "components/base"; | ||
|
||
import { FormBlock, FormConditionItem } from "core/form/types"; | ||
import { GroupLabel } from "views/Connector/ServiceForm/components/Sections/GroupLabel"; | ||
import { SectionContainer } from "views/Connector/ServiceForm/components/Sections/SectionContainer"; | ||
|
||
import GroupControls from "./GroupControls"; | ||
|
||
export default { | ||
title: "UI/GroupControls", | ||
component: GroupControls, | ||
} as ComponentMeta<typeof GroupControls>; | ||
|
||
const Template: ComponentStory<typeof GroupControls> = (args) => ( | ||
<Card withPadding> | ||
<GroupControls {...args} /> | ||
</Card> | ||
); | ||
|
||
const propOneFormBlock: FormBlock = { | ||
title: "propOne", | ||
type: "string", | ||
isRequired: true, | ||
_type: "formItem", | ||
fieldKey: "propOneKey", | ||
path: "section.conditional.choice_one.prop_one", | ||
}; | ||
|
||
const propTwoFormBlock: FormBlock = { | ||
title: "propTwo", | ||
type: "string", | ||
isRequired: false, | ||
_type: "formItem", | ||
fieldKey: "propTwoKey", | ||
path: "section.conditional.choice_one.prop_two", | ||
}; | ||
|
||
const conditionFormField: FormConditionItem = { | ||
conditions: { | ||
ChoiceOne: { | ||
isRequired: true, | ||
_type: "formGroup", | ||
fieldKey: "choice_one_key", | ||
path: "section.conditional.choice_one", | ||
jsonSchema: {}, | ||
properties: [propOneFormBlock, propTwoFormBlock], | ||
}, | ||
}, | ||
isRequired: true, | ||
_type: "formCondition", | ||
fieldKey: "field_key", | ||
path: "section.conditional", | ||
}; | ||
|
||
const title = <GroupLabel formField={conditionFormField} />; | ||
|
||
export const Empty = Template.bind({}); | ||
Empty.args = { | ||
title, | ||
}; | ||
|
||
export const WithContent = Template.bind({}); | ||
WithContent.args = { | ||
title, | ||
children: ( | ||
<> | ||
<SectionContainer>Content part 1</SectionContainer> | ||
<SectionContainer>Content part 2</SectionContainer> | ||
</> | ||
), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
airbyte-webapp/src/components/LabeledControl/ControlLabels.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@use "../../scss/colors"; | ||
@use "../../scss/variables"; | ||
|
||
.controlContainer { | ||
width: 100%; | ||
} | ||
|
||
.optionalText { | ||
display: inline; | ||
color: colors.$grey-300; | ||
font-style: oblique; | ||
padding-left: variables.$spacing-sm; | ||
} | ||
|
||
.tooltip { | ||
word-wrap: break-word; | ||
} |
31 changes: 22 additions & 9 deletions
31
airbyte-webapp/src/components/LabeledControl/ControlLabels.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,50 @@ | ||
import className from "classnames"; | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import { FormattedMessage } from "react-intl"; | ||
|
||
import { Text } from "components/base/Text"; | ||
import { InfoTooltip } from "components/base/Tooltip"; | ||
import Label from "components/Label"; | ||
|
||
import styles from "./ControlLabels.module.scss"; | ||
|
||
export interface ControlLabelsProps { | ||
className?: string; | ||
error?: boolean; | ||
success?: boolean; | ||
nextLine?: boolean; | ||
message?: React.ReactNode; | ||
errorMessage?: React.ReactNode; | ||
labelAdditionLength?: number; | ||
label?: React.ReactNode; | ||
infoTooltipContent?: React.ReactNode; | ||
optional?: boolean; | ||
htmlFor?: string; | ||
} | ||
|
||
const ControlContainer = styled.div` | ||
width: 100%; | ||
display: inline-block; | ||
`; | ||
|
||
const ControlLabels: React.FC<React.PropsWithChildren<ControlLabelsProps>> = (props) => ( | ||
<ControlContainer className={props.className}> | ||
<div className={className(styles.controlContainer, props.className)}> | ||
<Label | ||
error={props.error} | ||
success={props.success} | ||
message={props.message} | ||
additionLength={props.labelAdditionLength} | ||
nextLine={props.nextLine} | ||
htmlFor={props.htmlFor} | ||
> | ||
{props.label} | ||
{props.infoTooltipContent && ( | ||
<InfoTooltip className={styles.tooltip} placement="top-start"> | ||
{props.infoTooltipContent} | ||
</InfoTooltip> | ||
)} | ||
{props.optional && ( | ||
<Text size="sm" className={styles.optionalText}> | ||
<FormattedMessage id="form.optional" /> | ||
</Text> | ||
)} | ||
</Label> | ||
{props.children} | ||
</ControlContainer> | ||
</div> | ||
); | ||
|
||
export { ControlLabels }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.