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

🪟 🔧 Adds new Button component #16604

Merged
merged 39 commits into from
Sep 28, 2022
Merged

Conversation

YatsukBogdan1
Copy link
Contributor

What

Closes #14847
Closes #15792

How

I have refactored the existing Button component to match the new design, and also updated some component props according to Figma

@YatsukBogdan1 YatsukBogdan1 requested a review from a team as a code owner September 12, 2022 17:53
@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Sep 12, 2022
@YatsukBogdan1
Copy link
Contributor Author

old PR #15720

@krishnaglick
Copy link
Contributor

Can you reply to comments on the previous PR when you've addressed the issues?

@YatsukBogdan1
Copy link
Contributor Author

Can you reply to comments on the previous PR when you've addressed the issues?

done

@dizel852 dizel852 changed the title Adds new Button component 🪟 🔧 Adds new Button component Sep 12, 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.

Comments on the button props. I also noticed that the storybook is gone. Could you create a new storybook for the button?

export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
buttonRef?: MutableRefObject<HTMLButtonElement | null>;
Copy link
Contributor

Choose a reason for hiding this comment

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

forwardRef could be used to forward the button ref instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

# Conflicts:
#	airbyte-webapp/src/packages/cloud/views/workspaces/WorkspacesPage/components/WorkspacesControl.tsx
#	airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/components/StatusView.tsx
#	airbyte-webapp/src/pages/OnboardingPage/components/VideoItem/components/ShowVideo.tsx
@dizel852
Copy link
Contributor

Tiny 🐛
image

@dizel852
Copy link
Contributor

image

# Conflicts:
#	airbyte-webapp/src/components/base/Button/LoadingButton.tsx
…es to native button component; Fixes style in some places for button container; Removes unnecessary files
# Conflicts:
#	airbyte-webapp/src/views/Feedback/SyncCompletedModal/components/ModalBody.tsx
font-size: 11px;
line-height: 12px;
opacity: 0.4;
pointer-events: all;
Copy link
Collaborator

Choose a reason for hiding this comment

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

❓ Why do we need the pointer-events: all here?

align-items: center;
justify-content: center;
min-width: 18px;
font-size: 11px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The button does not have text in it. What for are we setting the font-size value?

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 about SortButton (two comments below the same). earlier we used a base button component that only showed icon inside corresponding with sort order. still, for me, the better solution here is to make the table header clickable and get rid of the <Button /> component here. in this case, I don't need to make some magic with the base component, to make it look good, and also it will be easier for users to use sort, without the need to hit precisely small sorting button. what do you think?

line-height: 12px;
opacity: 0.4;
pointer-events: all;
background: none !important;
Copy link
Collaborator

Choose a reason for hiding this comment

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

❓ Is the !important here really needed? What style are we trying to overwrite with this?

@dizel852
Copy link
Contributor

One more tiny 🐛
Before changes:
Screenshot at Sep 15 12-58-55

After changes:
Screenshot at Sep 15 12-58-41

Copy link
Contributor

@dizel852 dizel852 left a comment

Choose a reason for hiding this comment

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

Approved

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.

We're almost there... I did some testing and noted some issues that I found.

}

&.typeSecondary {
background-color: colors.$white;
Copy link
Contributor

Choose a reason for hiding this comment

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

Secondary should have no background color assigned. In the cards it looks white, but outside of the card it takes the background color.

</LoadingButton>
<Button as="a" target="_blank" href={config.links.contactSales}>
</Button>
<Button size="lg" onClick={() => window.open(config.links.contactSales, "_blank")}>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if the button is supposed to look larger than the other, but here's what I see:

image

Comment on lines 27 to 40
<Button
type="button"
iconOnly
arial-label={formatMessage({ id: "form.edit" })}
onClick={() => onEdit(id)}
disabled={disabled}
>
<PencilIcon />
</Button>
icon={<PencilIcon />}
/>
<Button
type="button"
iconOnly
aria-label={formatMessage({ id: "form.delete" })}
onClick={() => onRemove(id)}
disabled={disabled}
>
<CrossIcon />
</Button>
icon={<CrossIcon />}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

These are missing a variant and they are too large:
image

This is what they should look like:
image

Comment on lines 48 to 56
<Button
className={styles.updateButton}
onClick={onUpdate}
isLoading={isLoading}
wasActive={hasSuccess}
icon={hasSuccess ? undefined : <TryArrow icon={faRedoAlt} />}
>
{hasSuccess ? <FormattedMessage id="admin.upgraded" /> : <FormattedMessage id="admin.upgradeAll" />}
</Button>
Copy link
Contributor

Choose a reason for hiding this comment

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

The buttons mismatch on this page:
Screen Shot 2022-09-22 at 15 56 05

@@ -106,13 +106,13 @@ const VersionCell: React.FC<IProps> = ({ id, version, onChange, feedback, curren
</InputField>
)}
</Field>
<LoadingButton
<Button
Copy link
Contributor

Choose a reason for hiding this comment

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

This button maybe needs to be smaller. Also this is what happens when I click on the button, it moves to the next line:
Screen Shot 2022-09-22 at 15 57 25

import React from "react";

type ButtonSize = "xs" | "sm" | "lg";
type ButtonVariant = "primary" | "secondary" | "danger" | "light" | "noStroke";
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand that the name in the figma is no_stroke but maybe we can give it a better name. How about "clear" ?

# Conflicts:
#	airbyte-webapp/src/components/CreateConnectionContent/components/TryAfterErrorBlock.module.scss
#	airbyte-webapp/src/components/CreateConnectionContent/components/TryAfterErrorBlock.tsx
#	airbyte-webapp/src/components/EmptyResourceListView/EmptyResourceListView.tsx
#	airbyte-webapp/src/locales/en.json
#	airbyte-webapp/src/pages/OnboardingPage/components/ProgressBlock.tsx
#	airbyte-webapp/src/views/Connector/ServiceForm/components/FrequentlyUsedDestinations/__snapshots__/FrequentlyUsedDestinations.test.tsx.snap
#	airbyte-webapp/src/views/Connector/ServiceForm/components/StartWithDestination/__snapshots__/StartWithDestination.test.tsx.snap
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.

Noticed one thing while testing in the code and left a comment.

The styles for a couple of areas need to be adjusted:

  1. The array of objects editor needs the paddings and button gaps updated to accommodate the new size of the buttons. I think the good thing about the button size is that they are easier to click so what needs to happen is to reduce the padding and the gap between them so they closely resemble the design.

Screen Shot 2022-09-26 at 12 24 03

Figma:
https://www.figma.com/file/etaOkOsnXMoKwbfhCD71kw/WEB-APP-%E2%9A%A0%EF%B8%8F%E2%9A%A0%EF%B8%8F-OLD-SCREENS---DO-NOT-IMPLEMENT-%E2%9A%A0%EF%B8%8F%E2%9A%A0%EF%B8%8F?node-id=34996%3A194795

  1. The "Upgrade All" button is off by 1px. It looks like there is a div around it that may cause this to happen. Would it be possible to fix it?
    Screen Shot 2022-09-26 at 12 19 34

type="submit"
disabled={(isSubmitting || !dirty) && !isConnectorUpdateable}
>
<Button size="xs" isLoading type="submit" disabled={(isSubmitting || !dirty) && !isConnectorUpdateable}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the isLoading value is missing here so the button is always loading.

# Conflicts:
#	airbyte-webapp/src/components/EntityTable/components/StatusCell.tsx
#	airbyte-webapp/src/components/ui/Toast/SingletonCard.module.scss
#	airbyte-webapp/src/components/ui/Toast/Toast.tsx
#	airbyte-webapp/src/views/Connector/ServiceForm/components/FrequentlyUsedDestinations/__snapshots__/FrequentlyUsedDestinations.test.tsx.snap
#	airbyte-webapp/src/views/Connector/ServiceForm/components/StartWithDestination/__snapshots__/StartWithDestination.test.tsx.snap
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.

Tested both OSS and cloud and all buttons look good.

I did spot one more little issue with the gaps in one of the connector fields, but this can be fixed in a separate PR. See how the buttons don't have between the input or each other.
Screen Shot 2022-09-27 at 11 42 12

# Conflicts:
#	airbyte-webapp/src/packages/cloud/views/users/InviteUsersModal/InviteUsersModal.tsx
#	airbyte-webapp/src/packages/cloud/views/users/UsersSettingsView/UsersSettingsView.tsx
#	airbyte-webapp/src/views/Connection/CatalogDiffModal/CatalogDiffModal.tsx
@YatsukBogdan1 YatsukBogdan1 merged commit ed8186e into master Sep 28, 2022
@YatsukBogdan1 YatsukBogdan1 deleted the byatsuk/new-button-component branch September 28, 2022 11:01
robbinhan pushed a commit to robbinhan/airbyte that referenced this pull request Sep 29, 2022
* Add button component

* Fixes comments on PR

* Fixes style for old components

* Fixes more style for old components

* Update link usage of button

* Fixes styles cascade

* Fixes ref usage for buttons

* Updates customStyles into className; Fixes error passing all properties to native button component; Fixes style in some places for button container; Removes unnecessary files

* Fixes loading state for button; Adds storybook Button with different states

* Fixes router issue; Fixes styles

* Fixes SortButton; Fixes password eye button

* Fixes comments

* Update test snapshots

* Fix plus icon; Fixes connection error button style

* Fix buttons style; Updates variant noStroke -> clear

* Fix version cell button

* Update snapshots

* Updates snapshots

* Fixes settings button styles; Fixes editor row styles; Fixes isLoading property
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
* Add button component

* Fixes comments on PR

* Fixes style for old components

* Fixes more style for old components

* Update link usage of button

* Fixes styles cascade

* Fixes ref usage for buttons

* Updates customStyles into className; Fixes error passing all properties to native button component; Fixes style in some places for button container; Removes unnecessary files

* Fixes loading state for button; Adds storybook Button with different states

* Fixes router issue; Fixes styles

* Fixes SortButton; Fixes password eye button

* Fixes comments

* Update test snapshots

* Fix plus icon; Fixes connection error button style

* Fix buttons style; Updates variant noStroke -> clear

* Fix version cell button

* Update snapshots

* Updates snapshots

* Fixes settings button styles; Fixes editor row styles; Fixes isLoading property
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
5 participants