import React from 'react';
import ReactHtmlParser from "react-html-parser";
import { makeStyles } from "@material-ui/core/styles";

import classNames from "classnames";
import GridContainer from "components/Grid/GridContainer.js";
import Grid from '@material-ui/core/Grid';
import GridItem from "components/Grid/GridItem.js";
import Card from "components/Card/Card.js";
import Carousel from "react-slick";
import styles from "assets/jss/nextjs-material-kit/pages/componentsSections/notificationsStyles.js";

const useStyles = makeStyles(styles);
const DataCarrer = function ({ backend, detailcarrer, ...props }) {
    const classes = useStyles();
    const imageClasses = classNames(
        classes.imgRaised,
        classes.imgRoundedCircle,
        classes.imgFluid
    );
    const settings = {
        dots: true,
        infinite: true,
        speed: 500,
        slidesToShow: 1,
        slidesToScroll: 1,
        autoplay: true,
        time: 5
    };
    const navImageClasses = classNames(classes.imgRounded, classes.imgGallery);
    const carrer = detailcarrer.map((data) => {
        return (
            <GridContainer justify="center">
                <Grid fluid xs={4}> 
                    <div className={classes.section} id="notifications">
                        <div className={classes.section}>
                            <div className={classes.container}>
                            <GridContainer>
                                <GridItem className={classes.marginAuto}>
                                    <Card carousel>
                                        <Carousel {...settings}>
                                            <img className={navImageClasses} width="300px" alt="First slide" src={`${backend}${data.img[0]["url"]}`} />
                                        </Carousel>
                                    </Card>
                                </GridItem>
                            </GridContainer>
                            </div>
                        </div>
                    </div>
                </Grid>
                <Grid xs={7} style={{padding:"40px", marginTop:"-30px"}}>
                    <h4>{data.name}</h4>
                    <h4>{data.published_at}</h4>
                    <hr></hr>
                    <div align="justify">
                        <p>{ReactHtmlParser(data.description)}</p>
                    </div>
                </Grid>
            </GridContainer>
        );
    })
    return (
        <div>
            {carrer}
        </div>
    );
}

export default DataCarrer;