-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
🪟 🧹 Splits the imageBlock component in two. #17479
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the storybook locally and there were a couple of areas that don't seem to be working with the number badge: The size and light mode
airbyte-webapp/src/components/EntityTable/components/ConnectEntitiesCell.tsx
Outdated
Show resolved
Hide resolved
airbyte-webapp/src/components/EntityTable/components/ConnectEntitiesCell.tsx
Outdated
Show resolved
Hide resolved
I just noticed this was a draft. Whoops. |
@edmundito Thank you for the comments nevertheless! |
|
||
interface NumberBadgeProps { | ||
value: number; | ||
color?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be typed so we know which value we expect:
color?: string; | |
color?: "green" | "red" | "blue" | "default"; |
Also since the lack of the value has currently a darkBlue color, we should make sure there's a way to specify that as well via an explicit value (i.e. default
in this case), so the logic for the colors below also needs adjustments to handle this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timroes I'll rename the darkBlue
to default
- it's so faded it looks like grey and I think the name is confusing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested some changes about code and some minor issue. Overall looks good to me
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
value: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should give this a number by default, so the storybook doesn't just render an empty circle by default.
.circle { | ||
height: 20px; | ||
width: 20px; | ||
min-width: 20px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no need for the min-width, since we're already setting the width explicitaly to 20px.
Ignore this, instead see my comment above about making this work with longer numbers as well.
@use "../../../scss/colors"; | ||
@use "../../../scss/fonts"; | ||
|
||
.circle { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the number in the circle is not really centered:
We can solve this by adding:
display: flex;
justify-content: center;
align-items: center;
line-height: normal;
to the .circle class here. We need the line-height
because we're using this component in some cases where the parent sets a custom line-height, which would mess up the vertical centering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition I'd suggest we try making this component also work if there are longer numbers in it, which would require the following changes:
width: fit-content;
min-width: 20px;
border-radius: 10px;
padding: 0 4px;
font-weight: 500; | ||
font-size: 10px; | ||
color: colors.$white; | ||
padding: 3px 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the changes mentioned above to center the number, the padding
isn't having any effect anymore and should be removed.
min-width: 20px; | ||
border-radius: 50%; | ||
text-align: center; | ||
margin-right: 6px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want the margin-right
on this component. This is meant in a place this is used to keep distance from another element. The place where this is used should apply this and not the component itself, since it does not really have any idea about the actual surroundings where this is used.
The ConnectEntitiesCell
already sets a margin on this component anyway, in the DiffIconBlock
we can increase the gap
property on the parent flex box container to give more spacing between the numbers.
|
||
import styles from "./NumberBadge.module.scss"; | ||
|
||
interface NumberBadgeProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should accept className
as a property on all components and merge it with the other classnames for the wrapping div. Otherwise restyling, e.g. adding margin to this component in consuming places won't work.
|
||
export const NumberBadge: React.FC<NumberBadgeProps> = ({ value, color, className, "aria-label": ariaLabel }) => { | ||
const numberBadgeClassnames = classnames(styles.circle, className, { | ||
[styles.default]: !color, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[styles.default]: !color, | |
[styles.default]: !color || color === "default", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that the style will also apply when a user explicitaly set default
as a property value.
font-style: normal; | ||
font-weight: 500; | ||
font-size: 10px; | ||
color: colors.$white; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed, so the text colors from the above .circle.red
etc are actually having an affect.
font-family: fonts.$primary; | ||
font-style: normal; | ||
font-weight: 500; | ||
font-size: 10px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those styles could be moved to the circle
class above instead, so we wouldn't need this class at all.
|
||
&.red { | ||
background: colors.$red; | ||
color: colors.$white; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be colors.$black
to have proper contrast ratio between text and background:
✔️ https://color.review/check/000000-FF5E7B
❌ https://color.review/check/FFFFFF-FF5E7B
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL! That's such a cool website!
|
||
&.green { | ||
background: colors.$green; | ||
color: colors.$white; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be colors.$black
to have proper contrast ratio between text and background:
✔️ https://color.review/check/000000-67DAE1
❌ https://color.review/check/FFFFFF-67DAE1
|
||
&.green { | ||
background: colors.$green; | ||
color: colors.$white; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be colors.$black
to have proper contrast ratio between text and background:
✔️ https://color.review/check/000000-67DAE1
❌ https://color.review/check/FFFFFF-67DAE1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested Story book component and connector listing table locally (Chrome Linux). Works all as expected. Code LGTM
* 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.
What
ImageBlock
component into two, and createsNumberBadge
component.Recommended reading order
x.java
🚨 User Impact 🚨
No breaking changes.
Pre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changesTests
Unit
Put your unit tests output here.
Integration
Put your integration tests output here.
Acceptance
Put your acceptance tests output here.