Skip to content

Commit a0bac96

Browse files
committed
align Spinner intent display with other components
1 parent abf9c05 commit a0bac96

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ This is a major release, and it might be not compatible with your current usage
4040
- managed via CSS custom properties
4141
- see `README.md` for inf about usage
4242
- `<Button />`
43-
- value `accent` was added for `intent` to align it with intent states of other components
43+
- `accent` value for `intent` was added to align property with other components
44+
- `<Spinner />`
45+
- `accent` value for `intent` was added to align property with other components
46+
- `elevated` property can be used to highlight the spinner, currently the `intent="accent"` display is used
4447
- SCSS color functions
4548
- `eccgui-color-var`: returns a var of a custom property used for palette color
4649
- `eccgui-color-mix`: mix 2 colors in `srgb`, works with all types of color values and CSS custom properties
@@ -105,7 +108,9 @@ This is a major release, and it might be not compatible with your current usage
105108
- property names returned by `getCOlorConfiguration` were changed to kebab case because they are originally defined via CSS custom properties
106109
- e.g. `graphNode` is now `eccgui-graph-node` and `graphNodeBright` is `eccgui-graph-node-bright`
107110
- `<Button />` and `<IconButton />`
108-
- we aligned the `intent` display with other components, `intent="primary"` is now `intent="accent"`, in most cases it may better to use `affirmative={true}` or `elevated={true}` instead of primary/accent intent
111+
- `intent` display was aligned with other components, `intent="primary"` is now `intent="accent"`, in most cases it may be better to use `affirmative={true}` or `elevated={true}` instead of primary/accent intent
112+
- `<Spinner />`
113+
- `intent` display was aligned with other components, `intent="primary"` is now `intent="accent"`, in most cases it may be better to use `elevated={true}` instead of using intent
109114

110115
### Deprecated
111116

src/components/Spinner/Spinner.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import Color from "color";
99

1010
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
1111

12+
import { ButtonProps } from "./../Button/Button";
13+
1214
type SpinnerPosition = "local" | "inline" | "global";
1315
type SpinnerSize = "tiny" | "small" | "medium" | "large" | "xlarge" | "inherit";
1416
type SpinnerStroke = "thin" | "medium" | "bold";
15-
type Intent = "primary" | "success" | "warning" | "danger";
1617

1718
/** A spinner that is either displayed globally or locally. */
1819
export interface SpinnerProps extends Omit<BlueprintSpinnerProps, "size" | "intent" | "color"> {
@@ -22,9 +23,16 @@ export interface SpinnerProps extends Omit<BlueprintSpinnerProps, "size" | "inte
2223
*/
2324
color?: Color | string | "inherit";
2425
/**
25-
* Intent state of the field item.
26+
* Intent state of the spinner.
27+
* When used the spinner is colored.
28+
* Property overwrites `elevated` setting.
29+
*/
30+
intent?: ButtonProps["intent"];
31+
/**
32+
* Highlight the spinner.
33+
* It is displayed with accent color intent.
2634
*/
27-
intent?: Intent;
35+
elevated?: boolean;
2836
/**
2937
* Additional CSS class names.
3038
*/
@@ -67,6 +75,7 @@ export const Spinner = ({
6775
className = "",
6876
color = "inherit",
6977
intent,
78+
elevated,
7079
position = "local",
7180
size,
7281
stroke,
@@ -119,6 +128,7 @@ export const Spinner = ({
119128
className={
120129
`${eccgui}-spinner` +
121130
` ${eccgui}-spinner--position-${position}` +
131+
(elevated ? ` ${eccgui}-spinner--intent-accent` : "") +
122132
(intent ? ` ${eccgui}-spinner--intent-${intent}` : "") +
123133
` ${eccgui}-spinner--size-${spinnerSize}` +
124134
(showLocalBackdrop ? ` ${eccgui}-spinner--localbackdrop` : "") +

src/components/Spinner/Stories/spinner.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
color: { control: "color" },
1111
intent: {
1212
...helpersArgTypes.exampleIntent,
13-
options: ["UNDEFINED", "primary", "success", "warning", "danger", "none"],
13+
options: ["UNDEFINED", "primary", "accent", "success", "warning", "danger", "none"],
1414
},
1515
position: { control: "radio", options: ["local", "inline", "global"] },
1616
size: { control: "radio", options: ["tiny", "small", "medium", "large", "xlarge", "inherit"] },

src/components/Spinner/spinner.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ span.#{$eccgui}-spinner {
2929
color: inherit;
3030
}
3131

32-
.#{$eccgui}-spinner--intent-primary {
32+
.#{$eccgui}-spinner--intent-accent {
3333
color: $eccgui-color-accent;
3434
}
3535

36+
.#{$eccgui}-spinner--intent-primary {
37+
color: $eccgui-color-primary;
38+
}
39+
3640
.#{$eccgui}-spinner--intent-success {
3741
color: $eccgui-color-success-text;
3842
}

0 commit comments

Comments
 (0)