-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlog.js
More file actions
84 lines (74 loc) · 2.8 KB
/
Copy pathBlog.js
File metadata and controls
84 lines (74 loc) · 2.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
79
80
81
82
83
84
import React,{ useContext} from 'react';
import { Link } from 'react-router-dom'
import { makeStyles } from '@material-ui/core/styles';
import { HiArrowRight } from "react-icons/hi";
import './Blog.css';
import { ThemeContext } from '../../contexts/ThemeContext';
import { blogData } from '../../data/blogData'
import SingleBlog from './SingleBlog/SingleBlog';
function Blog() {
const { theme } = useContext(ThemeContext);
const useStyles = makeStyles(() => ({
viewAllBtn : {
color: theme.tertiary,
backgroundColor: theme.primary,
"&:hover": {
color: theme.secondary,
backgroundColor: theme.primary,
}
},
viewArr : {
color: theme.tertiary,
backgroundColor: theme.secondary70,
width: '40px',
height: '40px',
padding: '0.5rem',
fontSize: '1.05rem',
borderRadius: '50%',
cursor: 'pointer',
"&:hover": {
color: theme.tertiary,
backgroundColor: theme.secondary,
}
},
}));
const classes = useStyles();
return (
<>
{blogData.length > 0 && (
<div className="blog" id="blog" style={{backgroundColor: theme.secondary}}>
<div className="blog--header">
<h1 style={{color: theme.primary}}>Blog</h1>
</div>
<div className="blog--body">
<div className="blog--bodyContainer">
{blogData.slice(0, 3).reverse().map(blog => (
<SingleBlog
theme={theme}
title={blog.title}
desc={blog.description}
date={blog.date}
image={blog.image}
url={blog.url}
key={blog.id}
id={blog.id}
/>
))}
</div>
{blogData.length > 3 && (
<div className="blog--viewAll">
<Link to="/blog">
<button className={classes.viewAllBtn}>
View All
<HiArrowRight className={classes.viewArr} />
</button>
</Link>
</div>
)}
</div>
</div>
)}
</>
)
}
export default Blog