Skip to content

Commit 022f618

Browse files
Shrinks99claude
andauthored
Update spinner colours & default variant (#77)
Co-authored-by: Claude <claude@users.noreply.github.com>
1 parent a5f37a8 commit 022f618

4 files changed

Lines changed: 66 additions & 46 deletions

File tree

‎packages/demo/src/content/components/spinner.mdx‎

Lines changed: 62 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,69 @@ heading: "Spinner"
55

66
import { Spinner } from "@eqtylab/equality";
77

8-
## Size Variants
8+
## Overview
99

10-
### Extra Small (xs)
10+
The Spinner component provides a visual loading indicator to communicate that content or an action is in progress. Use it when fetching data, submitting forms, or during any asynchronous operation where the user should wait.
1111

12-
<Spinner client:only="react" size="xs" />
12+
## Usage
1313

14-
### Small (sm)
14+
Import the component:
1515

16-
<Spinner client:only="react" size="sm" />
17-
18-
### Medium (md) - Default
19-
20-
<Spinner client:only="react" size="md" />
21-
22-
### Large (lg)
23-
24-
<Spinner client:only="react" size="lg" />
25-
26-
### Extra Large (xl)
27-
28-
<Spinner client:only="react" size="xl" />
29-
30-
## Color Variants
31-
32-
This component supports color variants using either the brand primary color or status options. Available variants are `primary` (brand primary color), `success`, `danger`, and `warning`. Use these to visually distinguish loading spinners according to your design needs.
33-
34-
The special `neutral` variant adapts the spinner to use the primary text color, automatically switching between light and dark themes according to your app's current appearance mode.
35-
36-
### Neutral
37-
38-
<Spinner client:only="react" variant="neutral" />
39-
40-
### Primary
41-
42-
<Spinner client:only="react" variant="primary" />
43-
44-
### Success
45-
46-
<Spinner client:only="react" variant="success" />
47-
48-
### Danger
49-
50-
<Spinner client:only="react" variant="danger" />
51-
52-
### Warning
53-
54-
<Spinner client:only="react" variant="warning" />
16+
```ts
17+
import { Spinner } from "@eqtylab/equality";
18+
```
19+
20+
Basic usage with default properties:
21+
22+
```tsx
23+
<Spinner />
24+
```
25+
26+
## Variants
27+
28+
### Size
29+
30+
The Spinner supports five size variants to fit different contexts, from inline indicators to full-page loading states.
31+
32+
<div style={{ display: "flex", alignItems: "center", gap: "1rem" }}>
33+
<Spinner client:only="react" size="xs" />
34+
<Spinner client:only="react" size="sm" />
35+
<Spinner client:only="react" size="md" />
36+
<Spinner client:only="react" size="lg" />
37+
<Spinner client:only="react" size="xl" />
38+
</div>
39+
40+
```tsx
41+
<Spinner size="xs" />
42+
<Spinner size="sm" />
43+
<Spinner size="md" />
44+
<Spinner size="lg" />
45+
<Spinner size="xl" />
46+
```
47+
48+
### Color
49+
50+
The Spinner supports color variants using either the brand primary color or status options.
51+
52+
<div style={{ display: "flex", alignItems: "center", gap: "1rem" }}>
53+
<Spinner client:only="react" variant="neutral" />
54+
<Spinner client:only="react" variant="primary" />
55+
<Spinner client:only="react" variant="success" />
56+
<Spinner client:only="react" variant="danger" />
57+
<Spinner client:only="react" variant="warning" />
58+
</div>
59+
60+
```tsx
61+
<Spinner variant="neutral" />
62+
<Spinner variant="primary" />
63+
<Spinner variant="success" />
64+
<Spinner variant="danger" />
65+
<Spinner variant="warning" />
66+
```
67+
68+
## Props
69+
70+
| Name | Description | Type | Default | Required |
71+
| --------- | ------------------------------------- | ---------------------------------------------------- | --------- | -------- |
72+
| `size` | Controls the size of the spinner | `xs`, `sm`, `md`, `lg`, `xl` | `md` | ❌ |
73+
| `variant` | Sets the color variant of the spinner | `neutral`, `primary`, `success`, `danger`, `warning` | `primary` | ❌ |

‎packages/ui/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@eqtylab/equality",
33
"description": "EQTYLab's component and token-based design system",
44
"homepage": "https://equality.eqtylab.io/",
5-
"version": "1.3.0",
5+
"version": "1.4.0",
66
"license": "Apache-2.0",
77
"keywords": [
88
"component library",
@@ -16,6 +16,7 @@
1616
"types": "./dist/index.d.ts",
1717
"exports": {
1818
".": {
19+
"development": "./src/index.ts",
1920
"types": "./dist/index.d.ts",
2021
"import": "./dist/index.js",
2122
"require": "./dist/index.cjs"

‎packages/ui/src/components/spinner/spinner.module.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313

1414
.spinner-background {
15-
@apply border-greyscale-800;
15+
@apply border-background-sunken;
1616
@apply rounded-full;
1717
@apply absolute inset-0;
1818
}

‎packages/ui/src/components/spinner/spinner.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface SpinnerProps {
66
variant?: 'neutral' | 'primary' | 'success' | 'danger' | 'warning';
77
}
88

9-
export const Spinner = ({ size = 'md', variant = 'neutral' }: SpinnerProps) => {
9+
export const Spinner = ({ size = 'md', variant = 'primary' }: SpinnerProps) => {
1010
return (
1111
<div className={styles['spinner-container']}>
1212
<div className={cn(styles['spinner'], styles[size], styles[variant])} />

0 commit comments

Comments
 (0)