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

🪟 🐛 🎨 Fix design issues with CatalogDiff modal #18870

Merged
merged 8 commits into from
Nov 15, 2022
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use "../../../scss/colors";
@use "../../../scss/fonts";
@use "scss/colors";
@use "scss/fonts";

.circle {
height: 20px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const NumberBadge: React.FC<NumberBadgeProps> = ({ value, color, classNam

return (
<div className={numberBadgeClassnames} aria-label={ariaLabel}>
<div>{value}</div>
{value}
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use "../../../../scss/variables";
@forward "../components/StreamRow.module.scss";
@forward "../components/DiffSection.module.scss";
@use "scss/variables";
@forward "./StreamRow.module.scss";
@forward "./DiffSection.module.scss";

.accordionContainer {
width: 100%;
Expand All @@ -15,6 +15,13 @@
flex-direction: row;
align-items: center;
justify-content: flex-start;
padding: variables.$spacing-sm;
padding: 0 15px 0 0;
font-weight: 400;
}

.accordionPanel {
display: flex;
flex-direction: column;
gap: variables.$spacing-sm;
padding: 0 15px variables.$spacing-md 40px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const DiffAccordion: React.FC<DiffAccordionProps> = ({ streamTransform })
open={open}
/>
</Disclosure.Button>
<Disclosure.Panel>
<Disclosure.Panel className={styles.accordionPanel}>
{removedItems.length > 0 && <DiffFieldTable fieldTransforms={removedItems} diffVerb="removed" />}
{newItems.length > 0 && <DiffFieldTable fieldTransforms={newItems} diffVerb="new" />}
{changedItems.length > 0 && <DiffFieldTable fieldTransforms={changedItems} diffVerb="changed" />}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
@forward "../components/StreamRow.module.scss";
@forward "../components/DiffSection.module.scss";
@use "../../../../scss/variables";
@use "scss/variables";

.namespace {
padding-left: variables.$spacing-sm;
.row {
padding: 0 0 0 variables.$spacing-sm;
}

.headerAdjust {
padding-left: -10px;
margin-left: -5px;
.namespace {
padding-left: variables.$spacing-sm;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export const DiffAccordionHeader: React.FC<DiffAccordionHeaderProps> = ({
<ModificationIcon />
<div className={namespaceCellStyles} aria-labelledby={formatMessage({ id: "connection.updateSchema.namespace" })}>
{open ? <FontAwesomeIcon icon={faAngleDown} /> : <FontAwesomeIcon icon={faAngleRight} />}
<div className={styles.headerAdjust}>{streamDescriptor.namespace}</div>
<div>{streamDescriptor.namespace}</div>
</div>
<div className={nameCellStyle} aria-labelledby={formatMessage({ id: "connection.updateSchema.streamName" })}>
<div className={styles.headerAdjust}>{streamDescriptor.name}</div>
<div>{streamDescriptor.name}</div>
</div>
<DiffIconBlock removedCount={removedCount} newCount={newCount} changedCount={changedCount} />
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
@use "../../../../scss/variables";
@use "scss/variables";
@use "./DiffSection.module.scss";

.accordionSubHeader {
.header {
@extend %sectionSubHeader;

& .padLeft {
padding-left: variables.$spacing-lg;
}
padding: 0 0 0 30px;

& th {
font-size: 10px;
width: 228px;
padding-left: variables.$spacing-md;
}
}

.table {
width: 100%;
padding-left: variables.$spacing-xl;
border-spacing: 0;

& tbody > tr:first-of-type > td:nth-of-type(2) {
border-radius: variables.$border-radius-sm variables.$border-radius-sm 0 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export const DiffFieldTable: React.FC<DiffFieldTableProps> = ({ fieldTransforms,
return (
<table className={styles.table} aria-label={`${diffVerb} fields`}>
<thead>
<tr className={styles.accordionSubHeader}>
<tr className={styles.header}>
<th>
<DiffHeader diffCount={fieldTransforms.length} diffVerb={diffVerb} diffType="field" />
</th>
{diffVerb === "changed" && (
<th className={styles.padLeft}>
<th>
<FormattedMessage id="connection.updateSchema.dataType" />
</th>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FormattedMessage } from "react-intl";
import { useIntl } from "react-intl";

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

Expand All @@ -11,15 +11,17 @@ interface DiffHeaderProps {
}

export const DiffHeader: React.FC<DiffHeaderProps> = ({ diffCount, diffVerb, diffType }) => {
return (
<div>
<FormattedMessage
id={`connection.updateSchema.${diffVerb}`}
values={{
value: diffCount,
item: <FormattedMessage id={`connection.updateSchema.${diffType}`} values={{ count: diffCount }} />,
}}
/>
</div>
const { formatMessage } = useIntl();

const text = formatMessage(
{
id: `connection.updateSchema.${diffVerb}`,
},
{
value: diffCount,
item: formatMessage({ id: `connection.updateSchema.${diffType}` }, { count: diffCount }),
}
Comment on lines +14 to +23
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nit change: This was rendered strangely in the inspector. The string was split into 3 parts in the dom. This change will render the string as a whole.

);

return <>{text}</>;
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@use "scss/variables";

.iconBlock {
display: flex;
flex-direction: row;
gap: 1px;
gap: variables.$spacing-sm;
margin-left: auto;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
@use "../../../../scss/colors";
@use "../../../../scss/variables";
@use "../components/StreamRow.module.scss";
@use "scss/colors";
@use "scss/variables";
@use "./StreamRow.module.scss";

.sectionContainer {
display: flex;
flex-direction: column;
}

.table {
border-spacing: 0;
}

.sectionSubHeader,
%sectionSubHeader {
display: flex;
Expand All @@ -25,10 +29,6 @@
color: colors.$grey;
line-height: 12px;
}

.padLeft {
padding-left: variables.$spacing-md;
}
}

.sectionHeader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export const DiffSection: React.FC<DiffSectionProps> = ({ streams, catalog, diff
<div className={styles.sectionHeader}>
<DiffHeader diffCount={streams.length} diffVerb={diffVerb} diffType="stream" />
</div>
<table aria-label={`${diffVerb} streams table`}>
<table aria-label={`${diffVerb} streams table`} className={styles.table}>
<thead className={styles.sectionSubHeader}>
<tr>
<th>
<FormattedMessage id="connection.updateSchema.namespace" />
</th>
<th className={styles.padLeft}>
<th>
<FormattedMessage id="connection.updateSchema.streamName" />
</th>
<th />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
@use "../../../../scss/variables";
@use "../../../../scss/colors";
@use "scss/variables";
@use "scss/colors";

.row {
display: flex;
flex-direction: row;
align-items: center;
padding: variables.$spacing-sm variables.$spacing-xl;
gap: variables.$spacing-md;
height: 35px;
font-size: 12px;
}

.content {
padding-left: 10px;
display: flex;
width: 100%;
height: 35px;
Expand All @@ -28,6 +26,16 @@
}
}

tr:first-child .content {
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}

tr:last-child .content {
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}

.icon {
&.plus {
color: colors.$green;
Expand All @@ -39,24 +47,21 @@

&.mod {
color: colors.$blue-100;
margin-left: -5px;
}
}

.iconCell {
background: white;
.iconContainer {
width: 10px;
height: 100%;
display: flex;
align-items: center;
margin: 0 variables.$spacing-md;
}

.cell {
width: 228px;

&.update {
border-radius: variables.$border-radius-sm;

& span {
span {
background-color: rgba(98, 94, 255, 10%);
padding: variables.$spacing-sm;
border-radius: variables.$border-radius-sm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { faArrowRight, faMinus, faPlus } from "@fortawesome/free-solid-svg-icons
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import classnames from "classnames";

import { ModificationIcon } from "components/icons/ModificationIcon";

import { FieldTransform } from "core/request/AirbyteClient";

import { ModificationIcon } from "../../../../components/icons/ModificationIcon";
import styles from "./FieldRow.module.scss";

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

return (
<tr className={styles.row}>
<td className={styles.iconCell}>
{diffType === "add" ? (
<FontAwesomeIcon icon={faPlus} size="1x" className={iconStyle} />
) : diffType === "remove" ? (
<FontAwesomeIcon icon={faMinus} size="1x" className={iconStyle} />
) : (
<span className="mod">
<ModificationIcon />
</span>
)}
</td>
<td className={contentStyle}>
<div className={styles.cell}>
<span>{fieldName}</span>
<div className={styles.iconContainer}>
{diffType === "add" ? (
<FontAwesomeIcon icon={faPlus} size="1x" className={iconStyle} />
) : diffType === "remove" ? (
<FontAwesomeIcon icon={faMinus} size="1x" className={iconStyle} />
) : (
<div className={iconStyle}>
<ModificationIcon />
</div>
)}
</div>
<div className={updateCellStyle}>
{oldType && newType && (
{fieldName}
</td>
{oldType && newType && (
<td className={contentStyle}>
<div className={updateCellStyle}>
<span>
{oldType} <FontAwesomeIcon icon={faArrowRight} /> {newType}
</span>
)}
</div>
</td>
</div>
</td>
)}
</tr>
);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use "../../../../scss/colors";
@use "../../../../scss/variables";
@use "scss/colors";
@use "scss/variables";
@use "./DiffSection.module.scss";

.fieldHeader {
Expand All @@ -11,11 +11,7 @@
.fieldSubHeader {
@extend %sectionSubHeader;

padding: 0 variables.$spacing-sm 0 35px;

.padLeft {
padding-left: variables.$spacing-xl;
}
padding: 0 variables.$spacing-sm 0 40px;

> div {
@extend %nameCell;
Expand All @@ -25,12 +21,11 @@
font-size: 10px;
color: colors.$grey;
line-height: 12px;
padding-left: variables.$spacing-md;
}
}

.fieldRowsContainer {
padding-left: variables.$spacing-lg;
padding: 0 variables.$spacing-lg;

ul,
li {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const FieldSection: React.FC<FieldSectionProps> = ({ streams, diffVerb })
<div id={formatMessage({ id: "connection.updateSchema.namespace" })}>
<FormattedMessage id="connection.updateSchema.namespace" />
</div>
<div className={styles.padLeft} id={formatMessage({ id: "connection.updateSchema.streamName" })}>
<div id={formatMessage({ id: "connection.updateSchema.streamName" })}>
<FormattedMessage id="connection.updateSchema.streamName" />
</div>
<div />
Expand Down
Loading