Skip to content

Commit f2aaf7b

Browse files
committed
programming languages pager don
1 parent 0342b86 commit f2aaf7b

File tree

8 files changed

+287
-0
lines changed

8 files changed

+287
-0
lines changed

public/cheatsheets/flutter.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
## Flutter Cheatsheet
2+
3+
This cheatsheet provides a beginner-friendly introduction to **Flutter** for building cross-platform mobile applications with a single codebase.
4+
5+
## Learning Objectives
6+
- Understand the basics of Flutter and its architecture.
7+
- Learn how to create and manage widgets.
8+
- Understand state management in Flutter.
9+
- Implement navigation and routing between screens.
10+
- Use forms and handle user input.
11+
- Learn about HTTP requests and fetching data from APIs.
12+
- Customize the look and feel of apps using themes.
13+
- Understand how to use Firebase for backend integration.
14+
15+
## Cheatsheet Outline
16+
17+
### Module 1: Introduction to Flutter
18+
- Overview of Flutter and Dart.
19+
- Setting up the Flutter development environment.
20+
21+
### Module 2: Widgets and Layouts
22+
- Understanding Flutter’s widget tree.
23+
- Working with basic widgets like `Text`, `Container`, and `Row`.
24+
25+
### Module 3: State Management
26+
- Managing state using `StatefulWidget` and `Provider`.
27+
- Understanding the `setState()` function.
28+
29+
### Module 4: Navigation and Routing
30+
- Implementing navigation between screens.
31+
- Using the `Navigator` and routing techniques.
32+
33+
### Module 5: Forms and Input Handling
34+
- Creating forms using `TextFormField`.
35+
- Validating user input.
36+
37+
### Module 6: Networking
38+
- Using `http` package to make API requests.
39+
- Parsing JSON data in Flutter.
40+
41+
### Module 7: Theming and Styling
42+
- Customizing widgets using themes.
43+
- Creating consistent styling across the app.
44+
45+
### Module 8: Firebase Integration
46+
- Setting up Firebase in a Flutter app.
47+
- Using Firebase Authentication and Firestore.
48+
49+
## Prerequisites
50+
- Basic knowledge of programming.
51+
- Familiarity with object-oriented concepts.
52+
53+
## Conclusion
54+
By the end of this cheatsheet, users will be equipped with the knowledge to build simple, functional mobile applications using **Flutter**.

public/cheatsheets/javascript.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
## JavaScript Cheatsheet
2+
3+
This cheatsheet covers essential **JavaScript** concepts, providing a quick reference guide for beginners who want to master JavaScript fundamentals.
4+
5+
## Learning Objectives
6+
- Understand JavaScript syntax and data types.
7+
- Work with variables and functions.
8+
- Learn about JavaScript's scope and closures.
9+
- Understand how to manipulate the DOM.
10+
- Explore asynchronous programming using promises and `async/await`.
11+
- Learn about ES6+ features like arrow functions, destructuring, and modules.
12+
- Implement object-oriented programming in JavaScript.
13+
- Utilize common array methods for data manipulation.
14+
15+
## Cheatsheet Outline
16+
17+
### Module 1: JavaScript Basics
18+
- Overview of JavaScript and its role in web development.
19+
- Data types and variables (`var`, `let`, `const`).
20+
21+
### Module 2: Functions and Scope
22+
- Creating functions and understanding their scope.
23+
- Arrow functions and their usage.
24+
25+
### Module 3: Control Flow
26+
- Using `if`, `else`, `switch`, and loops (`for`, `while`).
27+
28+
### Module 4: DOM Manipulation
29+
- Selecting and modifying HTML elements using JavaScript.
30+
- Understanding `querySelector` and `getElementById`.
31+
32+
### Module 5: Asynchronous JavaScript
33+
- Introduction to callbacks, promises, and `async/await`.
34+
- Using `fetch` for making HTTP requests.
35+
36+
### Module 6: ES6+ Features
37+
- Using `let` and `const` for variable declarations.
38+
- Object and array destructuring.
39+
- Import/export modules.
40+
41+
### Module 7: Object-Oriented JavaScript
42+
- Understanding objects, classes, and inheritance.
43+
- Creating and using classes in JavaScript.
44+
45+
### Module 8: Array Methods
46+
- Overview of common array methods like `map`, `filter`, `reduce`, and `forEach`.
47+
- Examples of using these methods for data transformation.
48+
49+
## Prerequisites
50+
- Basic understanding of HTML and CSS.
51+
- No prior programming experience is required.
52+
53+
## Conclusion
54+
By the end of this cheatsheet, users will have a strong grasp of **JavaScript** fundamentals and be ready to build dynamic, interactive web applications.

public/cheatsheets/react.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
## React Cheatsheet
2+
3+
This cheatsheet is designed for beginners to get started with **React**. It covers key concepts and components that are fundamental to building user interfaces with React.
4+
5+
## Learning Objectives
6+
- Understand the basics of React components and their lifecycle.
7+
- Create functional and class components.
8+
- Learn how to manage state and props.
9+
- Grasp the concept of hooks and their usage.
10+
- Implement event handling in React components.
11+
- Understand conditional rendering and list rendering.
12+
- Explore the use of forms and controlled components.
13+
- Use React Router for navigation between pages.
14+
15+
## Cheatsheet Outline
16+
17+
### Module 1: Introduction to React
18+
- Overview of React and its role in frontend development.
19+
- Setting up a React environment using `create-react-app`.
20+
21+
### Module 2: Components and JSX
22+
- Understanding the role of components in React.
23+
- Introduction to JSX syntax and its usage.
24+
25+
### Module 3: State and Props
26+
- Managing component state using `useState`.
27+
- Passing data between components using props.
28+
29+
### Module 4: Hooks
30+
- Overview of React hooks and their purpose.
31+
- Using `useEffect` for handling side effects.
32+
33+
### Module 5: Event Handling
34+
- Handling user events like clicks and form submissions.
35+
- Event binding in functional components.
36+
37+
### Module 6: Conditional and List Rendering
38+
- Using conditional statements like `if` and the ternary operator.
39+
- Rendering lists using the `map()` function.
40+
41+
### Module 7: Forms and Controlled Components
42+
- Creating forms with controlled components.
43+
- Handling form data using state.
44+
45+
### Module 8: React Router
46+
- Setting up routing in a React app using `react-router-dom`.
47+
- Creating navigation between different pages.
48+
49+
## Prerequisites
50+
- Basic understanding of JavaScript and ES6+ features.
51+
- Familiarity with HTML and CSS.
52+
53+
## Conclusion
54+
By the end of this cheatsheet, users will have a foundational understanding of building interactive web applications with **React**.

src/App.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ import courses from './data/courseData';
2222
import Footer from './components/Footer';
2323
import Contributors from './pages/GithubFetch';
2424
import Events from './pages/Events';
25+
import Programming from './pages/ProgrammingLanguage';
26+
import ProgrammingLanguage from './pages/ProgrammingLanguage';
27+
import CheatsheetDetail from './pages/CheatsheetDetail';
2528

2629
function App() {
2730
const [user, setUser] = useState(null);
@@ -72,6 +75,8 @@ function App() {
7275
<Route path="/search" element={<SearchResults />} />
7376
<Route path="/contributors" element={<Contributors />}></Route>
7477
<Route path="/events" element={<Events />} />
78+
<Route path="/programming-languages" element={<ProgrammingLanguage />}/>
79+
<Route path="/programming-languages/:cheatsheetName" element={<CheatsheetDetail/>}/>
7580
</Routes>
7681
<ToastContainer />
7782
</div>

src/data/cheatsheetsData.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const cheatsheets = {
2+
'react_cheatsheet': {
3+
title: 'React Cheatsheet',
4+
author: 'Dev Gautam Kumar',
5+
image: 'https://dummyimage.com/600x400/2196F3/fff&text=React+Cheatsheet', // Blue
6+
description: 'Quick reference guide for building React apps.',
7+
contentFile: 'react.md',
8+
},
9+
'flutter_cheatsheet': {
10+
title: 'Flutter Cheatsheet',
11+
author: 'Dev Gautam Kumar',
12+
image: 'https://dummyimage.com/600x400/4CAF50/fff&text=Flutter+Cheatsheet', // Green
13+
description: 'Reference guide for developing mobile apps with Flutter.',
14+
contentFile: 'flutter.md',
15+
},
16+
'javascript_cheatsheet': {
17+
title: 'JavaScript Cheatsheet',
18+
author: 'Dev Gautam Kumar',
19+
image: 'https://dummyimage.com/600x400/FF9800/fff&text=JavaScript+Cheatsheet', // Orange
20+
description: 'Essential JavaScript concepts and syntax in one place.',
21+
contentFile: 'javascript.md',
22+
},
23+
};
24+
25+
export default cheatsheets;

src/pages/CheatsheetDetail.jsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React, { useState, useEffect } from 'react';
2+
import { useParams } from 'react-router-dom';
3+
import cheatsheets from '@/data/cheatsheetsData';
4+
import { marked } from 'marked';
5+
6+
function CheatsheetDetail() {
7+
const { cheatsheetName } = useParams();
8+
const cheatsheetKey = cheatsheetName.toLowerCase();
9+
const cheatsheet = cheatsheets[cheatsheetKey];
10+
11+
const [content, setContent] = useState('');
12+
13+
// Check if cheatsheet exists
14+
if (!cheatsheet) {
15+
return <h2 className="text-center">Cheatsheet not found</h2>;
16+
}
17+
18+
// Fetch the Markdown file
19+
useEffect(() => {
20+
const fetchMarkdown = async () => {
21+
try {
22+
const response = await fetch(`/cheatsheets/${cheatsheet.contentFile}`); // Use the contentFile property
23+
if (!response.ok) {
24+
throw new Error(`Error fetching markdown file: ${response.status}`);
25+
}
26+
const text = await response.text();
27+
setContent(marked(text)); // Convert Markdown to HTML
28+
// console.log('Markdown content:', marked(text)); // Log the converted content
29+
} catch (error) {
30+
console.error('Error fetching the markdown file:', error);
31+
}
32+
};
33+
fetchMarkdown();
34+
}, [cheatsheet.contentFile]);
35+
36+
return (
37+
<div className="container mt-5">
38+
{/* <h1>{cheatsheet.title}</h1>
39+
<p>{cheatsheet.description}</p> */}
40+
<div dangerouslySetInnerHTML={{ __html: content }} /> {/* Render the converted content */}
41+
</div>
42+
);
43+
}
44+
45+
export default CheatsheetDetail;

src/pages/Programming.jsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React from 'react';
2+
import { Link } from 'react-router-dom';
3+
4+
function Programming({ courses }) {
5+
if (!courses || Object.keys(courses).length === 0) {
6+
return <h2 className="text-center">No cheatsheets available!</h2>;
7+
}
8+
9+
return (
10+
<div>
11+
<h1 className="text-center my-4">Cheatsheets</h1>
12+
<div className="container my-4">
13+
{/* <h2 className="text-center mb-4">Cheatsheets</h2> */}
14+
<div className="row row-cols-1 row-cols-md-3 g-3">
15+
{Object.entries(courses).map(([key, cheatsheet], index) => (
16+
<div className="col" key={index}>
17+
<div className="card h-100">
18+
<Link to={`/programming-languages/${key}`} className="lnk">
19+
<img
20+
src={cheatsheet.image}
21+
className="card-img-top"
22+
alt={cheatsheet.title}
23+
/>
24+
<div className="card-body">
25+
<h5 className="card-title">{cheatsheet.title}</h5>
26+
<p className="card-text">{cheatsheet.description}</p>
27+
</div>
28+
</Link>
29+
</div>
30+
</div>
31+
))}
32+
</div>
33+
</div>
34+
</div>
35+
);
36+
}
37+
38+
export default Programming;

src/pages/ProgrammingLanguage.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
// import courses from '@/data/courseData';
3+
import Programming from './Programming';
4+
import cheatsheets from '@/data/cheatsheetsData';
5+
6+
function ProgrammingLanguage(){
7+
return <div>
8+
<Programming courses={cheatsheets} />
9+
</div>
10+
}
11+
12+
export default ProgrammingLanguage;

0 commit comments

Comments
 (0)