{"size": 1600, "ext": "js", "max_stars_repo_path": "src/Components/Main.js", "max_stars_repo_name": "mikenguyen69/react-practice-dojo-v1", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Components/Main.js", "max_issues_repo_name": "mikenguyen69/react-practice-dojo-v1", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Components/Main.js", "max_forks_repo_name": "mikenguyen69/react-practice-dojo-v1", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 36.3636363636, "max_line_length": 231, "alphanum_fraction": 0.57875}
import React, {Component} from 'react';
import Title from './Title';
import PhotoWall from './PhotoWall';

class Main extends Component {
    constructor() {
        super()
        this.state = {
            posts: [{
                id: "0",
                description: "Beautiful landscape",
                imageLink: "https://image.dhgate.com/0x0s/f2-albu-g5-M01-53-D7-rBVaJFi6NDCAL_1pAAOIbm7LX1M667.jpg/luxury-european-modern-beautiful-scenery.jpg"
            }, {
                id: "1",
                description: "Solitude",
                imageLink: "https://previews.123rf.com/images/ajsharma/ajsharma1707/ajsharma170700026/82004962-hermoso-paisaje-de-una-vista-y-%C3%A1rboles-alineados-sin-hojas-flores-rojas-y-la-cima-de-la-monta%C3%B1a-en-el-fon.jpg"
            }, {
                id: "2",
                description: "I have a dream",
                imageLink: "https://ae01.alicdn.com/kf/HTB1KIZfSXXXXXXPaXXXq6xXFXXXG/Beibehang-personalizado-papel-pintado-hermosas-flores-paisaje-natural-fondos-Sala-dormitorio-TV-Fondo-pared-3d-papel.jpg"
            }]
        }

        this.removePhoto = this.removePhoto.bind(this)
    }

    removePhoto(postRemoved) {
        console.log(postRemoved.description);
        this.setState((state) => ({
            posts: state.posts.filter(post => post !== postRemoved)
        }))
    }

    render() {
        return(
            <div>
                <Title title={["Photowall"]} />
                <PhotoWall posts = {this.state.posts} onRemovePhoto = {this.removePhoto}/>
            </div>
        )
    }
}

export default Main