-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🎨 🧹 Migrate Card component to SCSS and refactor (#16407)
* Converts worspace item into a button and adds some styling. * Adds workspace button width and padding. * Removes border for correct box shadow styling. * Converts chevron icon from styled components to scss. * Brakes card, contentcard, stateblock to rebuild styling and props. * Uses Card in ConnectorCard instead of ContentCard. * Adds conditional styling to Card. * Cleans up unused code. * Adds className override through props. * Updates existing destination card component. * Removes styled components from ConnectionBlock. * Replaces some ContenCards with Cards. * Replaces all ContentCard components with Card. * Adds missing padding in StateBlock. * Fixes linting errors. * Corrects stylelint errors. * Reguested changes. Co-authored-by: Tim Roes <tim@airbyte.io>
- Loading branch information
1 parent
ba93a09
commit 8cb3fa4
Showing
27 changed files
with
178 additions
and
152 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
airbyte-webapp/src/components/CenteredPageComponents/PaddedCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
airbyte-webapp/src/components/ConnectionBlock/ConnectionBlock.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@use "../../scss/colors"; | ||
|
||
.lightContentCard { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
flex-direction: row; | ||
padding: 20px 21px 19px; | ||
margin-bottom: 12px; | ||
} | ||
|
||
.arrow { | ||
font-size: 29px; | ||
line-height: 29px; | ||
color: colors.$blue-500; | ||
} | ||
|
||
.extraBlock { | ||
background: none; | ||
} |
35 changes: 8 additions & 27 deletions
35
airbyte-webapp/src/components/ConnectionBlock/ConnectionBlock.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,23 @@ | ||
import { faChevronRight } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import classNames from "classnames"; | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import ContentCard from "../ContentCard"; | ||
import { Card } from "../base/Card"; | ||
import { ConnectionBlockItem, Content } from "./components/ConnectionBlockItem"; | ||
import styles from "./ConnectionBlock.module.scss"; | ||
|
||
interface IProps { | ||
className?: string; | ||
itemFrom?: { name: string; icon?: string }; | ||
itemTo?: { name: string; icon?: string }; | ||
} | ||
|
||
const LightContentCard = styled(ContentCard)` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
flex-direction: row; | ||
padding: 20px 21px 19px; | ||
margin-bottom: 12px; | ||
`; | ||
|
||
const Arrow = styled(FontAwesomeIcon)` | ||
font-size: 29px; | ||
line-height: 29px; | ||
color: ${({ theme }) => theme.primaryColor}; | ||
`; | ||
|
||
const ExtraBlock = styled(Content)` | ||
background: none; | ||
`; | ||
|
||
const ConnectionBlock: React.FC<IProps> = (props) => ( | ||
<LightContentCard className={props.className}> | ||
{props.itemFrom ? <ConnectionBlockItem {...props.itemFrom} /> : <ExtraBlock />} | ||
<Arrow icon={faChevronRight} /> | ||
{props.itemTo ? <ConnectionBlockItem {...props.itemTo} /> : <ExtraBlock />} | ||
</LightContentCard> | ||
<Card className={classNames(styles.lightContentCard)}> | ||
{props.itemFrom ? <ConnectionBlockItem {...props.itemFrom} /> : <Content className={styles.extraBlock} />} | ||
<FontAwesomeIcon className={styles.arrow} icon={faChevronRight} /> | ||
{props.itemTo ? <ConnectionBlockItem {...props.itemTo} /> : <Content className={styles.extraBlock} />} | ||
</Card> | ||
); | ||
|
||
export default ConnectionBlock; |
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
airbyte-webapp/src/components/ContentCard/index.stories.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@use "../../../scss/colors"; | ||
|
||
.container { | ||
width: auto; | ||
background: colors.$white; | ||
border-radius: 10px; | ||
box-shadow: 0 2px 4px colors.$cardShadowColor; | ||
|
||
&.fullWidth { | ||
width: 100%; | ||
} | ||
|
||
&.withPadding { | ||
padding: 20px; | ||
} | ||
} | ||
|
||
.title { | ||
padding: 25px 25px 22px; | ||
color: colors.$dark-blue; | ||
border-bottom: #e8e8ed 1px solid; | ||
font-weight: 600; | ||
letter-spacing: 0.008em; | ||
border-top-left-radius: 10px; | ||
border-top-right-radius: 10px; | ||
|
||
&.lightPadding { | ||
padding: 19px 20px 20px; | ||
} | ||
|
||
&.roundedBottom { | ||
border-radius: 10px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,45 @@ | ||
import styled from "styled-components"; | ||
import classNames from "classnames"; | ||
import React from "react"; | ||
|
||
export const Card = styled.div<{ full?: boolean; $withPadding?: boolean }>` | ||
width: ${({ full }) => (full ? "100%" : "auto")}; | ||
background: ${({ theme }) => theme.whiteColor}; | ||
border-radius: 10px; | ||
box-shadow: 0 2px 4px ${({ theme }) => theme.cardShadowColor}; | ||
padding: ${({ $withPadding }) => ($withPadding ? "20px" : undefined)}; | ||
//border: 1px solid ${({ theme }) => theme.greyColor20}; | ||
`; | ||
import { H5 } from "../Titles"; | ||
import styles from "./Card.module.scss"; | ||
|
||
export interface CardProps { | ||
title?: React.ReactNode; | ||
className?: string; | ||
fullWidth?: boolean; | ||
lightPadding?: boolean; | ||
withPadding?: boolean; | ||
roundedBottom?: boolean; | ||
} | ||
|
||
export const Card: React.FC<CardProps> = ({ | ||
children, | ||
title, | ||
className, | ||
fullWidth, | ||
lightPadding, | ||
withPadding, | ||
roundedBottom, | ||
}) => { | ||
return ( | ||
<div | ||
className={classNames(className, styles.container, { | ||
[styles.fullWidth]: fullWidth, | ||
[styles.withPadding]: withPadding, | ||
})} | ||
> | ||
{title ? ( | ||
<H5 | ||
className={classNames(styles.title, { | ||
[styles.lightPadding]: lightPadding || !children, | ||
[styles.roundedBottom]: roundedBottom, | ||
})} | ||
> | ||
{title} | ||
</H5> | ||
) : null} | ||
{children} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...p/src/packages/cloud/views/workspaces/WorkspacesPage/components/WorkspaceItem.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@use "../../../../../../scss/colors"; | ||
|
||
.button { | ||
padding: 20px 28px 20px 20px; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
margin-bottom: 10px; | ||
cursor: pointer; | ||
width: 100%; | ||
background: colors.$white; | ||
border-radius: 10px; | ||
box-shadow: 0 2px 4px colors.$shadowColor; | ||
border: none; | ||
} | ||
|
||
.iconColor { | ||
color: colors.$blue-400; | ||
} |
22 changes: 5 additions & 17 deletions
22
...te-webapp/src/packages/cloud/views/workspaces/WorkspacesPage/components/WorkspaceItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
import { faChevronRight } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import { H5, ContentCard } from "components"; | ||
import { H5 } from "components"; | ||
|
||
const Item = styled(ContentCard)` | ||
padding: 20px 28px 20px 20px; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
margin-bottom: 10px; | ||
cursor: pointer; | ||
`; | ||
|
||
const Arrow = styled(FontAwesomeIcon)` | ||
color: ${({ theme }) => theme.primaryColor}; | ||
`; | ||
import styles from "./WorkspaceItem.module.scss"; | ||
|
||
const WorkspaceItem: React.FC<{ onClick: (id: string) => void; id: string }> = (props) => ( | ||
<Item onClick={() => props.onClick(props.id)}> | ||
<button className={styles.button} onClick={() => props.onClick(props.id)}> | ||
<H5 bold>{props.children}</H5> | ||
<Arrow icon={faChevronRight} /> | ||
</Item> | ||
<FontAwesomeIcon className={styles.iconColor} icon={faChevronRight} /> | ||
</button> | ||
); | ||
|
||
export default WorkspaceItem; |
Oops, something went wrong.