-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: MANAGER-16127 Signed-off-by: Guillaume Hyenne <[email protected]>
- Loading branch information
Showing
19 changed files
with
406 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...es/manager/apps/web-office/public/translations/dashboard/users/delete/Messages_fr_FR.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"dashboard_users_delete_title": "Suppression d'un utilisateur", | ||
"dashboard_users_delete_confirm": "Êtes-vous sûr de vouloir supprimer l'utilisateur <strong>{{t0}}</strong> ?", | ||
"dashboard_users_delete_info1": "L'utilisateur sera supprimé immédiatement après confirmation.", | ||
"dashboard_users_delete_info2": "La facturation de nos produits Office 365 étant basée sur la consommation du mois précédent, vous recevrez une dernière facture pour ce compte.", | ||
"dashboard_users_delete_cta_cancel": "Annuler", | ||
"dashboard_users_delete_cta_confirm": "Valider", | ||
"dashboard_users_delete_message_error": "Une erreur est survenue lors de la suppression de l'utilisateur. {{ error }}", | ||
"dashboard_users_delete_message_success": "Utilisateur en cours de suppression." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
packages/manager/apps/web-office/src/components/Modals/Modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import React from 'react'; | ||
import { OdsButton, OdsModal, OdsText } from '@ovhcloud/ods-components/react'; | ||
import { | ||
ODS_BUTTON_VARIANT, | ||
ODS_MODAL_COLOR, | ||
ODS_BUTTON_COLOR, | ||
ODS_TEXT_PRESET, | ||
} from '@ovhcloud/ods-components'; | ||
import Loading from '@/components/Loading/Loading'; | ||
|
||
export interface ButtonType { | ||
testid?: string; | ||
action: () => void; | ||
label: string; | ||
isDisabled?: boolean; | ||
isLoading?: boolean; | ||
variant?: ODS_BUTTON_VARIANT; | ||
} | ||
|
||
export interface ModalProps { | ||
title?: string; | ||
color?: ODS_MODAL_COLOR; | ||
isDismissible?: boolean; | ||
isLoading?: boolean; | ||
isOpen?: boolean; | ||
onClose?: () => void; | ||
children?: React.ReactElement; | ||
primaryButton?: ButtonType; | ||
secondaryButton?: ButtonType; | ||
} | ||
|
||
const mapModalColorToButtonColor = (modalColor: ODS_MODAL_COLOR) => { | ||
if (modalColor === ODS_MODAL_COLOR.critical) { | ||
return ODS_BUTTON_COLOR.critical; | ||
} | ||
return ODS_BUTTON_COLOR.primary; | ||
}; | ||
|
||
const Modal: React.FC<ModalProps> = ({ | ||
color = ODS_MODAL_COLOR.information, | ||
isDismissible, | ||
onClose, | ||
isLoading, | ||
primaryButton, | ||
secondaryButton, | ||
children, | ||
isOpen, | ||
title, | ||
}) => { | ||
const buttonColor = mapModalColorToButtonColor(color); | ||
|
||
return ( | ||
<OdsModal | ||
data-testid="modal" | ||
color={color} | ||
isDismissible={isDismissible} | ||
className="text-left" | ||
onOdsClose={onClose} | ||
isOpen={isOpen} | ||
> | ||
<OdsText className="mb-4" preset={ODS_TEXT_PRESET.heading4}> | ||
{title} | ||
</OdsText> | ||
{!isLoading && <div className="flex flex-col text-left">{children}</div>} | ||
{isLoading && <Loading />} | ||
{secondaryButton && ( | ||
<OdsButton | ||
{...(secondaryButton.testid | ||
? { 'data-testid': secondaryButton.testid } | ||
: {})} | ||
slot="actions" | ||
color={buttonColor} | ||
onClick={!secondaryButton.isDisabled ? secondaryButton.action : null} | ||
isDisabled={secondaryButton.isDisabled} | ||
isLoading={secondaryButton.isLoading} | ||
variant={secondaryButton.variant ?? ODS_BUTTON_VARIANT.outline} | ||
label={secondaryButton.label} | ||
className="mt-4" | ||
/> | ||
)} | ||
{primaryButton && ( | ||
<OdsButton | ||
{...(primaryButton.testid | ||
? { 'data-testid': primaryButton.testid } | ||
: {})} | ||
slot="actions" | ||
color={buttonColor} | ||
onClick={!primaryButton.isDisabled ? primaryButton.action : null} | ||
isDisabled={primaryButton.isDisabled} | ||
isLoading={primaryButton.isLoading || isLoading} | ||
variant={primaryButton.variant ?? ODS_BUTTON_VARIANT.default} | ||
label={primaryButton.label} | ||
className="mt-4" | ||
/> | ||
)} | ||
</OdsModal> | ||
); | ||
}; | ||
|
||
export default Modal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.