forked from QuantStack/quantstack.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
67 lines (62 loc) · 2.18 KB
/
index.tsx
File metadata and controls
67 lines (62 loc) · 2.18 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
import styles from "./styles.module.css";
import React, { useState } from "react";
import BlogpostCard from "./BlogpostCard";
import { blogpostsDetails } from "./blogpostsDetails";
import AtomOrange from "/img/icons/RSSOrange.svg";
export default function BlogsComponent() {
const numberOfBlogs = blogpostsDetails.length;
const [searchField, setSearchField] = useState("");
const filteredBlogPosts = blogpostsDetails.filter((blogpost) => {
return (
blogpost.title.toLowerCase().includes(searchField.toLowerCase()) ||
blogpost.authors.toLowerCase().includes(searchField.toLowerCase()) ||
blogpost.date.toLowerCase().includes(searchField.toLowerCase()) ||
blogpost.summary.toLowerCase().includes(searchField.toLowerCase())
);
});
const handleChange = (event) => {
setSearchField(event.target.value);
};
return (
<div className="main-container-with-margins">
<div className="container upper-container-with-margin-top">
<div className={"row row-with-margin-bottom"}>
<div
className={"col col--8 col--offset-2"}
>
<div className="flex-full-centered">
<h1 className="padding-none margin-none">
Featured Blog Posts by QuantStack Contributors
</h1>
<div style={{padding:"0 10px"}}>
<a href={"/atom.xml"}>
<AtomOrange width={"42px"} height={"42px"} />
</a>
</div>
</div>
<div>
<input
className={styles.search_input}
type="search"
placeholder="Search for blog posts"
onChange={handleChange}
/>
</div>
</div>
</div>
<ul className={"row" + " " + "flex-full-centered"}>
{filteredBlogPosts.map((blogpost, index) => (
<li className="cards-list" key={index}>
<div className="col">
<BlogpostCard
blogpost={blogpost}
timeIndex={numberOfBlogs - index}
></BlogpostCard>
</div>
</li>
))}
</ul>
</div>
</div>
);
}