-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Conversation
old PR #15720 |
Can you reply to comments on the previous PR when you've addressed the issues? |
done |
airbyte-webapp/src/packages/cloud/views/auth/LoginPage/LoginPage.tsx
Outdated
Show resolved
Hide resolved
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.
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>; |
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.
forwardRef
could be used to forward the button ref instead.
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.
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
# 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; |
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.
❓ Why do we need the pointer-events: all
here?
align-items: center; | ||
justify-content: center; | ||
min-width: 18px; | ||
font-size: 11px; |
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.
The button does not have text in it. What for are we setting the font-size
value?
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 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; |
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.
❓ Is the !important
here really needed? What style are we trying to overwrite with 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.
Approved
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're almost there... I did some testing and noted some issues that I found.
} | ||
|
||
&.typeSecondary { | ||
background-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.
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")}> |
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.
<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 />} | ||
/> |
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.
<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> |
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.
@@ -106,13 +106,13 @@ const VersionCell: React.FC<IProps> = ({ id, version, onChange, feedback, curren | |||
</InputField> | |||
)} | |||
</Field> | |||
<LoadingButton | |||
<Button |
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.
import React from "react"; | ||
|
||
type ButtonSize = "xs" | "sm" | "lg"; | ||
type ButtonVariant = "primary" | "secondary" | "danger" | "light" | "noStroke"; |
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 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
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.
Noticed one thing while testing in the code and left a comment.
The styles for a couple of areas need to be adjusted:
- 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.
type="submit" | ||
disabled={(isSubmitting || !dirty) && !isConnectorUpdateable} | ||
> | ||
<Button size="xs" isLoading type="submit" disabled={(isSubmitting || !dirty) && !isConnectorUpdateable}> |
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.
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
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.
# 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
* 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
* 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
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