-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🧹 Splits the imageBlock component in two. (#17479)
* Splits the imageBlock component. * Adds and corrects some styles. * Finishes cleaning up styles and properties. * Cleanup. * Requested changes 1/2. * Requestion changes 2/x, margin not working in className. * Corrects assing className as prop. * Requested changes.
- Loading branch information
1 parent
39c5512
commit 2e0fae4
Showing
9 changed files
with
110 additions
and
82 deletions.
There are no files selected for viewing
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
39 changes: 39 additions & 0 deletions
39
airbyte-webapp/src/components/ui/NumberBadge/NumberBadge.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,39 @@ | ||
@use "../../../scss/colors"; | ||
@use "../../../scss/fonts"; | ||
|
||
.circle { | ||
height: 20px; | ||
width: fit-content; | ||
min-width: 20px; | ||
border-radius: 10px; | ||
padding: 0 4px; | ||
text-align: center; | ||
overflow: hidden; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
line-height: normal; | ||
font-family: fonts.$primary; | ||
font-style: normal; | ||
font-weight: 500; | ||
font-size: 10px; | ||
|
||
&.default { | ||
background: colors.$dark-blue-100; | ||
} | ||
|
||
&.green { | ||
background: colors.$green; | ||
color: colors.$black; | ||
} | ||
|
||
&.red { | ||
background: colors.$red; | ||
color: colors.$black; | ||
} | ||
|
||
&.blue { | ||
background: colors.$blue; | ||
color: colors.$white; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
airbyte-webapp/src/components/ui/NumberBadge/NumberBadge.stories.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
|
||
import { NumberBadge } from "./NumberBadge"; | ||
|
||
export default { | ||
title: "UI/NumberBadge", | ||
component: NumberBadge, | ||
argTypes: {}, | ||
} as ComponentMeta<typeof NumberBadge>; | ||
|
||
const Template: ComponentStory<typeof NumberBadge> = (args) => <NumberBadge {...args} />; | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
value: 10, | ||
}; |
26 changes: 26 additions & 0 deletions
26
airbyte-webapp/src/components/ui/NumberBadge/NumberBadge.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import classnames from "classnames"; | ||
import React from "react"; | ||
|
||
import styles from "./NumberBadge.module.scss"; | ||
|
||
interface NumberBadgeProps { | ||
value: number; | ||
color?: "green" | "red" | "blue" | "default"; | ||
className?: string; | ||
"aria-label"?: string; | ||
} | ||
|
||
export const NumberBadge: React.FC<NumberBadgeProps> = ({ value, color, className, "aria-label": ariaLabel }) => { | ||
const numberBadgeClassnames = classnames(styles.circle, className, { | ||
[styles.default]: !color || color === "default", | ||
[styles.green]: color === "green", | ||
[styles.red]: color === "red", | ||
[styles.blue]: color === "blue", | ||
}); | ||
|
||
return ( | ||
<div className={numberBadgeClassnames} aria-label={ariaLabel}> | ||
<div>{value}</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./NumberBadge"; |
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