diff --git a/packages/react/src/components/Button/index.scss b/packages/react/src/components/Button/index.scss index 5959124..6da857c 100644 --- a/packages/react/src/components/Button/index.scss +++ b/packages/react/src/components/Button/index.scss @@ -12,6 +12,18 @@ font-size: var(--c--components--button--font-size); font-weight: var(--c--components--button--font-weight); + &--with-icon--left, &--with-icon--right { + gap: var(--c--theme--spacings--t); + } + + &--with-icon--left { + padding: 0 var(--c--theme--spacings--s) 0 var(--c--theme--spacings--t); + } + + &--with-icon--right { + padding: 0 var(--c--theme--spacings--t) 0 var(--c--theme--spacings--s); + } + &--primary { background-color: var(--c--theme--colors--primary-500); color: var(--c--theme--colors--primary-text); diff --git a/packages/react/src/components/Button/index.spec.tsx b/packages/react/src/components/Button/index.spec.tsx index 52f02a9..c322f08 100644 --- a/packages/react/src/components/Button/index.spec.tsx +++ b/packages/react/src/components/Button/index.spec.tsx @@ -12,6 +12,24 @@ describe("); + const button = screen.getByText("Test button"); + expect(button.classList.contains("c__button")).toBe(true); + expect(button.classList.contains("c__button--with-icon--left")).toBe(true); + }); + + it("renders with custom class when using right icon", () => { + render( + + ); + const button = screen.getByText("Test button"); + expect(button.classList.contains("c__button")).toBe(true); + expect(button.classList.contains("c__button--with-icon--right")).toBe(true); + }); + it("call onClick when click occurs", async () => { const user = userEvent.setup(); const handleClick = vi.fn(); diff --git a/packages/react/src/components/Button/index.stories.mdx b/packages/react/src/components/Button/index.stories.mdx index 3abe403..12dc759 100644 --- a/packages/react/src/components/Button/index.stories.mdx +++ b/packages/react/src/components/Button/index.stories.mdx @@ -22,6 +22,19 @@ The Cunningham Button behaves the same as the native html ` ); };