Skip to content

Commit

Permalink
change appearance validate and cancel button
Browse files Browse the repository at this point in the history
  • Loading branch information
anistouri committed Oct 18, 2023
1 parent 9193b9f commit 99f1cd7
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 33 deletions.
7 changes: 7 additions & 0 deletions decs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ declare module '@gridsuite/commons-ui' {
disabled?: boolean;
}>;

export const CancelButton: FunctionComponent<{
onClick: (() => void) | ((event: React.MouseEvent) => void);
disabled?: boolean;
variant?: string;
children?: ReactNode;
}>;

export const FieldLabel: FunctionComponent<{
label: string;
optional?: boolean;
Expand Down
10 changes: 10 additions & 0 deletions src/components/app-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ const lightTheme = createTheme({
agGridBackground: {
color: 'white',
},
typography: {
button: {
textTransform: 'none',
},
},
});

const darkTheme = createTheme({
Expand Down Expand Up @@ -110,6 +115,11 @@ const darkTheme = createTheme({
agGridBackground: {
color: '#383838',
},
typography: {
button: {
textTransform: 'none',
},
},
});

const getMuiTheme = (theme) => {
Expand Down
5 changes: 3 additions & 2 deletions src/components/dialogs/access-rights-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import CircularProgress from '@mui/material/CircularProgress';
import DialogActions from '@mui/material/DialogActions';
import Button from '@mui/material/Button';
import PropTypes from 'prop-types';
import { CancelButton } from '@gridsuite/commons-ui';

/**
* Dialog to change the access rights
Expand Down Expand Up @@ -110,9 +111,9 @@ const AccessRightsDialog = ({
)}
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>
<CancelButton onClick={handleClose}>
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<Button onClick={handleClick} variant="outlined">
<FormattedMessage id="edit" />
</Button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React, { FunctionComponent } from 'react';
import { FieldErrors, FormProvider } from 'react-hook-form';
import Dialog from '@mui/material/Dialog';
import DialogTitle from '@mui/material/DialogTitle';
import { Grid, LinearProgress } from '@mui/material';
import { FormattedMessage } from 'react-intl';
import DialogContent from '@mui/material/DialogContent';
import DialogActions from '@mui/material/DialogActions';
import Button from '@mui/material/Button';
import { SubmitButton } from '@gridsuite/commons-ui';
import {
DialogActions,
DialogContent,
Grid,
LinearProgress,
Dialog,
DialogTitle,
} from '@mui/material';
import { CancelButton, SubmitButton } from '@gridsuite/commons-ui';

interface ICustomMuiDialog {
open: boolean;
Expand Down Expand Up @@ -91,9 +93,9 @@ const CustomMuiDialog: FunctionComponent<ICustomMuiDialog> = ({
</DialogTitle>
<DialogContent>{children}</DialogContent>
<DialogActions>
<Button onClick={handleCancel}>
<CancelButton onClick={handleCancel}>
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<SubmitButton
disabled={disabledSave}
onClick={handleSubmit(
Expand Down
5 changes: 3 additions & 2 deletions src/components/dialogs/create-directory-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import FormControlLabel from '@mui/material/FormControlLabel';
import Radio from '@mui/material/Radio';
import { ElementType } from '../../utils/elementType';
import { useNameField } from './field-hook';
import { CancelButton } from '@gridsuite/commons-ui';

/**
* Dialog to create a directory
Expand Down Expand Up @@ -101,9 +102,9 @@ export const CreateDirectoryDialog = ({
{error !== '' && <Alert severity="error">{error}</Alert>}
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>
<CancelButton onClick={handleClose}>
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<Button
disabled={!canCreate()}
onClick={handleClick}
Expand Down
9 changes: 5 additions & 4 deletions src/components/dialogs/csv-import-filter-creation-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import PropTypes from 'prop-types';
import { DialogContentText } from '@mui/material';
import { ElementType } from '../../utils/elementType';
import { Generator, Load } from '../../utils/equipment-types';
import { CancelButton } from '@gridsuite/commons-ui';

const CsvImportFilterCreationDialog = ({
onClose,
Expand Down Expand Up @@ -181,9 +182,9 @@ const CsvImportFilterCreationDialog = ({
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={() => handleCancelDialog()}>
<CancelButton onClick={handleCancelDialog}>
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<Button
onClick={() => handleReplacePopupConfirmation()}
>
Expand Down Expand Up @@ -265,9 +266,9 @@ const CsvImportFilterCreationDialog = ({
</div>
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>
<CancelButton onClick={handleClose}>
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<Button
variant="outlined"
onClick={() => handleOpenCSVConfirmationDataDialog()}
Expand Down
6 changes: 3 additions & 3 deletions src/components/dialogs/delete-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import PropTypes from 'prop-types';
import React, { useEffect, useRef, useState } from 'react';
import Grid from '@mui/material/Grid';
import CircularProgress from '@mui/material/CircularProgress';
import { OverflowableText } from '@gridsuite/commons-ui';
import { CancelButton, OverflowableText } from '@gridsuite/commons-ui';

/**
* Dialog to delete an element
Expand Down Expand Up @@ -210,13 +210,13 @@ const DeleteDialog = ({
{error !== '' && <Alert severity="error">{error}</Alert>}
</DialogContent>
<DialogActions>
<Button
<CancelButton
onClick={handleClose}
variant="outlined"
disabled={loadingState}
>
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<Button onClick={handleClick} disabled={loadingState}>
{(loadingState && <CircularProgress size={24} />) || (
<FormattedMessage id="delete" />
Expand Down
5 changes: 3 additions & 2 deletions src/components/dialogs/rename-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import PropTypes from 'prop-types';
import { useNameField } from './field-hook';
import { useSelector } from 'react-redux';
import { ElementType } from '../../utils/elementType';
import { CancelButton } from '@gridsuite/commons-ui';

/**
* Dialog to rename an element
Expand Down Expand Up @@ -91,9 +92,9 @@ const RenameDialog = ({
{error && <Alert severity="error">{error}</Alert>}
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>
<CancelButton onClick={handleClose}>
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<Button
onClick={handleClick}
disabled={!canRename()}
Expand Down
5 changes: 3 additions & 2 deletions src/components/dialogs/replace-with-script-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Button from '@mui/material/Button';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import React from 'react';
import { CancelButton } from '@gridsuite/commons-ui';

/**
* Dialog to replace a filters contingency list with a script contingency list or a filter with a script
Expand Down Expand Up @@ -48,9 +49,9 @@ const ReplaceWithScriptDialog = ({ id, open, onClose, onClick, title }) => {
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleClose} variant="outlined">
<CancelButton onClick={handleClose} variant="outlined">
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<Button onClick={handleClick}>
<FormattedMessage id="validate" />
</Button>
Expand Down
5 changes: 3 additions & 2 deletions src/components/utils/popup-confirmation-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import DialogActions from '@mui/material/DialogActions';
import Button from '@mui/material/Button';
import { FormattedMessage } from 'react-intl';
import React from 'react';
import { CancelButton } from '@gridsuite/commons-ui';

const PopupConfirmationDialog = ({
openConfirmationPopup,
Expand All @@ -26,9 +27,9 @@ const PopupConfirmationDialog = ({
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={() => setOpenConfirmationPopup(false)}>
<CancelButton onClick={() => setOpenConfirmationPopup(false)}>
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<Button onClick={handlePopupConfirmation} variant="outlined">
<FormattedMessage id="validate" />
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import PropTypes from 'prop-types';
import { DialogContentText } from '@mui/material';
import { useWatch } from 'react-hook-form';
import { AG_GRID_ROW_UUID } from '../../../field-constants';
import { CancelButton } from '@gridsuite/commons-ui';

const CsvUploader = ({
name,
Expand Down Expand Up @@ -156,9 +157,9 @@ const CsvUploader = ({
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={() => handleCancelDialog()}>
<CancelButton onClick={handleCancelDialog}>
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<Button onClick={() => handleReplacePopupConfirmation()}>
<FormattedMessage id="replace" />
</Button>
Expand Down Expand Up @@ -233,9 +234,9 @@ const CsvUploader = ({
</div>
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>
<CancelButton onClick={handleClose}>
<FormattedMessage id="cancel" />
</Button>
</CancelButton>
<Button
variant="outlined"
onClick={() => handleOpenCSVConfirmationDataDialog()}
Expand Down
2 changes: 1 addition & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"nameProperty": "Name",
"descriptionProperty": "Description (optional)",
"uploadMessage": " No file selected",
"cancel": "CANCEL",
"cancel": "Cancel",
"creationInProgress": "creation in progress",
"uploading": "upload in progress",
"studyCreatingError": "An error occurred while creating the study: {studyName}",
Expand Down
4 changes: 2 additions & 2 deletions src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"duplicateElementFailure": "Une erreur est survenue lors de la duplication de l'élément {itemName} : {errorMessage}",
"generateCopyScriptNameError" : "Une erreur s'est produite lors de la génération du nom du script de copie de l'élément {itemName}",
"caseName": "nom de la situation",
"uploadCase": "télécharger la situation",
"uploadCase": "Télécharger la situation",
"uploadErrorMsg": "Veuillez télécharger la situation",
"uploadFileExceedingLimitSizeErrorMsg": "Le fichier sélectionné dépasse la taille limite ({maxSize} Mo). Veuillez compresser ce fichier au format zip, gzip ou bzip2 puis réessayez de l'importer à nouveau.",
"nameProperty": "Nom",
"descriptionProperty": "Description (optionnel)",
"uploadMessage": " Aucun fichier sélectionné",
"cancel": "ANNULER",
"cancel": "Annuler",
"creationInProgress": "création en cours",
"uploading": "téléversement en cours",
"studyCreatingError": "Une erreur est survenue lors de la création de l'étude : {studyName}",
Expand Down

0 comments on commit 99f1cd7

Please sign in to comment.