Skip to content

Commit

Permalink
🪟 🎨 Increases GroupTitle followed divs width from 180px to 250px (#13956
Browse files Browse the repository at this point in the history
)

* Increases GroupControls followed divs width from 180px to 250px

* Increases min-width for GroupTitle

* Change layout to flexbox

Co-authored-by: Tim Roes <tim@airbyte.io>
  • Loading branch information
YatsukBogdan1 and timroes committed Aug 10, 2022
1 parent e28bc3a commit c782303
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
19 changes: 11 additions & 8 deletions airbyte-webapp/src/components/GroupControls/GroupControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ import styled from "styled-components";

import { Label, TextWithHTML } from "components";

const GroupTitle = styled.div`
const GroupTitle = styled.div<{ $fullWidthTitle: boolean }>`
margin-top: -23px;
background: ${({ theme }) => theme.whiteColor};
padding: 0 5px;
display: inline-block;
vertical-align: middle;
& > div {
min-width: 180px;
display: inline-block;
}
width: ${({ $fullWidthTitle }) => ($fullWidthTitle ? "100%" : "auto")};
`;

const FormGroup = styled.div`
Expand All @@ -28,12 +24,19 @@ interface GroupControlsProps {
title: React.ReactNode;
description?: string;
name?: string;
fullWidthTitle?: boolean;
}

const GroupControls: React.FC<GroupControlsProps> = ({ title, description, children, name }) => {
const GroupControls: React.FC<GroupControlsProps> = ({
title,
description,
children,
name,
fullWidthTitle = false,
}) => {
return (
<FormGroup data-testid={name}>
<GroupTitle>{title}</GroupTitle>
<GroupTitle $fullWidthTitle={fullWidthTitle}>{title}</GroupTitle>
{description && <Label message={<TextWithHTML text={description} />} />}
{children}
</FormGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.sectionTitle {
display: flex;
}

.sectionTitleDropdown {
flex: 1 1 auto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { isDefined } from "utils/common";

import { useServiceForm } from "../../serviceFormContext";
import { ServiceFormValues } from "../../types";
import styles from "./ConditionSection.module.scss";
import { FormSection } from "./FormSection";

const GroupLabel = styled(Label)`
Expand Down Expand Up @@ -78,17 +79,19 @@ export const ConditionSection: React.FC<ConditionSectionProps> = ({ formField, p
<GroupControls
key={`form-field-group-${formField.fieldKey}`}
description={formField.description}
fullWidthTitle
title={
<>
<div className={styles.sectionTitle}>
{label ? <GroupLabel>{label}:</GroupLabel> : null}
<DropDown
className={styles.sectionTitleDropdown}
options={options}
onChange={onOptionChange}
value={currentlySelectedCondition}
name={formField.path}
isDisabled={disabled}
/>
</>
</div>
}
>
<ConditionControls>
Expand Down

0 comments on commit c782303

Please sign in to comment.