Advertisement
danine1

ternary operators css

Mar 7th, 2018
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from "react";
  2. import PropTypes from "prop-types";
  3. import { Link } from "react-router-dom";
  4. import { Icon } from "@ematix/tesseract-component-library";
  5. import classnames from "classnames";
  6. import cls from "./moduleSelectorItem.scss";
  7.  
  8. const ModuleSelectorItem = ({
  9.   module: {
  10.     icon, name, to, baseColor, enabled, className,
  11.   },
  12. }) => (
  13.   <Link
  14.     to={to}
  15.     className={classnames(cls.boardItem, {
  16.       enabled,
  17.     })}
  18.     style={{
  19.       cursor: enabled ? "pointer" : "not-allowed",
  20.       pointerEvents: enabled ? "auto" : "none",
  21.     }}
  22.   >
  23.     <div
  24.       className={classnames(cls.iconWrapper, cls[className])}
  25.       style={{
  26.         color: enabled ? baseColor : "#CCC",
  27.       }}
  28.     >
  29.       <Icon className={cls.iconStyle}>{icon}</Icon>
  30.     </div>
  31.     <span style={{ color: enabled ? "inherit" : "#CCC" }}>{name}</span>
  32.   </Link>
  33. );
  34.  
  35. ModuleSelectorItem.propTypes = {
  36.   module: PropTypes.shape({
  37.     icon: PropTypes.string.isRequired,
  38.     name: PropTypes.string.isRequired,
  39.     to: PropTypes.string.isRequired,
  40.     baseColor: PropTypes.string.isRequired,
  41.   }).isRequired,
  42. };
  43.  
  44. export default ModuleSelectorItem;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement