diff --git a/packages/calcite-components/src/components/block/block.stories.ts b/packages/calcite-components/src/components/block/block.stories.ts index b5664b844dd..7d797261de4 100644 --- a/packages/calcite-components/src/components/block/block.stories.ts +++ b/packages/calcite-components/src/components/block/block.stories.ts @@ -215,3 +215,31 @@ export const contentSpacing_TestOnly = (): string =>
Some text that has padding built in
`; + +export const loadingWithSlottedIcon_TestOnly = (): string => + html` + + + +
Use layer effects sparingly
+
+
+ `; + +export const loadingWithNoStatusNorSlottedIcon_TestOnly = (): string => + html` + + +
Use layer effects sparingly
+
+
+ `; + +export const loadingWithStatusIcon_TestOnly = (): string => + html` + + + + + + `; diff --git a/packages/calcite-components/src/components/block/block.tsx b/packages/calcite-components/src/components/block/block.tsx index bc1f5e359e2..de256a0ecc9 100644 --- a/packages/calcite-components/src/components/block/block.tsx +++ b/packages/calcite-components/src/components/block/block.tsx @@ -237,29 +237,31 @@ export class Block } renderIcon(): VNode[] { - const { el, loading, messages, status } = this; - - const statusIcon = ICONS[status]; - - const hasIcon = getSlotted(el, SLOTS.icon) || statusIcon; - - const iconEl = !statusIcon ? ( - - ) : loading ? ( - - ) : ( - - ); + const { loading, messages, status } = this; + + const hasSlottedIcon = !!getSlotted(this.el, SLOTS.icon); - return hasIcon ?
{iconEl}
: null; + return loading ? ( +
+ +
+ ) : !!status ? ( +
+ +
+ ) : hasSlottedIcon ? ( +
+ +
+ ) : null; } renderTitle(): VNode {