Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

ReloadButton.tsx 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2022 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import classNames from 'classnames';
  21. import * as React from 'react';
  22. import { colors } from '../../app/theme';
  23. import { translate } from '../../helpers/l10n';
  24. import Tooltip from './Tooltip';
  25. interface Props {
  26. className?: string;
  27. tooltip?: string;
  28. onClick: () => void;
  29. }
  30. export default class ReloadButton extends React.PureComponent<Props> {
  31. handleClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
  32. event.preventDefault();
  33. event.currentTarget.blur();
  34. this.props.onClick();
  35. };
  36. render() {
  37. const { tooltip = translate('reload') } = this.props;
  38. return (
  39. <Tooltip overlay={tooltip}>
  40. <a
  41. className={classNames('link-no-underline', this.props.className)}
  42. href="#"
  43. onClick={this.handleClick}>
  44. {
  45. <svg height="24" viewBox="0 0 18 24" width="18">
  46. <path
  47. d="M16.6454 8.1084c-.3-.5-.9-.7-1.4-.4-.5.3-.7.9-.4 1.4.9 1.6 1.1 3.4.6 5.1-.5 1.7-1.7 3.2-3.2 4-3.3 1.8-7.4.6-9.1-2.7-1.8-3.1-.8-6.9 2.1-8.8v3.3h2v-7h-7v2h3.9c-3.7 2.5-5 7.5-2.8 11.4 1.6 3 4.6 4.6 7.7 4.6 1.4 0 2.8-.3 4.2-1.1 2-1.1 3.5-3 4.2-5.2.6-2.2.3-4.6-.8-6.6z"
  48. fill={colors.secondFontColor}
  49. />
  50. </svg>
  51. }
  52. </a>
  53. </Tooltip>
  54. );
  55. }
  56. }