cozy-ui icon indicating copy to clipboard operation
cozy-ui copied to clipboard

Dialogs / CozyDialogs : buttons logic is repeated on all dialog types

Open Ldoppea opened this issue 3 years ago • 0 comments

All cozyDialogs are implementing the same logic for buttons

      {!fullScreen && onClose && (
        <DialogCloseButton
          onClick={onClose}
          data-test-id={`modal-close-button-${id}`}
        />
      )}
      {!fullScreen && onBack && (
        <DialogBackButton
          onClick={onBack}
          data-test-id={`modal-back-button-${id}`}
        />
      )}
      {fullScreen && onBackOrClose && (
        <DialogBackButton
          data-test-id={`modal-backclose-button-${id}`}
          onClick={onBackOrClose}
        />
      )}

We should find a way to refactor this.

More info : https://github.com/cozy/cozy-ui/pull/1905#discussion_r717379228

Ldoppea avatar Sep 28 '21 15:09 Ldoppea