Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mrc): fix <DeleteModal /> #14929

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ODS_BUTTON_COLOR,
ODS_MESSAGE_COLOR,
ODS_MODAL_COLOR,
ODS_TEXT_PRESET,
} from '@ovhcloud/ods-components';
import { handleClick } from '../../../utils/click-utils';
import './translations/translations';
Expand Down Expand Up @@ -61,56 +62,55 @@ export const DeleteModal: React.FC<DeleteModalProps> = ({
return (
<OdsModal
color={ODS_MODAL_COLOR.warning}
class="modal-actions"
onOdsClose={close}
isOpen={isOpen}
>
<div>
<span className="delete-modal-headline text-[--ods-color-heading] text-[24px] leading-[32px] font-bold">
{headline}
</span>
<div className="flex flex-col gap-4">
<OdsText preset={ODS_TEXT_PRESET.heading3}>{headline}</OdsText>
{!!error && (
<OdsMessage color={ODS_MESSAGE_COLOR.warning}>
{t('deleteModalError', { error })}
</OdsMessage>
)}
{description && (
<OdsText preset={ODS_TEXT_PRESET.paragraph}>{description}</OdsText>
)}
<OdsFormField>
<label slot="label">{deleteInputLabel}</label>
<OdsInput
className="block"
name="delete-input"
aria-label="delete-input"
isDisabled={isLoading || undefined}
type={ODS_INPUT_TYPE.text}
value={deleteInput}
onOdsChange={(e: OdsInputCustomEvent<OdsInputChangeEventDetail>) =>
setDeleteInput(e.detail.value as string)
}
/>
</OdsFormField>
<div className="flex justify-end gap-2">
<OdsButton
slot="actions"
data-testid="manager-delete-modal-cancel"
variant={ODS_BUTTON_VARIANT.ghost}
color={ODS_BUTTON_COLOR.primary}
{...handleClick(close)}
label={cancelButtonLabel || t('deleteModalCancelButton')}
/>
<OdsButton
isDisabled={isDisabled}
slot="actions"
isLoading={isLoading}
data-testid="manager-delete-modal-confirm"
{...handleClick(() => {
setDeleteInput('');
onConfirmDelete();
})}
label={confirmButtonLabel || t('deleteModalDeleteButton')}
/>
</div>
</div>
{!!error && (
<OdsMessage color={ODS_MESSAGE_COLOR.warning}>
<OdsText preset="span">{t('deleteModalError', { error })}</OdsText>
</OdsMessage>
)}
<span className="delete-modal-description text-[--ods-color-text] text-[14px] leading-[18px] my-[8px]">
{description}
</span>
<OdsFormField className="mb-8">
<label slot="label">{deleteInputLabel}</label>
<OdsInput
name=""
aria-label="delete-input"
isDisabled={isLoading || undefined}
type={ODS_INPUT_TYPE.text}
value={deleteInput}
onOdsChange={(e: OdsInputCustomEvent<OdsInputChangeEventDetail>) =>
setDeleteInput(e.detail.value as string)
}
/>
</OdsFormField>
<OdsButton
isDisabled={isLoading}
slot="actions"
data-testid="manager-delete-modal-cancel"
variant={ODS_BUTTON_VARIANT.ghost}
color={ODS_BUTTON_COLOR.primary}
{...handleClick(close)}
label={cancelButtonLabel || t('deleteModalCancelButton')}
/>
<OdsButton
isDisabled={isDisabled}
slot="actions"
isLoading={isLoading}
data-testid="manager-delete-modal-confirm"
{...handleClick(() => {
setDeleteInput('');
onConfirmDelete();
})}
label={confirmButtonLabel || t('deleteModalDeleteButton')}
/>
</OdsModal>
);
};
Loading