Skip to content

Commit

Permalink
Remove background/shadow from connector icon (#12142)
Browse files Browse the repository at this point in the history
* Remove background/shadow from connector icon

* Convert type to interface
  • Loading branch information
timroes authored Apr 20, 2022
1 parent 7023fbd commit 13e9230
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import styled from "styled-components";

import ImageBlock from "components/ImageBlock";
import { ConnectorIcon } from "components/ConnectorIcon";

type IProps = {
name: string;
Expand Down Expand Up @@ -31,7 +31,7 @@ const Name = styled.div`
const ConnectionBlockItem: React.FC<IProps> = (props) => {
return (
<Content>
<ImageBlock img={props.icon} />
<ConnectorIcon icon={props.icon} />
<Name>{props.name}</Name>
</Content>
);
Expand Down
23 changes: 23 additions & 0 deletions airbyte-webapp/src/components/ConnectorIcon/ConnectorIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import styled from "styled-components";
import React from "react";

import { getIcon } from "utils/imageUtils";

interface Props {
icon?: string;
className?: string;
small?: boolean;
}

export const Content = styled.div<{ $small?: boolean }>`
height: 25px;
width: 25px;
border-radius: ${({ $small }) => ($small ? 0 : 50)}%;
overflow: hidden;
`;

export const ConnectorIcon: React.FC<Props> = ({ icon, className, small }) => (
<Content className={className} $small={small} aria-hidden="true">
{getIcon(icon)}
</Content>
);
1 change: 1 addition & 0 deletions airbyte-webapp/src/components/ConnectorIcon/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ConnectorIcon } from "./ConnectorIcon";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import styled from "styled-components";

import ImageBlock from "components/ImageBlock";
import { ConnectorIcon } from "components/ConnectorIcon";

type IProps = {
value: string;
Expand All @@ -16,14 +16,14 @@ const Content = styled.div<{ enabled?: boolean }>`
font-weight: 500;
`;

const Image = styled(ImageBlock)`
const Image = styled(ConnectorIcon)`
margin-right: 6px;
`;

const ConnectorCell: React.FC<IProps> = ({ value, enabled, img }) => {
return (
<Content enabled={enabled}>
<Image small img={img} />
<Image small icon={img} />
{value}
</Content>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import styled from "styled-components";
import { useIntl } from "react-intl";

import StatusIcon from "components/StatusIcon";
import ImageBlock from "components/ImageBlock";
import { StatusIconStatus } from "components/StatusIcon/StatusIcon";
import { ConnectorIcon } from "components/ConnectorIcon";

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

Expand Down Expand Up @@ -36,7 +36,7 @@ const Space = styled.div`
opacity: 0;
`;

const Image = styled(ImageBlock)`
const Image = styled(ConnectorIcon)`
margin-right: 6px;
`;

Expand Down Expand Up @@ -73,7 +73,7 @@ const NameCell: React.FC<IProps> = ({ value, enabled, status, icon, img }) => {
return (
<Content>
{status ? <StatusIcon title={title} status={statusIconStatus} /> : <Space />}
{icon && <Image small img={img} />}
{icon && <Image small icon={img} />}
<Name enabled={enabled}>{value}</Name>
</Content>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from "styled-components";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faArrowRight } from "@fortawesome/free-solid-svg-icons";

import ImageBlock from "components/ImageBlock";
import { ConnectorIcon } from "components/ConnectorIcon";

type ConnectionCellProps = {
sourceDefinitionName: string;
Expand All @@ -12,7 +12,7 @@ type ConnectionCellProps = {
destinationIcon?: string;
};

const Icon = styled(ImageBlock)`
const Icon = styled(ConnectorIcon)`
margin-right: 12px;
display: inline-block;
vertical-align: middle;
Expand Down Expand Up @@ -40,12 +40,12 @@ const ConnectionCell: React.FC<ConnectionCellProps> = ({
return (
<>
<Connector>
<Icon small img={sourceIcon} />
<Icon small icon={sourceIcon} />
{sourceDefinitionName}
</Connector>
<Connector>
<Arrow icon={faArrowRight} />
<Icon small img={destinationIcon} />
<Icon small icon={destinationIcon} />
{destinationDefinitionName}
</Connector>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import React from "react";
import { FormattedMessage } from "react-intl";
import styled from "styled-components";

import { ContentCard, ImageBlock } from "components";
import { ContentCard } from "components";
import { Header, Row, Cell } from "components/SimpleTableComponents";
import { ReleaseStageBadge } from "components/ReleaseStageBadge";
import { ConnectorIcon } from "components/ConnectorIcon";

import { DestinationDefinition, SourceDefinition } from "core/domain/connector";
import { Connection } from "core/domain/connection";
Expand All @@ -16,7 +17,7 @@ const MainInfo = styled(ContentCard)`
padding: 23px 20px 20px 23px;
`;

const Img = styled(ImageBlock)`
const Img = styled(ConnectorIcon)`
display: inline-block;
`;

Expand Down Expand Up @@ -63,12 +64,12 @@ const StatusMainInfo: React.FC<IProps> = ({
</Header>
<Row>
<SourceCell flex={2}>
<Img img={sourceDefinition?.icon} />
<Img icon={sourceDefinition?.icon} />
{connection.source?.sourceName}
<ReleaseStageBadge stage={sourceDefinition?.releaseStage} />
</SourceCell>
<SourceCell flex={2}>
<Img img={destinationDefinition?.icon} />
<Img icon={destinationDefinition?.icon} />
{connection.destination?.destinationName}
<ReleaseStageBadge stage={destinationDefinition?.releaseStage} />
</SourceCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as yup from "yup";

import ContentCard from "components/ContentCard";
import { Button, ControlLabels, DropDown } from "components";
import ImageBlock from "components/ImageBlock";
import { ConnectorIcon } from "components/ConnectorIcon";

import { useSourceDefinitionList } from "services/connector/SourceDefinitionService";
import { useDestinationDefinitionList } from "services/connector/DestinationDefinitionService";
Expand Down Expand Up @@ -56,7 +56,7 @@ const ExistingEntityForm: React.FC<IProps> = ({ type, onSubmit }) => {
return {
label: item.name,
value: item.sourceId,
img: <ImageBlock img={sourceDef?.icon} />,
img: <ConnectorIcon icon={sourceDef?.icon} />,
};
});
} else {
Expand All @@ -67,7 +67,7 @@ const ExistingEntityForm: React.FC<IProps> = ({ type, onSubmit }) => {
return {
label: item.name,
value: item.destinationId,
img: <ImageBlock img={destinationDef?.icon} />,
img: <ConnectorIcon icon={destinationDef?.icon} />,
};
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import Placeholder, { ResourceTypes } from "components/Placeholder";
import Breadcrumbs from "components/Breadcrumbs";
import { ItemTabs, StepsTypes, TableItemTitle } from "components/ConnectorBlocks";
import HeadTitle from "components/HeadTitle";
import { DropDownRow, ImageBlock, LoadingPage, MainPageWithScroll, PageTitle } from "components";
import { DropDownRow, LoadingPage, MainPageWithScroll, PageTitle } from "components";
import { ConnectorIcon } from "components/ConnectorIcon";

import { getIcon } from "utils/imageUtils";
import useRouter from "hooks/useRouter";
Expand Down Expand Up @@ -55,7 +56,7 @@ const DestinationItemPage: React.FC = () => {
return {
label: item.name,
value: item.sourceId,
img: <ImageBlock img={sourceDef?.icon} />,
img: <ConnectorIcon icon={sourceDef?.icon} />,
};
}),
[sources, sourceDefinitions]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React, { Suspense, useMemo, useState } from "react";
import { FormattedMessage } from "react-intl";

import { DropDownRow, ImageBlock } from "components";
import { DropDownRow } from "components";
import PageTitle from "components/PageTitle";
import Breadcrumbs from "components/Breadcrumbs";
import { ItemTabs, StepsTypes, TableItemTitle } from "components/ConnectorBlocks";
import LoadingPage from "components/LoadingPage";
import MainPageWithScroll from "components/MainPageWithScroll";
import HeadTitle from "components/HeadTitle";
import Placeholder, { ResourceTypes } from "components/Placeholder";
import { ConnectorIcon } from "components/ConnectorIcon";

import { getIcon } from "utils/imageUtils";
import useRouter from "hooks/useRouter";
Expand Down Expand Up @@ -55,7 +56,7 @@ const SourceItemPage: React.FC = () => {
return {
label: item.name,
value: item.destinationId,
img: <ImageBlock img={destinationDef?.icon} />,
img: <ConnectorIcon icon={destinationDef?.icon} />,
};
}),
[destinations, destinationDefinitions]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import { components } from "react-select";
import { MenuListComponentProps } from "react-select/src/components/Menu";
import styled from "styled-components";

import { ControlLabels, DropDown, DropDownRow, ImageBlock } from "components";
import { ControlLabels, DropDown, DropDownRow } from "components";
import { IDataItem, IProps as OptionProps, OptionView } from "components/base/DropDown/components/Option";
import {
IProps as SingleValueProps,
Icon as SingleValueIcon,
ItemView as SingleValueView,
} from "components/base/DropDown/components/SingleValue";
import { ConnectorIcon } from "components/ConnectorIcon";

import { useCurrentWorkspace } from "hooks/services/useWorkspace";
import { FormBaseItem } from "core/form/types";
Expand Down Expand Up @@ -193,7 +194,7 @@ const ConnectorServiceTypeControl: React.FC<{
.map((item) => ({
label: item.name,
value: Connector.id(item),
img: <ImageBlock img={item.icon} />,
img: <ConnectorIcon icon={item.icon} />,
releaseStage: item.releaseStage,
}))
.sort((a, b) => {
Expand Down

0 comments on commit 13e9230

Please sign in to comment.