Skip to content

Commit ccb23c3

Browse files
committed
Added FAQs and Refactored Some Code
1 parent 0ce051a commit ccb23c3

File tree

6 files changed

+262
-59
lines changed

6 files changed

+262
-59
lines changed

src/App.jsx

Lines changed: 28 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { useState } from 'react';
2-
import Hero from './Hero';
3-
import Details from './components/kelixirr/Details';
4-
import Toast from './components/VictorEZCodes/Toast';
5-
import ProgressBar from './components/VictorEZCodes/ProgressBar';
6-
import ThemeSwitcher from './components/VictorEZCodes/ThemeSwitcher';
7-
import SearchFilter from './components/VictorEZCodes/SearchFilter';
8-
import FormValidator from './components/VictorEZCodes/FormValidator';
1+
import { useState } from "react";
2+
import Hero from "./Hero";
3+
import Details from "./components/kelixirr/Details";
4+
import Toast from "./components/VictorEZCodes/Toast";
5+
import ProgressBar from "./components/VictorEZCodes/ProgressBar";
6+
import ThemeSwitcher from "./components/VictorEZCodes/ThemeSwitcher";
7+
import SearchFilter from "./components/VictorEZCodes/SearchFilter";
8+
import FormValidator from "./components/VictorEZCodes/FormValidator";
9+
import AccordionItems from "./components/kelixirr/AccordionItems";
910

1011
function App() {
1112
const [showToast, setShowToast] = useState(false);
@@ -15,58 +16,37 @@ function App() {
1516
<>
1617
<Hero />
1718
<Details />
18-
19+
<AccordionItems />
20+
<ProgressBar progress={progress} />
21+
<ThemeSwitcher />
22+
<SearchFilter />
23+
<FormValidator />
24+
25+
{/* Please Add Your Component Above This. Don't Add Div inside App, just component. Keep It Clean*/}
1926
{/* Toast Demo Section */}
20-
<div style={{ padding: '40px 20px', borderTop: '1px solid var(--border-color)', textAlign: 'center' }}>
27+
<div
28+
style={{
29+
padding: "40px 20px",
30+
textAlign: "center",
31+
}}
32+
>
2133
<h2>Toast Notifications Demo</h2>
22-
<button
34+
<button
2335
onClick={() => setShowToast(true)}
24-
style={{ padding: '10px 20px', margin: '10px' }}
36+
style={{ padding: "10px 20px", margin: "10px" }}
2537
>
2638
Show Toast
2739
</button>
2840
{showToast && (
29-
<Toast
30-
message="Operation successful!"
31-
type="success"
41+
<Toast
42+
message="Operation successful!"
43+
type="success"
3244
onClose={() => setShowToast(false)}
3345
/>
3446
)}
3547
</div>
36-
37-
{/* Progress Bar Demo Section */}
38-
<div style={{ padding: '40px 20px', borderTop: '1px solid var(--border-color)' }}>
39-
<ProgressBar progress={progress} />
40-
</div>
41-
42-
{/* Theme Switcher Section */}
43-
<div style={{
44-
padding: '40px 20px',
45-
borderTop: '1px solid var(--border-color)',
46-
background: 'var(--background-color)'
47-
}}>
48-
<ThemeSwitcher />
49-
</div>
50-
51-
{/* Search Filter Section */}
52-
<div style={{
53-
padding: '40px 20px',
54-
background: 'var(--background-alt)',
55-
borderTop: '1px solid var(--border-color)'
56-
}}>
57-
<SearchFilter />
58-
</div>
59-
60-
{/* Form Validator Section */}
61-
<div style={{
62-
padding: '40px 20px',
63-
borderTop: '1px solid var(--border-color)',
64-
background: 'var(--background-color)'
65-
}}>
66-
<FormValidator />
67-
</div>
6848
</>
6949
);
7050
}
7151

72-
export default App;
52+
export default App;

src/Author.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export default function Author({ name, githubLink }) {
1616
gap: "0.75rem",
1717
fontSize: "0.875rem",
1818
color: "#222",
19+
marginTop: "8rem",
20+
marginBottom: "2.4rem"
1921
}}
2022
>
2123
<span>The Above Component Is Created By {name}</span>

src/Hero.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import Author from "./Author";
21
import styles from "./Hero.module.css";
3-
import { FaGithub, FaStar, FaQuestionCircle} from "react-icons/fa";
2+
import { FaGithub, FaStar, FaQuestionCircle } from "react-icons/fa";
43

54
export default function Hero() {
65
return (
@@ -51,7 +50,6 @@ export default function Hero() {
5150
</a>
5251
</div>
5352
</section>
54-
<Author name="Amritesh Kumar" githubLink="https://github.com/kelixirr" />
5553
</div>
5654
);
5755
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import { useState } from "react";
2+
import { IoMdArrowDropdownCircle, IoMdArrowDropupCircle } from "react-icons/io";
3+
import styles from "./../kelixirr/AccordionItems.module.css";
4+
import { WiStars } from "react-icons/wi";
5+
import Author from "../../Author";
6+
7+
export default function AccordionItems() {
8+
const accs = [
9+
{
10+
id: 1,
11+
title: "Who can contribute?",
12+
content:
13+
"This project is open to anyone, regardless of experience. Whether you are just starting with React or have basic knowledge of front-end development, you can contribute. The goal is to create a collaborative learning environment where people of all skill levels can participate and grow.",
14+
},
15+
{
16+
id: 2,
17+
title: "How do I contribute a component?",
18+
content:
19+
"To contribute a component, first, fork the repository and create a new branch for your changes. Then, you can start building the component of your choice. Once you've completed your component, ensure that it follows the project's guidelines, such as naming conventions and structure, and then submit a pull request. Don’t worry if you're unsure — there is a documentation to help you through each step.",
20+
},
21+
{
22+
id: 3,
23+
title: "What kind of components can I contribute?",
24+
content:
25+
"You can contribute any React component that you feel comfortable building. It can be anything from a simple button, input form, or card to more complex components like modals, sliders, games, or navigation bars. Just make sure they follow our design guidelines",
26+
},
27+
{
28+
id: 4,
29+
title: "Will my contributions be reviewed?",
30+
content:
31+
"Yes, all contributions will be reviewed by the maintainers of the project. They will check the code for correctness, ensure it meets the project's standards, and provide constructive feedback. If your contribution is accepted, it will be merged into the main codebase, and you’ll get credit for your work.",
32+
},
33+
{
34+
id: 5,
35+
title: "Can I ask for help if I get stuck?",
36+
content:
37+
"Absolutely! This project is all about learning, so feel free to ask for help. You can open an issue in the repository",
38+
},
39+
{
40+
id: 6,
41+
title: "How will this project help me improve my skills?",
42+
content:
43+
"Contributing to this project will help you practice key front-end skills like React, component-based architecture, and JavaScript. You'll also gain experience with version control (Git), collaboration tools, and code review processes. Plus, working on real-world projects is a great way to build your portfolio and showcase your skills to potential employers or collaborators.",
44+
},
45+
{
46+
id: 7,
47+
title: "Will I receive credit for my contribution?",
48+
content:
49+
"Yes, all contributors will be credited for their work. Each accepted pull request will be attributed to you, and we will include your GitHub profile in the project’s contributor list. If you’re building components as part of your portfolio, this is a great way to demonstrate your involvement in an open-source project. Above all don't forget to add our Author component below your component so that people can know who created it.",
50+
},
51+
];
52+
53+
const initialState = accs.reduce((state, item) => {
54+
if (item.id === 1) {
55+
state[item.id] = true;
56+
} else {
57+
state[item.id] = false;
58+
}
59+
return state;
60+
}, {});
61+
62+
const [accstate, setAccState] = useState(initialState);
63+
64+
const handleAcc = (id) => {
65+
setAccState((state) => ({
66+
...Object.fromEntries(Object.keys(state).map((key) => [key, false])),
67+
[id]: !state[id],
68+
}));
69+
};
70+
71+
return (
72+
<>
73+
<div className={styles.AccordionContainer}>
74+
<div className={styles.Accordion}>
75+
<h3 className={styles.AccordionH3}>
76+
<WiStars />
77+
FAQs: In Case!
78+
</h3>
79+
<ul className={styles.AccordionUl}>
80+
{accs.map((acc) => (
81+
<li
82+
key={acc.id}
83+
onClick={() => handleAcc(acc.id)}
84+
className={`${styles.AccordionUlLi} ${
85+
accstate[acc.id] ? styles.activeLi : ""
86+
}`}
87+
>
88+
<div className={styles.AccordionUlLiDiv}>
89+
<h3>{acc.title}</h3>
90+
{accstate[acc.id] ? (
91+
<IoMdArrowDropupCircle />
92+
) : (
93+
<IoMdArrowDropdownCircle />
94+
)}
95+
</div>
96+
{accstate[acc.id] && <p>{acc.content}</p>}
97+
</li>
98+
))}
99+
</ul>
100+
</div>
101+
</div>
102+
<Author name="Amritesh Kumar" githubLink="https://github.com/kelixirr" />
103+
</>
104+
);
105+
}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
.AccordionContainer {
2+
display: flex;
3+
justify-content: center;
4+
align-items: center;
5+
margin-bottom: var(--spacing-xl-2);
6+
}
7+
8+
.AccordionH3 {
9+
font-size: var(--font-size-heading-hero);
10+
text-align: left;
11+
margin-left: var(--spacing-lg);
12+
color: var(--primary-color);
13+
margin-bottom: var(--spacing-xl-4);
14+
}
15+
16+
.AccordionH3 svg {
17+
color: var(--primary-color-hover);
18+
}
19+
20+
.Accordion {
21+
width: var(--max-width-container);
22+
padding: var(--spacing-xl);
23+
}
24+
25+
.AccordionUl {
26+
margin: var(--spacing-xl) var(--spacing-xl);
27+
}
28+
29+
.AccordionUlLi {
30+
list-style: none;
31+
margin-bottom: var(--spacing-xl);
32+
border-radius: var(--border-radius-md);
33+
border: 1px solid var(--border-color);
34+
padding: var(--spacing-lg);
35+
background-color: #f7fbff;
36+
transition: transform var(--transition-base);
37+
cursor: pointer;
38+
}
39+
40+
.AccordionUlLi svg {
41+
color: var(--text-light-color);
42+
font-size: 3.2rem;
43+
flex-shrink: 0;
44+
width: 2.4rem;
45+
height: 2.4rem;
46+
min-width: 2.4rem;
47+
}
48+
49+
.AccordionUlLi:hover {
50+
border-top: 2px solid var(--primary-color);
51+
background-color: #e9f4ff;
52+
transform: translateY(-5px);
53+
}
54+
55+
.AccordionUlLiDiv {
56+
display: flex;
57+
justify-content: space-between;
58+
gap: 1.5rem;
59+
}
60+
61+
.AccordionUlLiDiv h3 {
62+
margin-bottom: var(--spacing-md);
63+
font-size: var(--font-size-heading);
64+
color: var(--text-light-color);
65+
flex: 1;
66+
min-width: 0;
67+
}
68+
69+
.activeLi {
70+
border-top: 2px solid var(--primary-color);
71+
}
72+
73+
.activeLi,
74+
.activeLi h3,
75+
.activeLi svg {
76+
color: var(--primary-color);
77+
}
78+
79+
.AccordionUlLi p {
80+
font-size: var(--font-size-base);
81+
line-height: var(--line-height-base);
82+
color: var(--text-color);
83+
}
84+
85+
.AccordionUlLi p {
86+
width: 90%;
87+
font-size: 1.8rem;
88+
line-height: 1.8;
89+
color: #272727;
90+
}
91+
92+
93+
@media (max-width: 76.8rem) {
94+
.AccordionUlLi svg {
95+
width: 2rem;
96+
height: 2rem;
97+
min-width: 2rem;
98+
}
99+
100+
.AccordionUlLiDiv h3 {
101+
font-size: 2rem;
102+
}
103+
104+
.AccordionUl {
105+
margin: 0;
106+
}
107+
}
108+
109+
@media (max-width: 45rem) {
110+
.AccordionUlLi svg {
111+
width: 1.6rem;
112+
height: 1.6rem;
113+
min-width: 1.6rem;
114+
}
115+
116+
.AccordionUlLiDiv h3 {
117+
font-size: 1.8rem;
118+
}
119+
}

src/components/kelixirr/Details.jsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export default function Details() {
3030
<p>
3131
Welcome to the <strong>ReactDevs</strong> project! This project allows
3232
contributors to add React components that are simple yet creative.
33-
It&apos;s a great way to practice, collaborate, and learn React in an open source environment. Here is an
34-
example:
33+
It&apos;s a great way to practice, collaborate, and learn React in an
34+
open source environment. Here is an example:
3535
</p>
3636

3737
<div className={styles.cartContainer}>
@@ -63,9 +63,9 @@ export default function Details() {
6363
Once you have created your component, add the Author component as
6464
shown above to get the credit. Here is the example code:
6565
</p>
66-
<pre className={styles.codeBlock}>
67-
<code>
68-
{`import { useState } from "react";
66+
<pre className={styles.codeBlock}>
67+
<code>
68+
{`import { useState } from "react";
6969
import styles from "../your_username/Cart.module.css";
7070
import { FaCartShopping } from "react-icons/fa6";
7171
import { FiMinus, FiPlus } from "react-icons/fi";
@@ -115,8 +115,8 @@ export default function Cart() {
115115
</>
116116
);
117117
}`}
118-
</code>
119-
</pre>
118+
</code>
119+
</pre>
120120
<p style={{ textAlign: "center", marginTop: "2.4rem" }}>
121121
Good Luck! We can&apos; wait to see you being part of this project!{" "}
122122
<a
@@ -133,7 +133,6 @@ export default function Cart() {
133133
</a>
134134
</p>
135135
</section>
136-
<Author name="Amritesh Kumar" githubLink="https://github.com/kelixirr" />
137136
</>
138137
);
139138
}

0 commit comments

Comments
 (0)