Skip to content

Commit 7e709b5

Browse files
authored
🪟 🐛 🎨 Fix design issues with CatalogDiff modal (#18870)
* Increase size of CatalogDiff modal Add ModalService to CatalogDiff to fix story * Fix issues with catalog diff field section styles * Update how icons work * Rearrange table headings and cells to align correctly * Add more spacing to the Diff Icon badges * Remove div from DiffHeader and simplify rendering * Remove border-spacing from tables * Move table margins to be set by padding on the panel itself * Update spacing on field section to align more closely with design * Update text color in NumberBadge to be consistent. * Update spacing and alignment in stream row to match design * Restore text color in NumberBadge * Cleanup onClose fn in CatalogDiff story * Add padding bottoom to DiffAccordion Update CatalogDiff stories to include different use cases
1 parent 217a651 commit 7e709b5

20 files changed

+237
-152
lines changed

airbyte-webapp/src/components/ui/NumberBadge/NumberBadge.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@use "../../../scss/colors";
2-
@use "../../../scss/fonts";
1+
@use "scss/colors";
2+
@use "scss/fonts";
33

44
.circle {
55
height: 20px;

airbyte-webapp/src/components/ui/NumberBadge/NumberBadge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const NumberBadge: React.FC<NumberBadgeProps> = ({ value, color, classNam
2020

2121
return (
2222
<div className={numberBadgeClassnames} aria-label={ariaLabel}>
23-
<div>{value}</div>
23+
{value}
2424
</div>
2525
);
2626
};

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/DiffAccordion.module.scss

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@use "../../../../scss/variables";
2-
@forward "../components/StreamRow.module.scss";
3-
@forward "../components/DiffSection.module.scss";
1+
@use "scss/variables";
2+
@forward "./StreamRow.module.scss";
3+
@forward "./DiffSection.module.scss";
44

55
.accordionContainer {
66
width: 100%;
@@ -15,6 +15,13 @@
1515
flex-direction: row;
1616
align-items: center;
1717
justify-content: flex-start;
18-
padding: variables.$spacing-sm;
18+
padding: 0 15px 0 0;
1919
font-weight: 400;
2020
}
21+
22+
.accordionPanel {
23+
display: flex;
24+
flex-direction: column;
25+
gap: variables.$spacing-sm;
26+
padding: 0 15px variables.$spacing-md 40px;
27+
}

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/DiffAccordion.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const DiffAccordion: React.FC<DiffAccordionProps> = ({ streamTransform })
3232
open={open}
3333
/>
3434
</Disclosure.Button>
35-
<Disclosure.Panel>
35+
<Disclosure.Panel className={styles.accordionPanel}>
3636
{removedItems.length > 0 && <DiffFieldTable fieldTransforms={removedItems} diffVerb="removed" />}
3737
{newItems.length > 0 && <DiffFieldTable fieldTransforms={newItems} diffVerb="new" />}
3838
{changedItems.length > 0 && <DiffFieldTable fieldTransforms={changedItems} diffVerb="changed" />}
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
@forward "../components/StreamRow.module.scss";
22
@forward "../components/DiffSection.module.scss";
3-
@use "../../../../scss/variables";
3+
@use "scss/variables";
44

5-
.namespace {
6-
padding-left: variables.$spacing-sm;
5+
.row {
6+
padding: 0 0 0 variables.$spacing-sm;
77
}
88

9-
.headerAdjust {
10-
padding-left: -10px;
11-
margin-left: -5px;
9+
.namespace {
10+
padding-left: variables.$spacing-sm;
1211
}

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/DiffAccordionHeader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ export const DiffAccordionHeader: React.FC<DiffAccordionHeaderProps> = ({
3636
<ModificationIcon />
3737
<div className={namespaceCellStyles} aria-labelledby={formatMessage({ id: "connection.updateSchema.namespace" })}>
3838
{open ? <FontAwesomeIcon icon={faAngleDown} /> : <FontAwesomeIcon icon={faAngleRight} />}
39-
<div className={styles.headerAdjust}>{streamDescriptor.namespace}</div>
39+
<div>{streamDescriptor.namespace}</div>
4040
</div>
4141
<div className={nameCellStyle} aria-labelledby={formatMessage({ id: "connection.updateSchema.streamName" })}>
42-
<div className={styles.headerAdjust}>{streamDescriptor.name}</div>
42+
<div>{streamDescriptor.name}</div>
4343
</div>
4444
<DiffIconBlock removedCount={removedCount} newCount={newCount} changedCount={changedCount} />
4545
</>

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/DiffFieldTable.module.scss

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
@use "../../../../scss/variables";
1+
@use "scss/variables";
22
@use "./DiffSection.module.scss";
33

4-
.accordionSubHeader {
4+
.header {
55
@extend %sectionSubHeader;
66

7-
& .padLeft {
8-
padding-left: variables.$spacing-lg;
9-
}
7+
padding: 0 0 0 30px;
108

119
& th {
1210
font-size: 10px;
1311
width: 228px;
14-
padding-left: variables.$spacing-md;
1512
}
1613
}
1714

1815
.table {
1916
width: 100%;
20-
padding-left: variables.$spacing-xl;
17+
border-spacing: 0;
2118

2219
& tbody > tr:first-of-type > td:nth-of-type(2) {
2320
border-radius: variables.$border-radius-sm variables.$border-radius-sm 0 0;

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/DiffFieldTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export const DiffFieldTable: React.FC<DiffFieldTableProps> = ({ fieldTransforms,
1616
return (
1717
<table className={styles.table} aria-label={`${diffVerb} fields`}>
1818
<thead>
19-
<tr className={styles.accordionSubHeader}>
19+
<tr className={styles.header}>
2020
<th>
2121
<DiffHeader diffCount={fieldTransforms.length} diffVerb={diffVerb} diffType="field" />
2222
</th>
2323
{diffVerb === "changed" && (
24-
<th className={styles.padLeft}>
24+
<th>
2525
<FormattedMessage id="connection.updateSchema.dataType" />
2626
</th>
2727
)}
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FormattedMessage } from "react-intl";
1+
import { useIntl } from "react-intl";
22

33
import { DiffVerb } from "../types";
44

@@ -11,15 +11,17 @@ interface DiffHeaderProps {
1111
}
1212

1313
export const DiffHeader: React.FC<DiffHeaderProps> = ({ diffCount, diffVerb, diffType }) => {
14-
return (
15-
<div>
16-
<FormattedMessage
17-
id={`connection.updateSchema.${diffVerb}`}
18-
values={{
19-
value: diffCount,
20-
item: <FormattedMessage id={`connection.updateSchema.${diffType}`} values={{ count: diffCount }} />,
21-
}}
22-
/>
23-
</div>
14+
const { formatMessage } = useIntl();
15+
16+
const text = formatMessage(
17+
{
18+
id: `connection.updateSchema.${diffVerb}`,
19+
},
20+
{
21+
value: diffCount,
22+
item: formatMessage({ id: `connection.updateSchema.${diffType}` }, { count: diffCount }),
23+
}
2424
);
25+
26+
return <>{text}</>;
2527
};
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
@use "scss/variables";
2+
13
.iconBlock {
24
display: flex;
35
flex-direction: row;
4-
gap: 1px;
6+
gap: variables.$spacing-sm;
57
margin-left: auto;
68
}

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/DiffSection.module.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
@use "../../../../scss/colors";
2-
@use "../../../../scss/variables";
3-
@use "../components/StreamRow.module.scss";
1+
@use "scss/colors";
2+
@use "scss/variables";
3+
@use "./StreamRow.module.scss";
44

55
.sectionContainer {
66
display: flex;
77
flex-direction: column;
88
}
99

10+
.table {
11+
border-spacing: 0;
12+
}
13+
1014
.sectionSubHeader,
1115
%sectionSubHeader {
1216
display: flex;
@@ -25,10 +29,6 @@
2529
color: colors.$grey;
2630
line-height: 12px;
2731
}
28-
29-
.padLeft {
30-
padding-left: variables.$spacing-md;
31-
}
3232
}
3333

3434
.sectionHeader,

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/DiffSection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ export const DiffSection: React.FC<DiffSectionProps> = ({ streams, catalog, diff
3131
<div className={styles.sectionHeader}>
3232
<DiffHeader diffCount={streams.length} diffVerb={diffVerb} diffType="stream" />
3333
</div>
34-
<table aria-label={`${diffVerb} streams table`}>
34+
<table aria-label={`${diffVerb} streams table`} className={styles.table}>
3535
<thead className={styles.sectionSubHeader}>
3636
<tr>
3737
<th>
3838
<FormattedMessage id="connection.updateSchema.namespace" />
3939
</th>
40-
<th className={styles.padLeft}>
40+
<th>
4141
<FormattedMessage id="connection.updateSchema.streamName" />
4242
</th>
4343
<th />

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/FieldRow.module.scss

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
@use "../../../../scss/variables";
2-
@use "../../../../scss/colors";
1+
@use "scss/variables";
2+
@use "scss/colors";
33

44
.row {
55
display: flex;
66
flex-direction: row;
77
align-items: center;
8-
padding: variables.$spacing-sm variables.$spacing-xl;
98
gap: variables.$spacing-md;
109
height: 35px;
1110
font-size: 12px;
1211
}
1312

1413
.content {
15-
padding-left: 10px;
1614
display: flex;
1715
width: 100%;
1816
height: 35px;
@@ -28,6 +26,16 @@
2826
}
2927
}
3028

29+
tr:first-child .content {
30+
border-top-left-radius: 6px;
31+
border-top-right-radius: 6px;
32+
}
33+
34+
tr:last-child .content {
35+
border-bottom-left-radius: 6px;
36+
border-bottom-right-radius: 6px;
37+
}
38+
3139
.icon {
3240
&.plus {
3341
color: colors.$green;
@@ -39,24 +47,21 @@
3947

4048
&.mod {
4149
color: colors.$blue-100;
50+
margin-left: -5px;
4251
}
4352
}
4453

45-
.iconCell {
46-
background: white;
54+
.iconContainer {
4755
width: 10px;
4856
height: 100%;
4957
display: flex;
5058
align-items: center;
59+
margin: 0 variables.$spacing-md;
5160
}
5261

5362
.cell {
54-
width: 228px;
55-
5663
&.update {
57-
border-radius: variables.$border-radius-sm;
58-
59-
& span {
64+
span {
6065
background-color: rgba(98, 94, 255, 10%);
6166
padding: variables.$spacing-sm;
6267
border-radius: variables.$border-radius-sm;

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/FieldRow.tsx

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { faArrowRight, faMinus, faPlus } from "@fortawesome/free-solid-svg-icons
22
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
33
import classnames from "classnames";
44

5+
import { ModificationIcon } from "components/icons/ModificationIcon";
6+
57
import { FieldTransform } from "core/request/AirbyteClient";
68

7-
import { ModificationIcon } from "../../../../components/icons/ModificationIcon";
89
import styles from "./FieldRow.module.scss";
910

1011
interface FieldRowProps {
@@ -38,29 +39,29 @@ export const FieldRow: React.FC<FieldRowProps> = ({ transform }) => {
3839

3940
return (
4041
<tr className={styles.row}>
41-
<td className={styles.iconCell}>
42-
{diffType === "add" ? (
43-
<FontAwesomeIcon icon={faPlus} size="1x" className={iconStyle} />
44-
) : diffType === "remove" ? (
45-
<FontAwesomeIcon icon={faMinus} size="1x" className={iconStyle} />
46-
) : (
47-
<span className="mod">
48-
<ModificationIcon />
49-
</span>
50-
)}
51-
</td>
5242
<td className={contentStyle}>
53-
<div className={styles.cell}>
54-
<span>{fieldName}</span>
43+
<div className={styles.iconContainer}>
44+
{diffType === "add" ? (
45+
<FontAwesomeIcon icon={faPlus} size="1x" className={iconStyle} />
46+
) : diffType === "remove" ? (
47+
<FontAwesomeIcon icon={faMinus} size="1x" className={iconStyle} />
48+
) : (
49+
<div className={iconStyle}>
50+
<ModificationIcon />
51+
</div>
52+
)}
5553
</div>
56-
<div className={updateCellStyle}>
57-
{oldType && newType && (
54+
{fieldName}
55+
</td>
56+
{oldType && newType && (
57+
<td className={contentStyle}>
58+
<div className={updateCellStyle}>
5859
<span>
5960
{oldType} <FontAwesomeIcon icon={faArrowRight} /> {newType}
6061
</span>
61-
)}
62-
</div>
63-
</td>
62+
</div>
63+
</td>
64+
)}
6465
</tr>
6566
);
6667
};

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/FieldSection.module.scss

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@use "../../../../scss/colors";
2-
@use "../../../../scss/variables";
1+
@use "scss/colors";
2+
@use "scss/variables";
33
@use "./DiffSection.module.scss";
44

55
.fieldHeader {
@@ -11,11 +11,7 @@
1111
.fieldSubHeader {
1212
@extend %sectionSubHeader;
1313

14-
padding: 0 variables.$spacing-sm 0 35px;
15-
16-
.padLeft {
17-
padding-left: variables.$spacing-xl;
18-
}
14+
padding: 0 variables.$spacing-sm 0 40px;
1915

2016
> div {
2117
@extend %nameCell;
@@ -25,12 +21,11 @@
2521
font-size: 10px;
2622
color: colors.$grey;
2723
line-height: 12px;
28-
padding-left: variables.$spacing-md;
2924
}
3025
}
3126

3227
.fieldRowsContainer {
33-
padding-left: variables.$spacing-lg;
28+
padding: 0 variables.$spacing-lg;
3429

3530
ul,
3631
li {

airbyte-webapp/src/views/Connection/CatalogDiffModal/components/FieldSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const FieldSection: React.FC<FieldSectionProps> = ({ streams, diffVerb })
2323
<div id={formatMessage({ id: "connection.updateSchema.namespace" })}>
2424
<FormattedMessage id="connection.updateSchema.namespace" />
2525
</div>
26-
<div className={styles.padLeft} id={formatMessage({ id: "connection.updateSchema.streamName" })}>
26+
<div id={formatMessage({ id: "connection.updateSchema.streamName" })}>
2727
<FormattedMessage id="connection.updateSchema.streamName" />
2828
</div>
2929
<div />

0 commit comments

Comments
 (0)