Skip to content

Commit aa408fe

Browse files
authored
Merge pull request #3978 from CodeHarborHub/dev-3
Dev 3
2 parents 8b5e892 + d7b883c commit aa408fe

File tree

4 files changed

+154
-162
lines changed

4 files changed

+154
-162
lines changed

courses/html/basic/setting-up-html-environment.md

Whitespace-only changes.

docusaurus.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ const config = {
165165
value: `<div class="dropdown_grid">
166166
<a class="dropbtn" href="/courses/"> Courses </a>
167167
<div class="dropdown-content">
168+
<a href="/courses/category/html" class="nav__icons"> <img src="/icons/html-5.svg" alt="HTML" /> </a>
168169
<a href="/courses/category/reactjs/" class="nav__icons"> <img src="/icons/jsx.svg" alt="React" /> </a>
169170
</div>
170171
</div>`,

src/components/HomePage/Community/index.tsx

+45-56
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
1-
import React, { type FC, useEffect, useState } from "react";
1+
import React, { type FC, useEffect, useState, useMemo } from "react";
22
import { useCommunityStatsContext } from "../../../context/CommunityStats";
3-
import "./LandingCommunity.css";
3+
import "./LandingCommunity.css";
44

55
type Props = {
66
className?: string;
77
};
88

99
export const LandingCommunity: FC<Props> = ({ className }) => {
10-
const { githubStarCountText } = useCommunityStatsContext();
11-
const [state, setState] = useState({
12-
stat0: 0,
13-
stat1: 0,
14-
stat2: 0,
15-
stat3: 0,
10+
const { githubStarCountText, githubContributorsCount, githubForksCount } = useCommunityStatsContext();
11+
const [state, setState] = useState({
12+
stat0: 0,
13+
stat1: 0,
14+
stat2: 0,
15+
stat3: 0,
1616
});
1717

18-
const generateList = () => [
18+
const generateList = useMemo(() => [
1919
{
20-
stat: Number(githubStarCountText)>0?githubStarCountText:83,
20+
stat: githubStarCountText,
2121
description: "Stars on our GitHub repository, showcasing our community's support and contribution.",
22-
href: "https://github.com/CodeHarborHub/codeharborhub.github.io",
22+
href: "https://github.com/CodeHarborHub/codeharborhub.github.io/stargazers",
2323
},
2424
{
2525
stat: 30,
2626
description: "Live projects on CodeHarborHub, demonstrating the power of open-source collaboration.",
2727
},
2828
{
29-
stat: 100,
30-
description: "Active developers engaged in our vibrant open-source community, collaborating and innovating.",
29+
stat: githubContributorsCount,
30+
description: "Contributors who have made our repository better.",
31+
href: "https://github.com/CodeHarborHub/codeharborhub.github.io/graphs/contributors",
3132
},
3233
{
33-
stat: 600,
34-
description: "Active learners in the CodeHarborHub community, continuously expanding their knowledge and skills.",
34+
stat: githubForksCount,
35+
description: "Forks of our repository, showing how our community extends our work.",
36+
href: "https://github.com/CodeHarborHub/codeharborhub.github.io/network/members",
3537
},
36-
];
38+
], [githubStarCountText, githubContributorsCount, githubForksCount]);
3739

38-
const handleDynamicChange = (target, index) => {
40+
const handleDynamicChange = (target: number, index: number) => {
3941
let count = 0;
4042
const increment = target / 100;
4143
const interval = setInterval(() => {
@@ -44,45 +46,41 @@ export const LandingCommunity: FC<Props> = ({ className }) => {
4446
if (count >= target) {
4547
setState(prev => ({ ...prev, [`stat${index}`]: target }));
4648
clearInterval(interval);
47-
setTimeout(() => {
48-
handleDynamicChange(target, index);
49-
}, 3000);
5049
}
5150
}, 20);
5251
};
5352

54-
useEffect(() => {
55-
const list = generateList();
56-
list.forEach((item, index) => {
57-
handleDynamicChange(item.stat, index);
53+
useEffect(() => {
54+
generateList.forEach((item, index) => {
55+
handleDynamicChange(Number(item.stat), index);
5856
});
59-
},[githubStarCountText]);
57+
}, [generateList]);
6058

6159
return (
62-
<div className="landing-community">
60+
<div className={`landing-community ${className || ""}`}>
6361
<div className="landing-community__header">
6462
<h2 className="landing-community__title">
6563
Discover the strength of our{" "}
66-
<span className="landing-community__highlight">
67-
amazing community
68-
</span>
69-
.
64+
<span className="landing-community__highlight">amazing community</span>.
7065
</h2>
7166
</div>
7267

7368
<div className="landing-community__content">
7469
<div className="landing-community__stats">
75-
{generateList().map((item, index) => (
70+
{generateList.map((item, index) => (
7671
<span key={index} className="landing-community__stat-item">
7772
<div className="landing-community__stat-value">
78-
<a
79-
href={item.href}
80-
target="_blank"
81-
rel="noopener noreferrer"
82-
key={index}
83-
>
84-
{`${state[`stat${index}`]}${index !== 0 ? "+" : ""}`}
85-
</a>
73+
{item.href ? (
74+
<a
75+
href={item.href}
76+
target="_blank"
77+
rel="noopener noreferrer"
78+
>
79+
{`${state[`stat${index}`]}${index !== 1 ? "" : ""}`}
80+
</a>
81+
) : (
82+
`${state[`stat${index}`]}`
83+
)}
8684
</div>
8785
<div className="landing-community__stat-description">
8886
{item.description}
@@ -95,39 +93,30 @@ export const LandingCommunity: FC<Props> = ({ className }) => {
9593
<img
9694
className="landing-community__image"
9795
src="/img/svg/team_collaboration.svg"
98-
alt="investors"
96+
alt="team collaboration"
9997
loading="lazy"
10098
/>
10199
<div className="landing-community__info-text">
102-
Our developer is the heartbeat of CodeHarborHub. We take pride in
100+
Our developers are the heartbeat of CodeHarborHub. We take pride in
103101
our{" "}
104102
<a
105103
href="https://github.com/CodeHarborHub/codeharborhub.github.io/graphs/contributors"
106104
target="_blank"
107105
rel="noopener noreferrer"
108106
className="landing-community__link"
109107
>
110-
LinkedIn community
111-
</a>
112-
{" with over, "}
113-
<a
114-
href=""
115-
target="_blank"
116-
rel="noopener noreferrer"
117-
className="landing-community__link"
118-
>
119-
100+ contributors
120-
</a>
121-
{" and "}
108+
GitHub community
109+
</a>{" "}
110+
with over{" "}
122111
<a
123112
href="https://github.com/CodeHarborHub/codeharborhub.github.io"
124113
target="_blank"
125114
rel="noopener noreferrer"
126115
className="landing-community__link"
127116
>
128-
powering CodeHarborHub
129-
</a>
130-
.
117+
100+ contributors
118+
</a>{" "}
119+
powering CodeHarborHub.
131120
</div>
132121
</div>
133122
</div>

0 commit comments

Comments
 (0)