Skip to content

Commit a334a75

Browse files
authored
fix(block): removes extra loading indicator (#7239)
**Related Issue:** #6485 ## Summary `calcite-block header` had two loading indicators. This removes the extra `calcite-loader` from the right end, and places it as an option in `icon-slot`,`statusIcons: valid or invalid` as well as `controls` now appear regardless of `loading` state.
1 parent bf0ff67 commit a334a75

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

packages/calcite-components/src/components/block/block.e2e.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,10 @@ describe("calcite-block", () => {
252252
expect(headerIconEle).toBeNull();
253253

254254
const statusIcon = await page.find(`calcite-block >>> .${CSS.statusIcon}`);
255-
const loadingIcon = await page.find(`calcite-block >>> .${CSS.loading}`);
256-
expect(statusIcon).not.toBeNull();
257-
expect(loadingIcon).not.toBeNull();
255+
const loader = await page.find(`calcite-block >>> calcite-loader`);
256+
257+
expect(statusIcon).toBeNull();
258+
expect(loader).not.toBeNull();
258259
});
259260

260261
it("allows users to slot in actions in a header menu", async () => {

packages/calcite-components/src/components/block/block.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ calcite-handle {
106106
color: theme("colors.danger");
107107
}
108108

109-
.status-icon.loading {
110-
animation: spin scaleDuration(--calcite-internal-animation-timing-slow, 2) linear infinite;
111-
}
112-
113109
@keyframes spin {
114110
0% {
115111
transform: rotate(0deg);

packages/calcite-components/src/components/block/block.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -237,23 +237,22 @@ export class Block
237237
}
238238

239239
renderIcon(): VNode[] {
240-
const { el, status } = this;
240+
const { el, loading, messages, status } = this;
241241

242-
const showingLoadingStatus = this.loading && !this.open;
243-
244-
const statusIcon = showingLoadingStatus ? ICONS.refresh : ICONS[status];
242+
const statusIcon = ICONS[status];
245243

246244
const hasIcon = getSlotted(el, SLOTS.icon) || statusIcon;
247245

248246
const iconEl = !statusIcon ? (
249247
<slot key="icon-slot" name={SLOTS.icon} />
248+
) : loading ? (
249+
<calcite-loader inline label={messages.loading} />
250250
) : (
251251
<calcite-icon
252252
class={{
253253
[CSS.statusIcon]: true,
254254
[CSS.valid]: status == "valid",
255-
[CSS.invalid]: status == "invalid",
256-
[CSS.loading]: showingLoadingStatus
255+
[CSS.invalid]: status == "invalid"
257256
}}
258257
icon={statusIcon}
259258
scale="m"
@@ -321,9 +320,7 @@ export class Block
321320
) : (
322321
headerContent
323322
)}
324-
{loading ? (
325-
<calcite-loader inline label={messages.loading} />
326-
) : hasControl ? (
323+
{hasControl ? (
327324
<div class={CSS.controlContainer}>
328325
<slot name={SLOTS.control} />
329326
</div>

packages/calcite-components/src/components/block/resources.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ export const CSS = {
1414
description: "description",
1515
controlContainer: "control-container",
1616
valid: "valid",
17-
invalid: "invalid",
18-
loading: "loading"
17+
invalid: "invalid"
1918
};
2019

2120
export const TEXT = {
@@ -35,6 +34,5 @@ export const ICONS = {
3534
opened: "chevron-up",
3635
closed: "chevron-down",
3736
valid: "check-circle",
38-
invalid: "exclamation-mark-triangle",
39-
refresh: "refresh"
37+
invalid: "exclamation-mark-triangle"
4038
};

packages/calcite-components/src/components/interfaces.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ export type SelectionMode =
1919
| "multiple";
2020
export type Scale = "s" | "m" | "l";
2121
export type Status = "invalid" | "valid" | "idle";
22-
2322
export type Width = "auto" | "half" | "full";

0 commit comments

Comments
 (0)