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