-
Notifications
You must be signed in to change notification settings - Fork 71
[LG-4735] Spinner codemod #3228
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
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
c5d3c26
Creates loading spinner
TheSonOfThomp 293a976
creates story
TheSonOfThomp fd282c2
lgids and test utils
TheSonOfThomp 06ddb5b
Update README.md
TheSonOfThomp a4f7115
deprecate Spinner from loading-indicator
TheSonOfThomp 9cf2b84
changesets
TheSonOfThomp b727ee4
Merge branch 'main' into at/LG-4735-lottie
TheSonOfThomp e314bac
Apply suggestion from @Copilot
TheSonOfThomp c7a862f
Apply suggestion from @Copilot
TheSonOfThomp a581abd
Apply suggestion from @Copilot
TheSonOfThomp 87cae4c
mv story
TheSonOfThomp e14445c
update animation timing
TheSonOfThomp b21c458
replace loading spinner
TheSonOfThomp e74ce9b
adds test harnesses
TheSonOfThomp 776b8e5
fix test references
TheSonOfThomp d317395
adds named exports
TheSonOfThomp 9ef939a
changeset
TheSonOfThomp ab107a9
Update loading-spinner.md
TheSonOfThomp 231f57d
Merge branch 'main' into at/LG-4735-lottie
TheSonOfThomp 83ba26f
update rotation speed
TheSonOfThomp af2c0e2
Update README.md
TheSonOfThomp dbd79c3
Updates sizing to match Figma
TheSonOfThomp e3d6d2d
Merge branch 'main' into at/LG-4735-lottie
TheSonOfThomp d7a50d6
fixes
TheSonOfThomp fbe7354
Update loading-spinner.md
TheSonOfThomp 64b2037
adds codemod
TheSonOfThomp 238e407
update description comment
TheSonOfThomp 16e789b
Update loading-spinner.md
TheSonOfThomp a4a8306
lint
TheSonOfThomp 69cd014
Merge branch 'main' into lg-4735-spinner-codemod
TheSonOfThomp f0e89ba
Merge branch 'main' into lg-4735-spinner-codemod
TheSonOfThomp 0cefce8
fixes xl tests
TheSonOfThomp 468ef98
adds tree shake tests
TheSonOfThomp 7887bf5
Merge branch 'main' into lg-4735-spinner-codemod
TheSonOfThomp a1190f1
Update tools/codemods/src/codemods/loading-spinner-v5/transform.ts
TheSonOfThomp 8a3f7f6
Update tools/codemods/README.md
TheSonOfThomp 559a7d8
fix treeshake test
TheSonOfThomp 76e63a4
Merge branch 'lg-4735-spinner-codemod' of https://github.com/mongodb/…
TheSonOfThomp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tools/codemods/src/codemods/loading-spinner-v5/tests/aliased-import.input.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Spinner as LGSpinner } from '@leafygreen-ui/loading-indicator'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| <LGSpinner displayOption="default-vertical" description="Loading..." /> | ||
| <LGSpinner displayOption="large-vertical" /> | ||
| </div> | ||
| ); | ||
| } |
14 changes: 14 additions & 0 deletions
14
tools/codemods/src/codemods/loading-spinner-v5/tests/aliased-import.output.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Spinner as LGSpinner } from '@leafygreen-ui/loading-indicator'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| {/* Previous description: "Loading..." */} | ||
| {/* TODO: The Spinner component no longer supports the `description` prop. Please render description text separately using the Typography component. */} | ||
| <LGSpinner size="default" /> | ||
| <LGSpinner size="large" /> | ||
| </div> | ||
| ); | ||
| } | ||
22 changes: 22 additions & 0 deletions
22
tools/codemods/src/codemods/loading-spinner-v5/tests/combined-props.input.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Spinner } from '@leafygreen-ui/loading-indicator'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| <Spinner | ||
| displayOption="default-vertical" | ||
| description="Loading data..." | ||
| darkMode={true} | ||
| className="my-spinner" | ||
| /> | ||
| <Spinner | ||
| displayOption="large-vertical" | ||
| description="Processing..." | ||
| baseFontSize={16} | ||
| colorOverride="#FF0000" | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
16 changes: 16 additions & 0 deletions
16
tools/codemods/src/codemods/loading-spinner-v5/tests/combined-props.output.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Spinner } from '@leafygreen-ui/loading-indicator'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| {/* Previous description: "Loading data..." */} | ||
| {/* TODO: The Spinner component no longer supports the `description` prop. Please render description text separately using the Typography component. */} | ||
| <Spinner size="default" darkMode={true} className="my-spinner" /> | ||
| {/* Previous description: "Processing..." */} | ||
| {/* TODO: The Spinner component no longer supports the `description` prop. Please render description text separately using the Typography component. */} | ||
| <Spinner size="large" colorOverride="#FF0000" /> | ||
| </div> | ||
| ); | ||
| } |
18 changes: 18 additions & 0 deletions
18
tools/codemods/src/codemods/loading-spinner-v5/tests/no-changes.input.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { PageLoader, Spinner } from '@leafygreen-ui/loading-indicator'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| <Spinner size="default" /> | ||
| <Spinner size="large" darkMode={true} /> | ||
| <Spinner /> | ||
| <PageLoader | ||
| baseFontSize={16} | ||
| description="Loading page..." | ||
| darkMode={true} | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
18 changes: 18 additions & 0 deletions
18
tools/codemods/src/codemods/loading-spinner-v5/tests/no-changes.output.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { PageLoader, Spinner } from '@leafygreen-ui/loading-indicator'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| <Spinner size="default" /> | ||
| <Spinner size="large" darkMode={true} /> | ||
| <Spinner /> | ||
| <PageLoader | ||
| baseFontSize={16} | ||
| description="Loading page..." | ||
| darkMode={true} | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
12 changes: 12 additions & 0 deletions
12
tools/codemods/src/codemods/loading-spinner-v5/tests/remove-description.input.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Spinner } from '@leafygreen-ui/loading-indicator'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| <Spinner description="Loading..." /> | ||
| <Spinner displayOption="large-vertical" description="Please wait" /> | ||
| </div> | ||
| ); | ||
| } |
16 changes: 16 additions & 0 deletions
16
tools/codemods/src/codemods/loading-spinner-v5/tests/remove-description.output.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Spinner } from '@leafygreen-ui/loading-indicator'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| {/* Previous description: "Loading..." */} | ||
| {/* TODO: The Spinner component no longer supports the `description` prop. Please render description text separately using the Typography component. */} | ||
| <Spinner /> | ||
| {/* Previous description: "Please wait" */} | ||
| {/* TODO: The Spinner component no longer supports the `description` prop. Please render description text separately using the Typography component. */} | ||
| <Spinner size="large" /> | ||
| </div> | ||
| ); | ||
| } |
14 changes: 14 additions & 0 deletions
14
.../codemods/src/codemods/loading-spinner-v5/tests/replace-displayOption-with-size.input.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Spinner } from '@leafygreen-ui/loading-indicator'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| <Spinner displayOption="default-vertical" /> | ||
| <Spinner displayOption="default-horizontal" /> | ||
| <Spinner displayOption="large-vertical" /> | ||
| <Spinner displayOption="xlarge-vertical" /> | ||
| </div> | ||
| ); | ||
| } |
14 changes: 14 additions & 0 deletions
14
...codemods/src/codemods/loading-spinner-v5/tests/replace-displayOption-with-size.output.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Spinner } from '@leafygreen-ui/loading-indicator'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| <Spinner size="default" /> | ||
| <Spinner size="default" /> | ||
| <Spinner size="large" /> | ||
| <Spinner size="large" /> | ||
| </div> | ||
| ); | ||
| } |
28 changes: 28 additions & 0 deletions
28
tools/codemods/src/codemods/loading-spinner-v5/tests/transform.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { transformTest } from '../../../utils/tests/transformTest'; | ||
|
|
||
| const transform = 'loading-spinner-v5'; | ||
|
|
||
| const tests = [ | ||
| { | ||
| name: 'replace-displayOption-with-size', | ||
| }, | ||
| { | ||
| name: 'remove-description', | ||
| }, | ||
| { | ||
| name: 'combined-props', | ||
| }, | ||
| { | ||
| name: 'aliased-import', | ||
| }, | ||
| { | ||
| name: 'no-changes', | ||
| }, | ||
| ]; | ||
|
|
||
| for (const test of tests) { | ||
| transformTest(__dirname, { | ||
| fixture: test.name, | ||
| transform, | ||
| }); | ||
| } |
12 changes: 12 additions & 0 deletions
12
tools/codemods/src/codemods/loading-spinner-v5/tests/tree-shaken-import.input.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Spinner } from '@leafygreen-ui/loading-indicator/spinner'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| <Spinner displayOption="default-vertical" description="Loading..." /> | ||
| <Spinner displayOption="large-vertical" /> | ||
| </div> | ||
| ); | ||
| } |
14 changes: 14 additions & 0 deletions
14
tools/codemods/src/codemods/loading-spinner-v5/tests/tree-shaken-import.output.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { Spinner } from '@leafygreen-ui/loading-indicator/spinner'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| {/* Previous description: "Loading..." */} | ||
| {/* TODO: The Spinner component no longer supports the `description` prop. Please render description text separately using the Typography component. */} | ||
| <Spinner size="default" /> | ||
| <Spinner size="large" /> | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we be using the treeshaken version in the outputs, or does that not make a difference?
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.
Don't think that makes a difference, but would be worth adding a test to make sure