Personal Dashboard

Components.jsx 1.4KB

1234567891011121314151617181920212223242526272829303132333435
  1. import React from 'react'
  2. import cl from 'classnames'
  3. import { Link } from 'react-router-dom'
  4. export const Icon = ({ name, size, intent, className, ...otherProps }) => {
  5. const classes = cl({
  6. [`pt-icon-${size}`]: size,
  7. [`pt-icon-${name}`]: name,
  8. [`pt-intent-${intent}`]: intent,
  9. [className]: true
  10. })
  11. return <span className={classes} {...otherProps}></span>
  12. }
  13. export const Card = ({ className, children, interactive, ...otherProps }) =>
  14. <div className={cl(["pt-card", className, {'pt-interactive': interactive}])} {...otherProps}>{children}</div>
  15. export const Placeholder = ({ iconName, title, description, ...otherProps }) =>
  16. <div className="pt-non-ideal-state" {...otherProps} >
  17. <div className="pt-non-ideal-state-visual pt-non-ideal-state-icon">
  18. <span className={`pt-icon pt-icon-${iconName}`}></span>
  19. </div>
  20. <h4 className="pt-non-ideal-state-title">{title}</h4>
  21. <div className="pt-non-ideal-state-description">
  22. {description}
  23. </div>
  24. </div>
  25. export const MenuLink = ({ to, iconName, children, ...otherProps }) => {
  26. let classes = cl(["pt-menu-item","pt-popover-dismiss", {[`pt-icon-${iconName}`]: iconName}]);
  27. return <li><Link to={to} className={classes} {...otherProps}>{children}</Link></li>
  28. }
  29. export const ProfilePic = ({ src }) => src ? <img src={src} /> :
  30. <Placeholder iconName="mugshot" title="No picture" description="Click to change"/>