Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/components/ActionButton/ActionButton.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import classNames from "classnames";
import React, { MouseEventHandler, useEffect, useRef, useState } from "react";
import type { ButtonHTMLAttributes, ReactNode } from "react";
import type { ReactNode } from "react";

import type { ButtonProps } from "../Button";
import Icon from "../Icon";

import type { ClassName, PropsWithSpread } from "types";
import Button from "../Button";

export const LOADER_MIN_DURATION = 400; // minimium duration (ms) loader displays
export const SUCCESS_DURATION = 2000; // duration (ms) success tick is displayed
Expand Down Expand Up @@ -51,7 +52,7 @@

success?: boolean;
},
ButtonHTMLAttributes<HTMLButtonElement>
ButtonProps
>;

/**
Expand Down Expand Up @@ -172,17 +173,17 @@
// forwardRef which is not currently supported by components that use
// typescript generics.
return (
<button
<Button
className={buttonClasses}
ref={ref}
onClick={isDisabled ? onClickDisabled : onClick}
Comment on lines +176 to 179
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that ActionButton renders <Button>, the appearance ? \p-button--${appearance}` : "p-button"class inbuttonClassescombines withButton’s own default p-buttonclass (sinceappearanceisn’t passed through), changing the rendered class list vs before (e.g.p-button p-button--negative). Pass appearance={appearance}toButtonand remove thep-button...portion frombuttonClassesto keep styling consistent with theButton` component.

Copilot uses AI. Check for mistakes.
aria-disabled={isDisabled || undefined}
style={
height && width
? {
height: `${height}px`,
width: `${width}px`,
}
height: `${height}px`,

Check failure on line 184 in src/components/ActionButton/ActionButton.tsx

View workflow job for this annotation

GitHub Actions / Lint, build and test

Insert `··`
width: `${width}px`,

Check failure on line 185 in src/components/ActionButton/ActionButton.tsx

View workflow job for this annotation

GitHub Actions / Lint, build and test

Insert `··`
}

Check failure on line 186 in src/components/ActionButton/ActionButton.tsx

View workflow job for this annotation

GitHub Actions / Lint, build and test

Insert `··`
: undefined
}
{...buttonProps}
Expand All @@ -197,7 +198,7 @@
) : (
children
)}
</button>
</Button>
);
};

Expand Down
5 changes: 5 additions & 0 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
ElementType,
MouseEventHandler,
ReactNode,
Ref,
} from "react";

import type { ClassName, ValueOf } from "types";
Expand Down Expand Up @@ -64,6 +65,10 @@ export type Props<P = null> = {
* Whether the button should be small.
*/
small?: boolean;
/**
* A ref to the button.
*/
ref?: Ref<HTMLButtonElement>;
} & (Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onClick"> | P);
Comment on lines +68 to 72
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a ref prop to Button doesn’t actually make <Button ref={...} /> work: React treats ref as a special attribute, so it won’t be delivered via props to this function component (and will emit a runtime warning). To support refs, convert Button to React.forwardRef and pass the forwarded ref to the underlying element (and remove ref from the regular props shape / use RefAttributes).

Copilot uses AI. Check for mistakes.

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

import ConfirmationModal from "./ConfirmationModal";
import Input from "../Input";
import Icon from "components/Icon";

const doNothing = () => {};
const doNothing = () => { };

Check failure on line 9 in src/components/ConfirmationModal/ConfirmationModal.stories.tsx

View workflow job for this annotation

GitHub Actions / Lint, build and test

Delete `·`
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting: the codebase’s stories consistently use const doNothing = () => {}; (e.g. src/components/ConfirmationButton/ConfirmationButton.stories.tsx:8). Please remove the extra spaces (() => { };) to match existing conventions.

Suggested change
const doNothing = () => { };
const doNothing = () => {};

Copilot uses AI. Check for mistakes.

const meta: Meta<typeof ConfirmationModal> = {
component: ConfirmationModal,
Expand All @@ -30,9 +31,12 @@
{modalOpen ? (
<ConfirmationModal
title="Confirm delete"
confirmButtonLabel="Delete"
confirmButtonLabel={<><Icon name="delete" light /><span>Delete</span></>}

Check failure on line 34 in src/components/ConfirmationModal/ConfirmationModal.stories.tsx

View workflow job for this annotation

GitHub Actions / Lint, build and test

Replace `<><Icon·name="delete"·light·/><span>Delete</span></>` with `⏎··············<>⏎················<Icon·name="delete"·light·/>⏎················<span>Delete</span>⏎··············</>⏎············`
onConfirm={doNothing}
close={closeHandler}
confirmButtonProps={{
hasIcon: true

Check failure on line 38 in src/components/ConfirmationModal/ConfirmationModal.stories.tsx

View workflow job for this annotation

GitHub Actions / Lint, build and test

Insert `,`
}}
>
<p>
This will permanently delete the user "Simon".
Expand Down
Loading