Skip to content

Commit

Permalink
Add oneOf description and title (#2774)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamakase committed Apr 7, 2021
1 parent a7b9cd5 commit f5d084d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const ConditionSection: React.FC<{
return (
<GroupControls
key={`form-field-group-${formField.fieldKey}`}
description={formField.description}
title={
<>
{label ? <GroupLabel>{label}:</GroupLabel> : null}
Expand Down Expand Up @@ -86,6 +87,7 @@ const ArraySection: React.FC<{
<GroupControls
key={`form-variable-fields-${formField?.fieldKey}`}
title={formField.title || formField.fieldKey}
description={formField.description}
>
<SectionContainer>
<FieldArray
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import styled from "styled-components";
import { Label, TextWithHTML } from "components";

const GroupTitle = styled.div`
margin-top: -23px;
Expand All @@ -24,12 +25,18 @@ const FormGroup = styled.div`

type GroupControlsProps = {
title: React.ReactNode;
description?: string;
};

const GroupControls: React.FC<GroupControlsProps> = ({ title, children }) => {
const GroupControls: React.FC<GroupControlsProps> = ({
title,
description,
children,
}) => {
return (
<FormGroup>
<GroupTitle>{title}</GroupTitle>
{description && <Label message={<TextWithHTML text={description} />} />}
{children}
</FormGroup>
);
Expand Down
2 changes: 2 additions & 0 deletions airbyte-webapp/src/core/form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type FormConditionItem = {
fieldKey: string;
isRequired: boolean;
title?: string;
description?: string;
conditions: { [key: string]: FormGroupItem | FormBaseItem };
};

Expand All @@ -40,6 +41,7 @@ type FormObjectArrayItem = {
fieldKey: string;
isRequired: boolean;
title?: string;
description?: string;
properties: FormBlock;
};

Expand Down
2 changes: 2 additions & 0 deletions airbyte-webapp/src/core/jsonSchema/schemaToUiWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export const jsonSchemaToUiWidget = (

return {
_type: "formCondition",
title: jsonSchema.title,
description: jsonSchema.description,
path: path || key,
fieldKey: key,
conditions,
Expand Down

0 comments on commit f5d084d

Please sign in to comment.