subscribeButton.tsx 704 B

12345678910111213141516171819202122232425
  1. import React from 'react';
  2. import Button from 'app/components/button';
  3. import {IconBell} from 'app/icons';
  4. import {t} from 'app/locale';
  5. type Props = {
  6. onClick: (e: React.MouseEvent) => void;
  7. disabled?: boolean;
  8. isSubscribed?: boolean;
  9. size?: React.ComponentProps<typeof Button>['size'];
  10. };
  11. export default class SubscribeButton extends React.Component<Props> {
  12. render() {
  13. const {size, isSubscribed, onClick, disabled} = this.props;
  14. const icon = <IconBell color={isSubscribed ? 'blue300' : undefined} />;
  15. return (
  16. <Button size={size} icon={icon} onClick={onClick} disabled={disabled}>
  17. {isSubscribed ? t('Unsubscribe') : t('Subscribe')}
  18. </Button>
  19. );
  20. }
  21. }