Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c5d3c26
Creates loading spinner
TheSonOfThomp Oct 13, 2025
293a976
creates story
TheSonOfThomp Oct 13, 2025
fd282c2
lgids and test utils
TheSonOfThomp Oct 13, 2025
06ddb5b
Update README.md
TheSonOfThomp Oct 13, 2025
a4f7115
deprecate Spinner from loading-indicator
TheSonOfThomp Oct 13, 2025
9cf2b84
changesets
TheSonOfThomp Oct 13, 2025
b727ee4
Merge branch 'main' into at/LG-4735-lottie
TheSonOfThomp Oct 13, 2025
e314bac
Apply suggestion from @Copilot
TheSonOfThomp Oct 13, 2025
c7a862f
Apply suggestion from @Copilot
TheSonOfThomp Oct 13, 2025
a581abd
Apply suggestion from @Copilot
TheSonOfThomp Oct 13, 2025
87cae4c
mv story
TheSonOfThomp Oct 13, 2025
e14445c
update animation timing
TheSonOfThomp Oct 13, 2025
b21c458
replace loading spinner
TheSonOfThomp Oct 14, 2025
e74ce9b
adds test harnesses
TheSonOfThomp Oct 14, 2025
776b8e5
fix test references
TheSonOfThomp Oct 14, 2025
d317395
adds named exports
TheSonOfThomp Oct 14, 2025
9ef939a
changeset
TheSonOfThomp Oct 14, 2025
ab107a9
Update loading-spinner.md
TheSonOfThomp Oct 14, 2025
231f57d
Merge branch 'main' into at/LG-4735-lottie
TheSonOfThomp Oct 14, 2025
83ba26f
update rotation speed
TheSonOfThomp Oct 14, 2025
af2c0e2
Update README.md
TheSonOfThomp Oct 14, 2025
dbd79c3
Updates sizing to match Figma
TheSonOfThomp Oct 14, 2025
e3d6d2d
Merge branch 'main' into at/LG-4735-lottie
TheSonOfThomp Oct 14, 2025
d7a50d6
fixes
TheSonOfThomp Oct 15, 2025
fbe7354
Update loading-spinner.md
TheSonOfThomp Oct 15, 2025
64b2037
adds codemod
TheSonOfThomp Oct 14, 2025
238e407
update description comment
TheSonOfThomp Oct 14, 2025
16e789b
Update loading-spinner.md
TheSonOfThomp Oct 15, 2025
a4a8306
lint
TheSonOfThomp Oct 15, 2025
69cd014
Merge branch 'main' into lg-4735-spinner-codemod
TheSonOfThomp Oct 16, 2025
f0e89ba
Merge branch 'main' into lg-4735-spinner-codemod
TheSonOfThomp Oct 16, 2025
0cefce8
fixes xl tests
TheSonOfThomp Oct 16, 2025
468ef98
adds tree shake tests
TheSonOfThomp Oct 16, 2025
7887bf5
Merge branch 'main' into lg-4735-spinner-codemod
TheSonOfThomp Oct 16, 2025
a1190f1
Update tools/codemods/src/codemods/loading-spinner-v5/transform.ts
TheSonOfThomp Oct 16, 2025
8a3f7f6
Update tools/codemods/README.md
TheSonOfThomp Oct 16, 2025
559a7d8
fix treeshake test
TheSonOfThomp Oct 16, 2025
76e63a4
Merge branch 'lg-4735-spinner-codemod' of https://github.com/mongodb/…
TheSonOfThomp Oct 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/loading-spinner.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ Size.Small: 24px;
Size.Default: 48px;
Size.Large: 64px;
```
Run the codemod to auto-update this prop change
```bash
lg codemod loading-spinner-v5
```

- Removes `baseFontSize` prop
- Removes the explicit `description` prop.
These props will be _removed_ by the codemod, but the description will only be converted to a comment, and must be updated manually.
To add a description to the spinner, use the `Description` component from `@leafygreen-ui/typography` directly.
```tsx
<div>
<Spinner size="default" />
Expand Down
50 changes: 50 additions & 0 deletions tools/codemods/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,56 @@ import Copyable from '@leafygreen-ui/copyable';
<Tooltip justify="middle" renderMode="top-layer" />
```

### `loading-spinner-v5`

This codemod can be used to upgrade Spinner components to v5 of `@leafygreen-ui/loading-indicator`.

This codemod applies to the following package:

- `@leafygreen-ui/loading-indicator`

This codemod does the following:

1. Converts `displayOption` prop to `size` prop with appropriate value mapping
2. Removes `description` prop and adds guidance comment
3. Removes `baseFontSize` prop if present

```shell
pnpm lg codemod loading-spinner-v5 <path>
```

**Before**:

```tsx
import { Spinner } from '@leafygreen-ui/loading-indicator';

<Spinner
displayOption="default-vertical"
description="Loading data..."
darkMode={true}
/>
<Spinner
displayOption="large-vertical"
description="Processing..."
baseFontSize={16}
/>
```

**After**:

```tsx
import { Spinner } from '@leafygreen-ui/loading-indicator';

/* 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} />;

/* 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" />;
```

### `tabs-v17`

This codemod can be used to get started in upgrading LG `Tabs` instances to v17 of `@leafygreen-ui/tabs`.
Expand Down
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>
);
}
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';
Copy link
Collaborator

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?

Copy link
Collaborator Author

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


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>
);
}
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>
);
}
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>
);
}
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>
);
}
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>
);
}
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>
);
}
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>
);
}
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>
);
}
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>
);
}
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,
});
}
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>
);
}
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>
);
}
Loading
Loading