BlogSidebar.js 3.32 KB
import React from "react";
import Link from "next/link";
import Image from "next/image";

const popularPosts = [
  {
    title: "Being The Best-Selling Smart Phone This Year",
    date: "Jan 15, 2020",
    image: "/images/blog/blog1.jpg",
    link: "/blog/details",
  },
  {
    title: "Love Songs Helped Me Through Heartbreak",
    date: "Jan 14, 2020",
    image: "/images/blog/blog1.jpg",
    link: "/blog/details",
  },
  {
    title: "Two Fashion Designers Busy With 2020 Winter Fashion",
    date: "Jan 13, 2020",
    image: "/images/blog/blog1.jpg",
    link: "/blog/details",
  },
  {
    title: "Working in the Office is a Tradition For Women",
    date: "Jan 12, 2020",
    image: "/images/blog/blog1.jpg",
    link: "/blog/details",
  },
];

const categories = [
  { name: "Business", postCount: 2, link: "/blog" },
  { name: "Privacy", postCount: 5, link: "/blog" },
  { name: "Technology", postCount: 6, link: "/blog" },
  { name: "Tips", postCount: 2, link: "/blog" },
  { name: "Uncategorized", postCount: 1, link: "/blog" },
  { name: "Log in", postCount: 1, link: "/blog" },
];

const tags = [
  { name: "Advertisement", linkCount: 3, link: "/blog" },
  { name: "Business", linkCount: 3, link: "/blog" },
  { name: "Life", linkCount: 5, link: "/blog" },
  { name: "Lifestyle", linkCount: 2, link: "/blog" },
  { name: "Fashion", linkCount: 2, link: "/blog" },
  { name: "Inspiration", linkCount: 1, link: "/blog" },
  { name: "Blog", linkCount: 1, link: "/blog" },
  { name: "Ads", linkCount: 3, link: "/blog" },
];

const BlogSidebar = () => {
  return (
    <>
      <aside className="widget-area">
        <div className="widget widget_enry_posts_thumb">
          <h3 className="widget-title">Popular Posts</h3>
          {popularPosts.map((post, index) => (
            <article key={index} className="item">
              <Link href={post.link} className="thumb">
                <Image
                  src={post.image}
                  layout="fill"
                  className="img-fluid image fullimage cover"
                  alt="image"
                />
              </Link>
              <div className="info">
                <h4 className="title usmall">
                  <Link href={post.link}>{post.title}</Link>
                </h4>
                <span className="date">
                  <i className="ri-calendar-2-fill"></i> {post.date}
                </span>
              </div>
            </article>
          ))}
        </div>

        <div className="widget widget_categories">
          <h3 className="widget-title">Categories</h3>
          <ul>
            {categories.map((category, index) => (
              <li key={index}>
                <Link href={category.link}>
                  {category.name}{" "}
                  <span className="post-count">({category.postCount})</span>
                </Link>
              </li>
            ))}
          </ul>
        </div>

        <div className="widget widget_tag_cloud">
          <h3 className="widget-title">Tags</h3>
          <div className="tagcloud">
            {tags.map((tag, index) => (
              <Link key={index} href={tag.link}>
                {tag.name}
                <span className="tag-link-count"> ({tag.linkCount})</span>
              </Link>
            ))}
          </div>
        </div>
      </aside>
    </>
  );
};

export default BlogSidebar;