Skip to content
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

Merged
merged 14 commits into from
Oct 21, 2022

Conversation

natalyjazzviolin
Copy link
Contributor

What

Recommended reading order

  1. x.java

🚨 User Impact 🚨

No breaking changes.

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here
Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub and connector version bumped by running the /publish command described here
Connector Generator
  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@natalyjazzviolin natalyjazzviolin requested a review from a team as a code owner September 30, 2022 20:11
@natalyjazzviolin natalyjazzviolin marked this pull request as draft September 30, 2022 20:11
@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Sep 30, 2022
Copy link
Contributor

@edmundito edmundito left a 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

@edmundito edmundito requested a review from timroes October 5, 2022 09:54
@edmundito
Copy link
Contributor

I just noticed this was a draft. Whoops.

@natalyjazzviolin
Copy link
Contributor Author

natalyjazzviolin commented Oct 7, 2022

I just noticed this was a draft. Whoops.

@edmundito Thank you for the comments nevertheless!

@natalyjazzviolin natalyjazzviolin marked this pull request as ready for review October 11, 2022 13:49

interface NumberBadgeProps {
value: number;
color?: string;
Copy link
Collaborator

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:

Suggested change
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.

Copy link
Contributor Author

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!

Copy link
Collaborator

@timroes timroes left a 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,
Copy link
Collaborator

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;
Copy link
Collaborator

@timroes timroes Oct 12, 2022

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 {
Copy link
Collaborator

@timroes timroes Oct 12, 2022

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:

screenshot-20221012-120219

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.

Copy link
Collaborator

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;
Copy link
Collaborator

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;
Copy link
Collaborator

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 {
Copy link
Collaborator

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.

@natalyjazzviolin natalyjazzviolin marked this pull request as draft October 14, 2022 21:23
@natalyjazzviolin natalyjazzviolin marked this pull request as ready for review October 17, 2022 12:41

export const NumberBadge: React.FC<NumberBadgeProps> = ({ value, color, className, "aria-label": ariaLabel }) => {
const numberBadgeClassnames = classnames(styles.circle, className, {
[styles.default]: !color,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[styles.default]: !color,
[styles.default]: !color || color === "default",

Copy link
Collaborator

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;
Copy link
Collaborator

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.

Comment on lines 38 to 41
font-family: fonts.$primary;
font-style: normal;
font-weight: 500;
font-size: 10px;
Copy link
Collaborator

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;
Copy link
Collaborator

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

Copy link
Contributor Author

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;
Copy link
Collaborator

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;
Copy link
Collaborator

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

Copy link
Collaborator

@timroes timroes left a 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

@natalyjazzviolin natalyjazzviolin merged commit 2e0fae4 into master Oct 21, 2022
@natalyjazzviolin natalyjazzviolin deleted the nataly-split-imageBlock branch October 21, 2022 13:39
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split circled number away from ImageBlock
3 participants