From 405aacf2bc6a35f906965b740d7ab2f0bb265cba Mon Sep 17 00:00:00 2001
From: Natalie Pina <34781875+nataliepina@users.noreply.github.com>
Date: Tue, 20 Dec 2022 13:40:46 -0600
Subject: [PATCH] feat: inlineloadingindicator custom props (#911)
Introduces custom color, size, and data-cy props.
---
.../components/InlineLoadingIndicator.tsx | 25 +++++++-
.../InlineLoadingIndicator.stories.tsx | 61 ++++++++++++-------
.../loadingIndicator.test.tsx.snap | 2 +-
3 files changed, 61 insertions(+), 27 deletions(-)
diff --git a/packages/loadingIndicator/components/InlineLoadingIndicator.tsx b/packages/loadingIndicator/components/InlineLoadingIndicator.tsx
index 3ae53ec74..e1f1e3a30 100644
--- a/packages/loadingIndicator/components/InlineLoadingIndicator.tsx
+++ b/packages/loadingIndicator/components/InlineLoadingIndicator.tsx
@@ -1,12 +1,31 @@
import * as React from "react";
import { Icon } from "../../icon";
import { SystemIcons } from "../../icons/dist/system-icons-enum";
+import { IconSize } from "../../shared/types/iconSize";
-const InlineLoadingIndicator = () => (
+const DEFAULT_ICON_SIZE: IconSize = "xs";
+
+export interface InlineLoadingIndicatorProps {
+ /**
+ * The fill color of the spinner.
+ */
+ color?: string;
+ /** Which icon size to use for the width and height of the icon. */
+ size?: IconSize;
+ /** Human-readable selector used for writing tests. */
+ "data-cy"?: string;
+}
+
+const InlineLoadingIndicator = ({
+ size = DEFAULT_ICON_SIZE,
+ "data-cy": dataCy = "inlineLoadingIndicator",
+ color = "inherit"
+}) => (
);
diff --git a/packages/loadingIndicator/stories/InlineLoadingIndicator.stories.tsx b/packages/loadingIndicator/stories/InlineLoadingIndicator.stories.tsx
index 8035e4194..49849333f 100644
--- a/packages/loadingIndicator/stories/InlineLoadingIndicator.stories.tsx
+++ b/packages/loadingIndicator/stories/InlineLoadingIndicator.stories.tsx
@@ -9,33 +9,48 @@ import {
} from "../../configurationmap";
import { InlineLoadingIndicator } from "..";
+import { spacingSizeValues } from "../../storybookHelpers/controlConstants";
export default {
title: "Feedback/Loading Indicators/Inline Loading Indicator",
- component: InlineLoadingIndicator
+ component: InlineLoadingIndicator,
+ argTypes: {
+ color: {
+ control: { type: "color" }
+ },
+ size: {
+ options: spacingSizeValues,
+ control: {
+ type: "select"
+ }
+ },
+ "data-cy": {
+ control: { disable: true }
+ }
+ }
} as Meta;
-const Template: Story = args => (
- <>
-
-
-
- Name
-
-
-
-
-
- Role
- UX Designer
-
-
- City
- San Francisco
-
-
-
- >
-);
+const Template: Story = args => ;
export const Default = Template.bind({});
+
+export const InlineWithinComponent = args => (
+
+
+
+ Name
+
+
+
+
+
+ Role
+ UX Designer
+
+
+ City
+ San Francisco
+
+
+
+);
diff --git a/packages/loadingIndicator/tests/__snapshots__/loadingIndicator.test.tsx.snap b/packages/loadingIndicator/tests/__snapshots__/loadingIndicator.test.tsx.snap
index ea6ded1f7..29c38372c 100644
--- a/packages/loadingIndicator/tests/__snapshots__/loadingIndicator.test.tsx.snap
+++ b/packages/loadingIndicator/tests/__snapshots__/loadingIndicator.test.tsx.snap
@@ -17,7 +17,7 @@ exports[`Loading indicators renders SectionLoadingIndicator 1`] = `