Skip to content

Commit 0557659

Browse files
authored
#15: Implemented Article Related Topics Component
* implemented BodySection component, fixed header-marker from disappearing at smaller screen widths * refactored body content into a separate component and used body content component with header component to create section body component * completed basic structure and font sizes * adapted article components to not use container * added key to topic list * finished related topics component
1 parent 7e64121 commit 0557659

File tree

5 files changed

+157
-18
lines changed

5 files changed

+157
-18
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//Component for list of related topics, which displays multiple categories of topic lists
2+
3+
import { Stack } from "react-bootstrap";
4+
import TopicList from "./TopicList";
5+
6+
//accepts an array of objects, which each contain topic category name
7+
//and an array of topics and their corresponding links
8+
//these objects have the following format
9+
/*{
10+
topicCategory: string,
11+
topicList: Array of {topic: string, link: string}
12+
}
13+
*/
14+
15+
export default function RelatedTopicsList({ topicLists }) {
16+
return (
17+
<Stack className="ps-3" style={{ borderLeft: "1px solid black" }}>
18+
<h3 className="related-topics-heading">Related Topics</h3>
19+
<Stack gap={3}>
20+
{topicLists.map(({ topicCategory, topicList }) => (
21+
<TopicList
22+
topicCategory={topicCategory}
23+
topicList={topicList}
24+
key={topicCategory}
25+
/>
26+
))}
27+
</Stack>
28+
</Stack>
29+
);
30+
}

frontend/src/css/custom.css

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/css/custom.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/pages/ArticleExample.js

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,63 @@
11
import ArticleHeader from "../Components/Article/ArticleHeader/ArticleHeader";
22
import BodySection from "../Components/Article/Section/BodySection";
3+
import RelatedTopicsList from "../Components/Article/Topics/RelatedTopicsList";
34
import Header from "../Components/Header";
4-
import TopicList from "../Components/Article/Topics/TopicList";
55
import TableOfContents from "../Components/Article/Section/TableOfContents";
66
import ImageBanner from "../Components/Article/ImageBanner";
7-
import TableOfContents from "../Components/Article/Section/TableOfContents"
7+
8+
//dummy data for related topics list
9+
const relatedTopicsList = [
10+
{
11+
topicCategory: "FOUNDATIONAL CONCEPTS",
12+
topicList: [
13+
{
14+
topic:
15+
"Artificial Intelligence (AI) and its Intersection with Machine Learning",
16+
link: "/",
17+
},
18+
{
19+
topic: "Data Preprocessing and Feature Engineering in Machine Learning",
20+
link: "/",
21+
},
22+
],
23+
},
24+
{
25+
topicCategory: "TYPES OF MACHINE LEARNING",
26+
topicList: [
27+
{
28+
topic:
29+
"Supervised, Unsupervised, and Reinforcement Learning Techniques",
30+
link: "/",
31+
},
32+
{
33+
topic: "Deep Learning and Neural Networks",
34+
link: "/",
35+
},
36+
{
37+
topic: "Natural Language Processing (NLP) and Machine Learning",
38+
link: "/",
39+
},
40+
],
41+
},
42+
{
43+
topicCategory: "APPLICATIONS",
44+
topicList: [
45+
{
46+
topic: "Machine Learning in Business and Marketing",
47+
link: "/",
48+
},
49+
{
50+
topic: "Machine Learning in Healthcare and Biotechnology",
51+
link: "/",
52+
},
53+
{
54+
topic: "The Role of Machine Learning in Automation and Robotics",
55+
link: "/",
56+
},
57+
],
58+
},
59+
];
60+
861
//ONLY for displaying article components until we can construct the full page
962
export default function ArticleExample() {
1063
return (
@@ -53,21 +106,7 @@ export default function ArticleExample() {
53106
</div>
54107

55108
<div style={{ width: "30%" }}>
56-
<TopicList
57-
topicCategory={"Foundational Concepts"}
58-
topicList={[
59-
{
60-
topic:
61-
"Artificial Intelligence (AI) and its Intersection with Machine Learning",
62-
link: "/",
63-
},
64-
{
65-
topic:
66-
"Data Preprocessing and Feature Engineering in Machine Learning",
67-
link: "/",
68-
},
69-
]}
70-
/>
109+
<RelatedTopicsList topicLists={relatedTopicsList} />
71110
</div>
72111
</div>
73112
</div>

frontend/src/scss/ArticleComponents.scss

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,45 @@
6969
}
7070
}
7171

72+
//SectionContent
73+
.section-content-marker-container {
74+
display: flex;
75+
width: 0.7rem;
76+
justify-content: center;
77+
align-items: stretch;
78+
}
79+
80+
.section-content-marker {
81+
display: inline-block;
82+
width: 2px;
83+
background-color: $primary;
84+
}
85+
86+
.section-content-text {
87+
width: calc(100% - 0.7rem);
88+
font-size: calc(1rem + 0.1vw);
89+
90+
@media screen and (max-width: 800px) {
91+
font-size: calc(0.65rem + 0.3vw);
92+
}
93+
94+
@media screen and (max-width: 500px) {
95+
font-size: calc(0.7rem + 0.3vw);
96+
}
97+
}
98+
99+
//Related Topics List
100+
.related-topics-heading {
101+
font-size: calc(0.975rem + 0.1vw);
102+
line-height: 2rem;
103+
font-weight: 600;
104+
}
105+
72106
//Topics List
73107
.topic-list-title,
74108
.topic-link {
75109
font-size: calc(0.65rem + 0.1vw);
110+
font-weight: 600;
76111
}
77112

78113
.topic-link {

0 commit comments

Comments
 (0)