Skip to content

Commit 6aa0214

Browse files
authored
#42: created related tags section for article results page
1 parent da0dbef commit 6aa0214

File tree

5 files changed

+112
-4
lines changed

5 files changed

+112
-4
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@import "bootstrap/scss/bootstrap-grid.scss";
2+
@import "bootstrap/scss/grid";
3+
@import "bootstrap/scss/variables";
4+
@import "bootstrap/scss/mixins";
5+
@import "bootstrap/scss/functions";
6+
@import "../../../scss/variables";
7+
8+
9+
.article-results-side-section-title {
10+
margin-bottom: 1rem;
11+
font-size: calc(0.8rem + 0.5vw);
12+
font-weight: 600;
13+
@include media-breakpoint-up(sm) {
14+
font-size: calc(1.2rem + 0.5vw);
15+
}
16+
}
17+
18+
.article-results-section-content {
19+
padding-left: 10px;
20+
}
21+
22+
@include color-mode(light) {
23+
.article-results-side-section-title {
24+
color: $primary-text-light;
25+
}
26+
}
27+
@include color-mode(dark) {
28+
.article-results-side-section-title {
29+
color: $primary-text-dark;
30+
}
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import "./RelatedTopicTags.scss";
2+
import "../ArticleResultSideSection.scss";
3+
//tags : array of tag objects
4+
export default function RelatedTags({ tags }) {
5+
return (
6+
<div
7+
className="article-results-side-section"
8+
id="related-topic-tags-section"
9+
>
10+
<h3
11+
id="related-topic-tags-section-title"
12+
className="article-results-side-section-title"
13+
>
14+
Related Topics
15+
</h3>
16+
<div className="article-results-section-content related-topic-tags-container">
17+
{tags.map((tag) => {
18+
return (
19+
<span
20+
key={tag.label}
21+
id={tag.label + "-topic"}
22+
className="related-topic-tag"
23+
>
24+
{tag.label}
25+
</span>
26+
);
27+
})}
28+
</div>
29+
</div>
30+
);
31+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@import "bootstrap/scss/bootstrap-grid.scss";
2+
@import "bootstrap/scss/grid";
3+
@import "bootstrap/scss/variables";
4+
@import "bootstrap/scss/mixins";
5+
@import "bootstrap/scss/functions";
6+
@import "../../../../scss/variables";
7+
.related-topic-tag {
8+
background: $related-topic-tag-bg;
9+
color: white;
10+
border-radius: 20px;
11+
padding: 5px 8px;
12+
white-space: nowrap;
13+
font-weight: 600;
14+
font-size: calc(0.5rem + 0.1vw);
15+
@include media-breakpoint-up(sm) {
16+
font-size: calc(0.7rem + 0.1vw);
17+
}
18+
19+
&:hover {
20+
filter: brightness(1.2);
21+
cursor: pointer;
22+
}
23+
24+
&:active {
25+
filter: brightness(0.8);
26+
position: relative;
27+
top: 1px;
28+
cursor: auto;
29+
}
30+
}
31+
32+
.related-topic-tags-container {
33+
display: flex;
34+
flex-flow: wrap;
35+
gap: 10px 8px;
36+
}

frontend/src/pages/ArticleList.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { useEffect, useState } from "react";
2-
import { Card, Stack } from "react-bootstrap";
32
import { useParams, useSearchParams } from "react-router-dom";
4-
import LinkedDescriptionBox from "../Components/LinkedDescriptionBox.jsx";
3+
import RelatedTags from "../Components/ArticleResult/SideSections/RelatedTopicTags/RelatedTopicTags.jsx";
54
import ArticleResultsList from "../Components/ArticleResults/ArticleResultsList.jsx";
5+
const dummy_topic_tags = [
6+
{ label: "Deep Learning" },
7+
{ label: "Artifical Intelligence" },
8+
{ label: "Computer Vision" },
9+
{ label: "Data Science" },
10+
];
611
const dummmy_articles = [
712
{
813
id: 1,
@@ -23,6 +28,7 @@ const dummmy_articles = [
2328
isBookmarked: false,
2429
},
2530
];
31+
2632
export default function ArticleList({}) {
2733
const [articles, setArticles] = useState(dummmy_articles);
2834
const [searchParams, setSearchParams] = useSearchParams();
@@ -78,6 +84,7 @@ export default function ArticleList({}) {
7884

7985
return (
8086
<div className="flex-grow-1">
87+
<RelatedTags tags={dummy_topic_tags} />
8188
<ArticleResultsList
8289
articles={dummmy_articles}
8390
bookmarkTogglerCreator={bookmarkTogglerCreator}

frontend/src/scss/variables/_variables-universal.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ $link-text: #2c6ae1;
55
$header-footer-bg: #312f2f;
66
$header-text: #f4e4bb;
77

8+
//Related Topic Tags
9+
$related-topic-tag-bg: #2c6ae1;
10+
811
//popover
912
$popover-header-bg: #063ba1;
1013
$popover-body-bg: #2c6ae1;
@@ -19,8 +22,8 @@ $settings-article-search-bar: #d5d5d5;
1922

2023
//Sign Pages
2124
$sign-page-title: #366092;
22-
$welcome-section-link: #4E8AD1;
23-
$sign-input-placeholder: #6B6565;
25+
$welcome-section-link: #4e8ad1;
26+
$sign-input-placeholder: #6b6565;
2427

2528
//fonts
2629
@font-face {

0 commit comments

Comments
 (0)