-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathHeroBlog.tsx
More file actions
78 lines (73 loc) · 1.8 KB
/
HeroBlog.tsx
File metadata and controls
78 lines (73 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import React from "react";
import "./heroBlog.css";
import { Link } from "gatsby";
import Newsletter from "../Newsletter/Newsletter";
import SideCard from "./SideCard.tsx/SideCard";
interface sideBlogsType {
category: string;
title: string;
date: string;
slug: string;
}
interface propTypes {
title: string;
date: string;
category: string;
content: string;
slug: string;
imageSrc?: string;
id?: string;
sideBarTitle?: string;
sideBlogs?: sideBlogsType[];
sideBar: boolean;
}
const HeroBlog: React.FC<propTypes> = ({
title,
date,
category,
imageSrc,
content,
slug,
sideBarTitle,
sideBlogs,
sideBar,
id,
}) => {
return (
// HeroBlog Section
<div className="hero-wrapper">
<section className="hero-blog-card">
<div className="hero-card-img" id={id}>
{imageSrc ? <img src={imageSrc} alt="" /> : null}
</div>
<div className="hero-card-content">
<p className="hero-card-tag">{category}</p>
<p className="hero-card-title">{title}</p>
<p className="hero-card-date"> {date} </p>
<p className="hero-card-text">{content}</p>
<div class="fade-in-text"><Link to={`/blogs/${slug}`}>Read More</Link>
</div>
</div>
</section>
{sideBar && (
<div className="side-section">
<h4>{sideBarTitle}</h4>
{sideBlogs &&
sideBlogs.map((sideBlog, index) => {
const { category, date, slug, title } = sideBlog;
return (
<SideCard
key={index}
category={category}
date={date}
slug={slug}
title={title}
/>
);
})}
</div>
)}
</div>
);
};
export default HeroBlog;