diff --git a/.changeset/fresh-dots-happen.md b/.changeset/fresh-dots-happen.md
new file mode 100644
index 0000000..05ad483
--- /dev/null
+++ b/.changeset/fresh-dots-happen.md
@@ -0,0 +1,5 @@
+---
+"@openfun/cunningham-react": patch
+---
+
+Apply disable style to disabled button link
diff --git a/packages/react/src/components/Button/_index.scss b/packages/react/src/components/Button/_index.scss
index b26aa2a..bd0eed4 100644
--- a/packages/react/src/components/Button/_index.scss
+++ b/packages/react/src/components/Button/_index.scss
@@ -32,7 +32,7 @@
border-color: currentColor;
}
- &:disabled {
+ &:disabled, &.c__button--disabled {
background-color: var(--c--theme--colors--greyscale-200);
color: var(--c--theme--colors--greyscale-600);
cursor: not-allowed;
diff --git a/packages/react/src/components/Button/index.spec.tsx b/packages/react/src/components/Button/index.spec.tsx
index 5f46e32..b715ea8 100644
--- a/packages/react/src/components/Button/index.spec.tsx
+++ b/packages/react/src/components/Button/index.spec.tsx
@@ -60,11 +60,22 @@ describe("", () => {
,
);
const button = screen.getByRole("button", { name: "Test button" });
+ expect(button).toHaveAttribute("disabled");
expect(handleClick).not.toBeCalled();
await act(async () => user.click(button));
expect(handleClick).not.toHaveBeenCalled();
});
+ it("renders disabled link", async () => {
+ render(
+ ,
+ );
+ const button = screen.getByRole("link", { name: "Test button link" });
+ expect(button.classList).toContain("c__button--disabled");
+ });
+
it("renders as link when href is used", () => {
render(
+
);
@@ -70,6 +71,15 @@ export const Disabled: Story = {
},
};
+export const LinkDisabled: Story = {
+ args: {
+ children: "Disabled",
+ color: "primary",
+ disabled: true,
+ href: "https://perdu.com",
+ },
+};
+
export const Danger: Story = {
args: {
children: "Danger",
diff --git a/packages/react/src/components/Button/index.tsx b/packages/react/src/components/Button/index.tsx
index 0ff2802..060dfc4 100644
--- a/packages/react/src/components/Button/index.tsx
+++ b/packages/react/src/components/Button/index.tsx
@@ -59,6 +59,9 @@ export const Button = ({
if (["primary-text", "tertiary-text"].includes(color)) {
classes.push("c__button--text");
}
+ if (props.href && props.disabled) {
+ classes.push("c__button--disabled");
+ }
const iconElement = {icon};
const tagName = props.href ? "a" : "button";
return createElement(