Skip to content

Commit 578f40a

Browse files
author
Joey Marshment-Howell
authored
🪟🔧 Remove styled components (round 1) (#18766)
* refactor EditorHeader (untested) * refactor BaseClearView * delete unused Subtitle * refactor ConfirmationModal * refactor Arrow * refactor BulkHeader * refactor CatalogTreeSearch * refactor StreamFieldTable * refactor StreamHeader * refactor ConnectorIcon * refactor TreeRowWrapper * refactor DeleteBlock * refactor EmptyResourceBlock * revert unintended element change
1 parent b299688 commit 578f40a

24 files changed

+239
-210
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@use "scss/colors";
2+
3+
.editorHeader {
4+
display: flex;
5+
justify-content: space-between;
6+
align-items: center;
7+
flex-direction: row;
8+
color: colors.$dark-blue-900;
9+
font-weight: 500;
10+
font-size: 14px;
11+
line-height: 17px;
12+
margin: 5px 0 10px;
13+
}

airbyte-webapp/src/components/ArrayOfObjectsEditor/components/EditorHeader.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
11
import React from "react";
22
import { FormattedMessage } from "react-intl";
3-
import styled from "styled-components";
43

54
import { Button } from "components/ui/Button";
65

76
import { ConnectionFormMode } from "hooks/services/ConnectionForm/ConnectionFormService";
87

9-
const Content = styled.div`
10-
display: flex;
11-
justify-content: space-between;
12-
align-items: center;
13-
flex-direction: row;
14-
color: ${({ theme }) => theme.textColor};
15-
font-weight: 500;
16-
font-size: 14px;
17-
line-height: 17px;
18-
margin: 5px 0 10px;
19-
`;
8+
import styles from "./EditorHeader.module.scss";
209

2110
interface EditorHeaderProps {
2211
mainTitle?: React.ReactNode;
@@ -36,14 +25,14 @@ const EditorHeader: React.FC<EditorHeaderProps> = ({
3625
disabled,
3726
}) => {
3827
return (
39-
<Content>
28+
<div className={styles.editorHeader}>
4029
{mainTitle || <FormattedMessage id="form.items" values={{ count: itemsCount }} />}
4130
{mode !== "readonly" && (
4231
<Button variant="secondary" type="button" onClick={onAddItem} data-testid="addItemButton" disabled={disabled}>
4332
{addButtonText || <FormattedMessage id="form.addItems" />}
4433
</Button>
4534
)}
46-
</Content>
35+
</div>
4736
);
4837
};
4938

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
.buttonWithMargin {
22
margin-right: 12px;
33
}
4+
5+
.content {
6+
width: 585px;
7+
font-size: 14px;
8+
padding: 25px;
9+
white-space: pre-line;
10+
}
11+
12+
.buttonContent {
13+
margin-top: 26px;
14+
display: flex;
15+
justify-content: flex-end;
16+
}

airbyte-webapp/src/components/common/ConfirmationModal/ConfirmationModal.tsx

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
11
import React from "react";
22
import { FormattedMessage } from "react-intl";
3-
import styled from "styled-components";
43

54
import { Button } from "components/ui/Button";
65
import { Modal } from "components/ui/Modal";
76

87
import useLoadingState from "../../../hooks/useLoadingState";
98
import styles from "./ConfirmationModal.module.scss";
109

11-
const Content = styled.div`
12-
width: 585px;
13-
font-size: 14px;
14-
padding: 25px;
15-
white-space: pre-line;
16-
`;
17-
18-
const ButtonContent = styled.div`
19-
margin-top: 26px;
20-
display: flex;
21-
justify-content: flex-end;
22-
`;
23-
2410
export interface ConfirmationModalProps {
2511
onClose: () => void;
2612
title: string;
@@ -45,9 +31,9 @@ export const ConfirmationModal: React.FC<ConfirmationModalProps> = ({
4531

4632
return (
4733
<Modal onClose={onClose} title={<FormattedMessage id={title} />}>
48-
<Content>
34+
<div className={styles.content}>
4935
<FormattedMessage id={text} />
50-
<ButtonContent>
36+
<div className={styles.buttonContent}>
5137
<Button
5238
className={styles.buttonWithMargin}
5339
onClick={onClose}
@@ -60,8 +46,8 @@ export const ConfirmationModal: React.FC<ConfirmationModalProps> = ({
6046
<Button variant="danger" onClick={onSubmitBtnClick} data-id={submitButtonDataId} isLoading={isLoading}>
6147
<FormattedMessage id={submitButtonText} />
6248
</Button>
63-
</ButtonContent>
64-
</Content>
49+
</div>
50+
</div>
6551
</Modal>
6652
);
6753
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.content {
2+
height: 25px;
3+
width: 25px;
4+
overflow: hidden;
5+
}
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
import React from "react";
2-
import styled from "styled-components";
32

43
import { getIcon } from "utils/imageUtils";
54

5+
import styles from "./ConnectorIcon.module.scss";
6+
67
interface Props {
78
icon?: string;
89
className?: string;
910
small?: boolean;
1011
}
1112

12-
export const Content = styled.div`
13-
height: 25px;
14-
width: 25px;
15-
overflow: hidden;
16-
`;
17-
18-
export const ConnectorIcon: React.FC<Props> = ({ icon, className }) => (
19-
<Content className={className} aria-hidden="true">
13+
export const ConnectorIcon: React.FC<Props> = ({ icon }) => (
14+
<div className={styles.content} aria-hidden="true">
2015
{getIcon(icon)}
21-
</Content>
16+
</div>
2217
);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@use "scss/colors";
2+
3+
.deleteBlock {
4+
margin-top: 12px;
5+
padding: 19px 20px 20px;
6+
display: flex;
7+
align-items: center;
8+
justify-content: space-between;
9+
}
10+
11+
.text {
12+
font-size: 11px;
13+
line-height: 13px;
14+
color: colors.$grey-300;
15+
white-space: pre-line;
16+
}
Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
11
import React, { useCallback } from "react";
22
import { FormattedMessage } from "react-intl";
33
import { useNavigate } from "react-router-dom";
4-
import styled from "styled-components";
54

65
import { H5 } from "components/base/Titles";
76
import { Button } from "components/ui/Button";
87
import { Card } from "components/ui/Card";
98

109
import { useConfirmationModalService } from "hooks/services/ConfirmationModal";
1110

11+
import styles from "./DeleteBlock.module.scss";
12+
1213
interface IProps {
1314
type: "source" | "destination" | "connection";
1415
onDelete: () => Promise<unknown>;
1516
}
1617

17-
const DeleteBlockComponent = styled(Card)`
18-
margin-top: 12px;
19-
padding: 19px 20px 20px;
20-
display: flex;
21-
align-items: center;
22-
justify-content: space-between;
23-
`;
24-
25-
const Text = styled.div`
26-
margin-left: 20px;
27-
font-size: 11px;
28-
line-height: 13px;
29-
color: ${({ theme }) => theme.greyColor40};
30-
white-space: pre-line;
31-
`;
32-
3318
export const DeleteBlock: React.FC<IProps> = ({ type, onDelete }) => {
3419
const { openConfirmationModal, closeConfirmationModal } = useConfirmationModalService();
3520
const navigate = useNavigate();
@@ -49,16 +34,16 @@ export const DeleteBlock: React.FC<IProps> = ({ type, onDelete }) => {
4934
}, [closeConfirmationModal, onDelete, openConfirmationModal, navigate, type]);
5035

5136
return (
52-
<DeleteBlockComponent>
53-
<Text>
37+
<Card className={styles.deleteBlock}>
38+
<div className={styles.text}>
5439
<H5 bold>
5540
<FormattedMessage id={`tables.${type}Delete.title`} />
5641
</H5>
5742
<FormattedMessage id={`tables.${type}DataDelete`} />
58-
</Text>
43+
</div>
5944
<Button variant="danger" onClick={onDeleteButtonClick} data-id="open-delete-modal">
6045
<FormattedMessage id={`tables.${type}Delete`} />
6146
</Button>
62-
</DeleteBlockComponent>
47+
</Card>
6348
);
6449
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@use "scss/colors";
2+
3+
.content {
4+
padding: 74px 0 111px;
5+
text-align: center;
6+
font-size: 20px;
7+
line-height: 27px;
8+
color: colors.$dark-blue-900;
9+
}
10+
11+
.imgBlock {
12+
height: 80px;
13+
width: 80px;
14+
border-radius: 50%;
15+
background: colors.$grey-100;
16+
margin: 0 auto 10px;
17+
text-align: center;
18+
padding: 20px 0;
19+
}
20+
21+
.description {
22+
font-weight: normal;
23+
font-size: 14px;
24+
line-height: 19px;
25+
color: colors.$grey-500;
26+
margin-top: 5px;
27+
}
Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,18 @@
11
import React from "react";
2-
import styled from "styled-components";
2+
3+
import styles from "./EmptyResourceBlock.module.scss";
34

45
interface EmptyResourceBlockProps {
56
text: React.ReactNode;
67
description?: React.ReactNode;
78
}
89

9-
const Content = styled.div`
10-
padding: 74px 0 111px;
11-
text-align: center;
12-
font-size: 20px;
13-
line-height: 27px;
14-
color: ${({ theme }) => theme.textColor};
15-
`;
16-
17-
const ImgBlock = styled.div`
18-
height: 80px;
19-
width: 80px;
20-
border-radius: 50%;
21-
background: ${({ theme }) => theme.greyColor20};
22-
margin: 0 auto 10px;
23-
text-align: center;
24-
padding: 20px 0;
25-
`;
26-
27-
const Description = styled.div`
28-
font-weight: normal;
29-
font-size: 14px;
30-
line-height: 19px;
31-
color: ${({ theme }) => theme.greyColor60};
32-
margin-top: 5px;
33-
`;
34-
3510
export const EmptyResourceBlock: React.FC<EmptyResourceBlockProps> = ({ text, description }) => (
36-
<Content>
37-
<ImgBlock>
11+
<div className={styles.content}>
12+
<div className={styles.imgBlock}>
3813
<img src="/cactus.png" height={40} alt="cactus" />
39-
</ImgBlock>
14+
</div>
4015
{text}
41-
<Description>{description}</Description>
42-
</Content>
16+
<div className={styles.description}>{description}</div>
17+
</div>
4318
);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.content {
2+
height: 100%;
3+
width: 100%;
4+
padding: 34px 0 13px;
5+
display: flex;
6+
align-items: center;
7+
flex-direction: column;
8+
justify-content: space-between;
9+
}
10+
11+
.logoImg {
12+
width: 90px;
13+
height: 94px;
14+
margin-bottom: 20px;
15+
}
16+
17+
.mainInfo {
18+
min-width: 550px;
19+
display: flex;
20+
align-items: center;
21+
flex-direction: column;
22+
}
Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,21 @@
11
import React from "react";
22
import { useIntl } from "react-intl";
33
import { Link } from "react-router-dom";
4-
import styled from "styled-components";
54

65
import { Version } from "../Version";
7-
8-
const Content = styled.div`
9-
height: 100%;
10-
width: 100%;
11-
padding: 34px 0 13px;
12-
display: flex;
13-
align-items: center;
14-
flex-direction: column;
15-
justify-content: space-between;
16-
`;
17-
18-
const LogoImg = styled.img`
19-
width: 90px;
20-
height: 94px;
21-
margin-bottom: 20px;
22-
`;
23-
24-
const MainInfo = styled.div`
25-
min-width: 550px;
26-
display: flex;
27-
align-items: center;
28-
flex-direction: column;
29-
`;
6+
import styles from "./BaseClearView.module.scss";
307

318
export const BaseClearView: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
329
const { formatMessage } = useIntl();
3310
return (
34-
<Content>
35-
<MainInfo>
11+
<div className={styles.content}>
12+
<div className={styles.mainInfo}>
3613
<Link to="..">
37-
<LogoImg src="/logo.png" alt={formatMessage({ id: "ui.goBack" })} />
14+
<img className={styles.logoImg} src="/logo.png" alt={formatMessage({ id: "ui.goBack" })} />
3815
</Link>
3916
{children}
40-
</MainInfo>
17+
</div>
4118
<Version />
42-
</Content>
19+
</div>
4320
);
4421
};

0 commit comments

Comments
 (0)