Sha256: 8174ef694cd501be53f550a7717e5dbad3dbe0abfd2adce14a597d2822b39e99

Contents?: true

Size: 960 Bytes

Versions: 46

Compression:

Stored size: 960 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

46 entries across 46 versions & 2 rubygems

Version Path
decidim-comments-0.9.3 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.9.2 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.9.1 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.9.0 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.8.4 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.8.3 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.8.2 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.8.1 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.8.0 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.7.4 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.7.3 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.7.2 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.7.1 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.7.0 app/frontend/comments/vote_button.component.tsx
decidim-comments-0.6.8 app/frontend/comments/vote_button.component.tsx
decidim-0.6.8 decidim-comments/app/frontend/comments/vote_button.component.tsx
decidim-comments-0.6.7 app/frontend/comments/vote_button.component.tsx
decidim-0.6.7 decidim-comments/app/frontend/comments/vote_button.component.tsx
decidim-comments-0.6.6 app/frontend/comments/vote_button.component.tsx
decidim-0.6.6 decidim-comments/app/frontend/comments/vote_button.component.tsx