Sha256: ae3de256c4e1f70f7d2860f397074d216498619273042400b038623cb64f10bc

Contents?: true

Size: 958 Bytes

Versions: 31

Compression:

Stored size: 958 Bytes

Contents

import * as React from "react";
import Icon from "../application/icon.component";

interface VoteButtonProps {
  buttonClassName: string;
  iconName: string;
  votes: number;
  voteAction?: () => void;
  disabled?: boolean;
  selectedClass?: string;
  userLoggedIn: boolean;
}

const preventDefault = (event: any) => {
  event.preventDefault();
};

const VoteButton: React.SFC<VoteButtonProps> = ({
  buttonClassName,
  iconName,
  votes,
  voteAction,
  disabled,
  selectedClass,
  userLoggedIn
}) => (
  <button
    className={`${buttonClassName} ${selectedClass}`}
    onClick={userLoggedIn ? voteAction : preventDefault}
    disabled={disabled}
    data-open={userLoggedIn ? null : "loginModal"}
  >
    <Icon name={iconName} iconExtraClassName="icon--small" />
    {` ${votes}`}
  </button>
);

VoteButton.defaultProps = {
  buttonClassName: "",
  iconName: "",
  votes: 0,
  selectedClass: "selected",
  disabled: false
};

export default VoteButton;

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
decidim-comments-0.21.0 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.20.1 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.20.0 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.19.1 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.18.1 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.19.0 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.17.2 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.18.0 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.17.1 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.16.1 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.17.0 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.16.0 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.15.2 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.15.1 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.15.0 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.14.4 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.14.3 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.14.2 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.14.1 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.13.1 app/frontend/comments/vote_button.component.tsx