Skip to content

Instantly share code, notes, and snippets.

@matheusnascgomes
Last active March 19, 2018 23:15

Revisions

  1. matheusnascgomes renamed this gist Mar 19, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. matheusnascgomes renamed this gist Mar 19, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. matheusnascgomes created this gist Mar 19, 2018.
    45 changes: 45 additions & 0 deletions js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    import React from 'react';
    import { Row, Col } from 'react-bootstrap';
    import FontAwesome from 'react-fontawesome';
    import CategoryTag from './helpers/CategoryTag';

    import User from './res/user.jpg';
    import './styles/content.css'

    export default props => {

    const { list, description } = props;

    return(
    list.filter(link => {
    return (
    link.meta.title.toLowerCase().indexOf(description.toLowerCase()) >= 0
    ||
    link.meta.url.toLowerCase().indexOf(description.toLowerCase()) >= 0
    ||
    link.meta.author.toLowerCase().indexOf(description.toLowerCase()) >= 0
    ||
    link.category.toLowerCase().indexOf(description.toLowerCase()) >= 0
    )
    })
    .map(link => (
    <Row key={link.meta.author} className="content">
    <Col className="first-block" md={1} sm={6}>
    <FontAwesome name="angle-up" size="2x" style={{ color: '#da4738'} } />
    <p>{link.upvotes}</p>
    </Col>
    <Col className="second-block" md={11} sm={6}>
    <p>{link.meta.url}</p>
    <h4>{link.meta.title}</h4>
    <div className="links">
    <CategoryTag tagText={link.category}>{link.category}</CategoryTag>
    <div><a className="user-name"><img src={User} alt="foto do dono do post" with="16px" height="16px" />{link.meta.author}</a></div>
    <div><p className="time">43 minutes ago</p></div>
    <div><a href="" ><FontAwesome name="comment" style={{ color: '#da4738'} } /> {link.comments} Comments</a></div>
    <div><a href="">Edit</a></div>
    </div>
    </Col>
    </Row>
    ))
    );
    }