您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

InlineDialogFailure.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* @flow */
  2. import Button from '@atlaskit/button/standard-button';
  3. import React, { Component } from 'react';
  4. import { translate } from '../../../i18n';
  5. declare var interfaceConfig: Object;
  6. /**
  7. * The type of the React {@code Component} props of {@link InlineDialogFailure}.
  8. */
  9. type Props = {
  10. /**
  11. * Allows to retry the call that previously didn't succeed.
  12. */
  13. onRetry: Function,
  14. /**
  15. * Invoked to obtain translated strings.
  16. */
  17. t: Function,
  18. /**
  19. * Indicates whether the support link should be shown in case of an error
  20. */
  21. showSupportLink: Boolean,
  22. };
  23. /**
  24. * Inline dialog that represents a failure and allows a retry.
  25. */
  26. class InlineDialogFailure extends Component<Props> {
  27. /**
  28. * Renders the content of this component.
  29. *
  30. * @returns {ReactElement}
  31. */
  32. render() {
  33. const { t, showSupportLink } = this.props;
  34. const supportLink = interfaceConfig.SUPPORT_URL;
  35. const supportString = t('inlineDialogFailure.supportMsg');
  36. const supportLinkElem
  37. = supportLink && showSupportLink
  38. ? (
  39. <div className = 'inline-dialog-error-text'>
  40. <span>{ supportString.padEnd(supportString.length + 1) }
  41. </span>
  42. <span>
  43. <a
  44. href = { supportLink }
  45. rel = 'noopener noreferrer'
  46. target = '_blank'>
  47. { t('inlineDialogFailure.support') }
  48. </a>
  49. </span>
  50. <span>.</span>
  51. </div>
  52. )
  53. : null;
  54. return (
  55. <div className = 'inline-dialog-error'>
  56. <div className = 'inline-dialog-error-text'>
  57. { t('inlineDialogFailure.msg') }
  58. </div>
  59. { supportLinkElem }
  60. <Button
  61. className = 'inline-dialog-error-button'
  62. onClick = { this.props.onRetry } >
  63. { t('inlineDialogFailure.retry') }
  64. </Button>
  65. </div>
  66. );
  67. }
  68. }
  69. export default translate(InlineDialogFailure);