You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ReloadButton.tsx 979B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import React, { useCallback } from 'react';
  2. import { useDispatch } from 'react-redux';
  3. import { makeStyles } from 'tss-react/mui';
  4. import { reloadNow } from '../../../app/actions.web';
  5. import Button from '../../../base/ui/components/web/Button';
  6. /**
  7. * The type of the React {@code Component} props of {@link ReloadButton}.
  8. */
  9. interface IProps {
  10. /**
  11. * The translation key for the text in the button.
  12. */
  13. textKey: string;
  14. }
  15. const useStyles = makeStyles()(theme => {
  16. return {
  17. button: {
  18. margin: `${theme.spacing(2)} auto 0`
  19. }
  20. };
  21. });
  22. const ReloadButton = ({ textKey }: IProps) => {
  23. const dispatch = useDispatch();
  24. const { classes } = useStyles();
  25. const onClick = useCallback(() => {
  26. dispatch(reloadNow());
  27. }, []);
  28. return (
  29. <Button
  30. className = { classes.button }
  31. labelKey = { textKey }
  32. onClick = { onClick } />
  33. );
  34. };
  35. export default ReloadButton;