Youtube music and video downloader

Link.jsx 866B

123456789101112131415161718192021222324252627282930313233
  1. import React, {Component, PropTypes} from 'react';
  2. import classnames from 'classnames';
  3. // Task component - represents a single todo item
  4. export default class Link extends Component {
  5. deleteThisLink() {
  6. Meteor.call('links.remove', this.props.link._id);
  7. }
  8. render() {
  9. // Give tasks a different className when they are checked off,
  10. // so that we can style them nicely in CSS
  11. const linkClassName = classnames({
  12. completed: this.props.link.completed,
  13. });
  14. return (
  15. <li className={linkClassName}>
  16. <button className="delete" onClick={this.deleteThisLink.bind(this)}>
  17. &times;
  18. </button>
  19. <span className="text">{this.props.link.url}</span>
  20. </li>
  21. );
  22. }
  23. }
  24. Link.propTypes = {
  25. // This component gets the task to display through a React prop.
  26. // We can use propTypes to indicate it is required
  27. link: PropTypes.object.isRequired,
  28. };