Skip to content

Commit 504a7eb

Browse files
committed
feat: add prop for data test id
1 parent 4c50772 commit 504a7eb

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/Shared/Components/Button/Button.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const Button = ({
6868
showTippy,
6969
tippyContent,
7070
type = 'button',
71+
dataTestId,
7172
...props
7273
}: ButtonProps) => {
7374
const isDisabled = disabled || isLoading
@@ -82,6 +83,7 @@ const Button = ({
8283
// eslint-disable-next-line react/button-has-type
8384
type={type}
8485
className={`br-4 flex cursor dc__mnw-100 dc__tab-focus dc__position-rel dc__capitalize ${getButtonDerivedClass({ size, variant, style, isLoading })} ${isDisabled ? 'dc__disabled' : ''}`}
86+
data-testid={dataTestId}
8587
>
8688
{startIcon && <span className={iconClass}>{startIcon}</span>}
8789
<span className="dc__mxw-150 dc__align-left dc__truncate">{text}</span>

src/Shared/Components/Button/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'childre
5252
* If true, the loading state is shown for the button with disabled
5353
*/
5454
isLoading?: boolean
55+
dataTestId: string
5556
} & (
5657
| {
5758
/**

0 commit comments

Comments
 (0)