Skip to content

Commit

Permalink
feat(components): migrate LoadingButton to TypeScript (#584)
Browse files Browse the repository at this point in the history
* feat(components): migrate Spinner to TypeScript

* feat(components): migrate LoadingButton to TypeScript

* fix(components): improve accessibility

BREAKING CHANGE:
The LoadingButton's exit animations have been removed. An action's success or error result should be communicated outside the button.
  • Loading branch information
connor-baer authored May 5, 2020
1 parent 306e4d0 commit c96c851
Show file tree
Hide file tree
Showing 37 changed files with 838 additions and 3,066 deletions.
542 changes: 150 additions & 392 deletions src/__snapshots__/storyshots.spec.js.snap

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/components/Button/Button.docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ with a primary button for the expected action and a secondary button on its left

## LoadingButton

When the button's action is inputting/saving information or it takes more than 3 seconds to take the user to the next step/page, you can indicate a loading state with `LoadingButton`, as well as visually notify the user of success or an error after loading. You should only use it on primary buttons.
When the button's action is inputting/saving information or it takes more than 3 seconds to take the user to the next step/page, you can indicate a loading state with `LoadingButton`.

<Story id="components-button-loadingbutton--base" />
<Story id="components-button-loadingbutton--success" />
<Story id="components-button-loadingbutton--error" />
<Props of={LoadingButton} />
1 change: 1 addition & 0 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const baseStyles = ({ theme }: StyleProps) => css`
border-radius: ${theme.borderRadius.giga};
border-width: ${BORDER_WIDTH};
border-style: solid;
transition: opacity ${theme.transitions.default};
&:focus {
${focusOutline({ theme })};
Expand Down
16 changes: 16 additions & 0 deletions src/components/Button/__snapshots__/Button.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ exports[`Button styles should render a disabled button 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down Expand Up @@ -174,6 +176,8 @@ exports[`Button styles should render a giga button 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down Expand Up @@ -239,6 +243,8 @@ exports[`Button styles should render a kilo button 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down Expand Up @@ -304,6 +310,8 @@ exports[`Button styles should render a mega button 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down Expand Up @@ -369,6 +377,8 @@ exports[`Button styles should render a primary button by default 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down Expand Up @@ -434,6 +444,8 @@ exports[`Button styles should render a secondary button 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #FFFFFF;
border-color: #9DA7B1;
color: #323E49;
Expand Down Expand Up @@ -499,6 +511,8 @@ exports[`Button styles should render a stretched button 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down Expand Up @@ -565,6 +579,8 @@ exports[`Button styles should render a tertiary button 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: transparent;
border-color: transparent;
color: #3388FF;
Expand Down
65 changes: 0 additions & 65 deletions src/components/Button/constants.ts

This file was deleted.

8 changes: 8 additions & 0 deletions src/components/Carousel/__snapshots__/Carousel.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ exports[`Carousel styles should render with children as a function 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down Expand Up @@ -856,6 +858,8 @@ exports[`Carousel styles should render with children as a node 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down Expand Up @@ -1378,6 +1382,8 @@ exports[`Carousel styles should render with default paused styles 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down Expand Up @@ -1931,6 +1937,8 @@ exports[`Carousel styles should render with default styles 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ exports[`Buttons styles should render with default styles 1`] = `
border-radius: 5px;
border-width: 1px;
border-style: solid;
-webkit-transition: opacity 200ms ease-in-out;
transition: opacity 200ms ease-in-out;
background-color: #3388FF;
border-color: #3388FF;
color: #FFFFFF;
Expand Down
136 changes: 0 additions & 136 deletions src/components/LoadingButton/LoadingButton.js

This file was deleted.

Loading

0 comments on commit c96c851

Please sign in to comment.