import React from "react";
import Link from 'next/link';
import SectionTitle from "../SectionTitle/SectionTitle";
import Campaign from '../../api/campaign';
import Image from "next/image";

const ClickHandler = () => {
    window.scrollTo(10, 0);
}

const ServicesSection = (props) => {
    return (
        <div className={`wpo-campaign-area section-padding ${props.cmClass}`}>
            <div className="container">
                <SectionTitle subTitle={'Campaign'} Title={'Our Upcoming Campaign'} />
                <div className="wpo-campaign-wrap">
                    <div className="row">
                        {Campaign.map((campaign, cam) => (
                            <div className="col-lg-4 col-md-6 col-12" key={cam}>
                                <div className="wpo-campaign-single">
                                    <div className="wpo-campaign-item">
                                        <div className="wpo-campaign-img">
                                            <Image src={campaign.cImg} alt="" />
                                        </div>
                                        <div className="wpo-campaign-content">
                                            <div className="wpo-campaign-text-top">
                                                <h2>
                                                    <Link onClick={ClickHandler} href={`/services/${campaign.slug}`}>
                                                        {campaign.title}
                                                    </Link>
                                                </h2>
                                                <p><i className="fi flaticon-calendar"></i> {campaign.date}</p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        ))}
                    </div>
                </div>
            </div>
        </div>
    );
}

export default ServicesSection;
