Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3dc8a3b

Browse files
authoredDec 18, 2017
Merge pull request #138 from coderplex/react-guide
react added
2 parents f848c60 + acae377 commit 3dc8a3b

File tree

2 files changed

+188
-160
lines changed

2 files changed

+188
-160
lines changed
 

‎pages/learn/subject.js

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import BannerSection from '../../components/learn/subject-banner';
1212
import SyllabusTree from '../../components/learn/syllabus-tree/syllabus-tree-container';
1313
import SubjectMarkdown from '../../components/learn/subject-marked';
1414

15-
import { laravelSyllabus } from '../../utils/mock-data';
15+
import { laravelSyllabus, reactSyllabus } from '../../utils/mock-data';
1616

1717
const CurriculumSection = styled.section`
1818
${baseContainer};
@@ -56,21 +56,37 @@ const Fab = styled.div`
5656
}
5757
`;
5858

59-
const defaultChapter = laravelSyllabus[0].chapters[0];
60-
6159
export default class Subject extends React.Component {
6260
constructor(props) {
6361
super(props);
6462
this.state = {
63+
activeSubject: this.selectSubject(this.props.url.query.id),
6564
activeChapterContent: '',
66-
activeChapterName: defaultChapter.name,
65+
activeChapterName:
66+
this.selectSubject(this.props.url.query.id) === null
67+
? ''
68+
: this.selectSubject(this.props.url.query.id)[0].chapters[0].name,
6769
loading: true,
6870
isSidebarOpen: true,
6971
};
7072
}
7173

74+
selectSubject(openedGuide) {
75+
switch (openedGuide) {
76+
case 'laravel':
77+
return laravelSyllabus;
78+
case 'reactjs':
79+
return reactSyllabus;
80+
default:
81+
return null;
82+
}
83+
}
84+
7285
componentDidMount() {
73-
this.getChapterContent(defaultChapter);
86+
if (this.state.activeSubject !== null) {
87+
const defaultChapter = this.state.activeSubject[0].chapters[0];
88+
this.getChapterContent(defaultChapter);
89+
}
7490
}
7591

7692
changeChapter = selectedChapter => {
@@ -91,7 +107,11 @@ export default class Subject extends React.Component {
91107
}
92108

93109
render() {
94-
return this.props.url.query.id === 'laravel' ? (
110+
return this.state.activeSubject === null ? (
111+
<Layout>
112+
<Title inverted>Curriculum for {this.props.url.query.id} and others Coming soon!!</Title>
113+
</Layout>
114+
) : (
95115
<Layout>
96116
<BannerSection
97117
textInverted
@@ -104,7 +124,7 @@ export default class Subject extends React.Component {
104124
{this.state.isSidebarOpen ? (
105125
<Box width={[0, 0.2]} flex={'1 1 auto'} className="box_toc">
106126
<div className="toc_title">Table of content</div>
107-
<SyllabusTree data={laravelSyllabus} changeChapter={this.changeChapter} />
127+
<SyllabusTree data={this.state.activeSubject} changeChapter={this.changeChapter} />
108128
</Box>
109129
) : null}
110130
<Box width={[1, 0.8]} flex={'1 1 auto'} px={[1, 2]} className="box_content">
@@ -121,10 +141,6 @@ export default class Subject extends React.Component {
121141
</Flex>
122142
</CurriculumSection>
123143
</Layout>
124-
) : (
125-
<Layout>
126-
<Title inverted>Curriculum for {this.props.url.query.id} and others Coming soon!!</Title>
127-
</Layout>
128144
);
129145
}
130146
}

‎utils/mock-data.js

Lines changed: 161 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const listOfSubjects = [
77
subjectId: 'laravel',
88
icon: 'devicon-laravel-plain colored',
99
learningCount: '20',
10-
learnGuideStatus: true,
10+
isGuideCompleted: true,
1111
},
1212
{
1313
id: '213',
@@ -17,7 +17,7 @@ export const listOfSubjects = [
1717
subjectId: 'reactjs',
1818
icon: 'devicon-react-original colored',
1919
learningCount: '28',
20-
learnGuideStatus: false,
20+
isGuideCompleted: true,
2121
},
2222
{
2323
id: '2131',
@@ -27,7 +27,7 @@ export const listOfSubjects = [
2727
subjectId: 'go',
2828
icon: 'devicon-go-plain colored',
2929
learningCount: '7',
30-
learnGuideStatus: false,
30+
isGuideCompleted: false,
3131
},
3232
{
3333
id: '21fa3',
@@ -37,7 +37,7 @@ export const listOfSubjects = [
3737
subjectId: 'android',
3838
icon: 'devicon-android-plain colored',
3939
learningCount: '9',
40-
learnGuideStatus: false,
40+
isGuideCompleted: false,
4141
},
4242
{
4343
id: '21afasda3',
@@ -47,7 +47,7 @@ export const listOfSubjects = [
4747
subjectId: 'rails',
4848
icon: 'devicon-rails-plain colored',
4949
learningCount: '14',
50-
learnGuideStatus: false,
50+
isGuideCompleted: false,
5151
},
5252
{
5353
id: '21wqerwqe3',
@@ -57,7 +57,7 @@ export const listOfSubjects = [
5757
subjectId: 'python',
5858
icon: 'devicon-python-plain colored',
5959
learningCount: '32',
60-
learnGuideStatus: false,
60+
isGuideCompleted: false,
6161
},
6262
{
6363
id: '2bxcvbx13',
@@ -67,7 +67,7 @@ export const listOfSubjects = [
6767
subjectId: 'ios',
6868
icon: 'devicon-swift-plain colored',
6969
learningCount: '45',
70-
learnGuideStatus: false,
70+
isGuideCompleted: false,
7171
},
7272
{
7373
id: '2bxczzxcvbx13',
@@ -77,7 +77,7 @@ export const listOfSubjects = [
7777
subjectId: 'javascript',
7878
icon: 'devicon-javascript-plain colored',
7979
learningCount: '31',
80-
learnGuideStatus: false,
80+
isGuideCompleted: false,
8181
},
8282
{
8383
id: '2bxdfasczzxcvbx13',
@@ -87,150 +87,10 @@ export const listOfSubjects = [
8787
subjectId: 'angular',
8888
icon: 'devicon-angularjs-plain colored',
8989
learningCount: '3',
90-
learnGuideStatus: false,
90+
isGuideCompleted: false,
9191
},
9292
];
9393

94-
export const indexPageLearns = [
95-
{
96-
link: 'https://github.com/coderplex/learn/blob/master/web-dev/Frontend/Libraries%20%26%20Frameworks/Learn-React.md',
97-
title: 'ReactJS',
98-
subject: 'Frontend Web Development',
99-
image: '',
100-
},
101-
{
102-
link: 'https://github.com/coderplex/learn/blob/master/web-dev/Backend/Learn-Laravel.md',
103-
title: 'Laravel',
104-
subject: 'Backend Web Development',
105-
image: '',
106-
},
107-
{
108-
link: 'https://github.com/coderplex/learn/blob/master/programming-languages/Go/learn-go.md',
109-
title: 'Go',
110-
subject: 'Programming Language',
111-
image: '',
112-
},
113-
{
114-
link: 'https://github.com/coderplex/learn/blob/master/computer-science/Learn-CS.md',
115-
title: 'Introduction to C.S',
116-
subject: 'Computer Science',
117-
image: '',
118-
},
119-
{
120-
link: 'https://github.com/coderplex/learn/blob/master/Blockchain/blockchain-basics.md',
121-
title: 'Blockchain',
122-
subject: 'Decentralized Systems',
123-
image: '',
124-
},
125-
{
126-
link: 'https://github.com/coderplex/learn/blob/master/mobile-dev/Android/learn-android.md',
127-
title: 'Android',
128-
subject: 'Mobile Development',
129-
image: '',
130-
},
131-
];
132-
133-
export const listOfDomains = [
134-
'All',
135-
'Computer Science',
136-
'Programming Language',
137-
'Web Development',
138-
'Mobile Technology',
139-
'Data Science',
140-
'Artificial Intelligence',
141-
'BlockChain',
142-
];
143-
144-
export const contentsOfLaravel = {
145-
overview: 'https://cdn.rawgit.com/coderplex/learn/cdn/cdn/laravel/overview.md',
146-
guides: [
147-
{
148-
name: 'Prerequisites',
149-
url: 'https://cdn.rawgit.com/coderplex/learn/cdn/cdn/laravel/guide/0.md',
150-
},
151-
{
152-
name: 'Introduction to MVC architecture',
153-
url: 'https://cdn.rawgit.com/coderplex/learn/cdn/cdn/laravel/guide/1.md',
154-
},
155-
{
156-
name: 'Models,Views,Controllers and Routes',
157-
url: 'https://cdn.rawgit.com/coderplex/learn/cdn/cdn/laravel/guide/2.md',
158-
},
159-
{
160-
name: 'FrontEnd',
161-
url: 'https://cdn.rawgit.com/coderplex/learn/cdn/cdn/laravel/guide/3.md',
162-
},
163-
{
164-
name: 'Relationships',
165-
url: 'https://cdn.rawgit.com/coderplex/learn/cdn/cdn/laravel/guide/4.md',
166-
},
167-
{
168-
name: 'Authentication',
169-
url: 'https://cdn.rawgit.com/coderplex/learn/cdn/cdn/laravel/guide/5.md',
170-
},
171-
{
172-
name: 'View Composers and Archives',
173-
url: 'https://cdn.rawgit.com/coderplex/learn/cdn/cdn/laravel/guide/6.md',
174-
},
175-
{
176-
name: 'Testing & Seeding',
177-
url: 'https://cdn.rawgit.com/coderplex/learn/cdn/cdn/laravel/guide/7.md',
178-
},
179-
{
180-
name: 'Final Project',
181-
url: 'https://cdn.rawgit.com/coderplex/learn/cdn/cdn/laravel/guide/8.md',
182-
},
183-
],
184-
contributors: [
185-
{
186-
userName: 'P Bhanu Teja',
187-
userPage: 'https://github.com/pbteja1998',
188-
userImage: 'https://avatars0.githubusercontent.com/u/17903466?s=400&v=4',
189-
contributions: [
190-
{
191-
type: 'topic',
192-
count: '20',
193-
},
194-
{
195-
type: 'article',
196-
count: '30',
197-
},
198-
{
199-
type: 'video',
200-
count: '25',
201-
},
202-
],
203-
},
204-
{
205-
userName: 'M Zubair Ahmed',
206-
userPage: 'https://github.com/M-ZubairAhmed',
207-
userImage:
208-
'https://avatars0.githubusercontent.com/u/17708702?s=400&u=032075b378bf6d82da48725b9ce5f31c7a6469fa&v=4',
209-
contributions: [
210-
{
211-
type: 'topic',
212-
count: '2',
213-
},
214-
],
215-
},
216-
{
217-
userName: 'Vinay Puppal',
218-
userPage: 'https://www.vinaypuppal.com/',
219-
userImage: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/214440/profile/profile-512.jpg?2',
220-
contributions: [
221-
{
222-
type: 'topic',
223-
count: '4',
224-
},
225-
{
226-
type: 'article',
227-
count: '2',
228-
},
229-
],
230-
},
231-
],
232-
};
233-
23494
export const laravelSyllabus = [
23595
{
23696
unit: {
@@ -386,3 +246,155 @@ export const laravelSyllabus = [
386246
],
387247
},
388248
];
249+
250+
export const reactSyllabus = [
251+
{
252+
unit: {
253+
name: 'Preface',
254+
},
255+
chapters: [
256+
{
257+
name: 'Choosing ReactJS',
258+
url: 'https://rawgit.com/coderplex/learn/cdn/react/choosing-reactjs.md',
259+
},
260+
{
261+
name: 'Prerequisites',
262+
url: 'https://rawgit.com/coderplex/learn/cdn/react/prerequisites.md',
263+
},
264+
{
265+
name: 'Philosophy',
266+
url: 'https://rawgit.com/coderplex/learn/cdn/react/philosophy.md',
267+
},
268+
],
269+
},
270+
{
271+
unit: {
272+
name: 'Getting Started',
273+
},
274+
chapters: [
275+
{
276+
name: 'Trying React',
277+
url: 'https://rawgit.com/coderplex/learn/cdn/react/trying-react.md',
278+
},
279+
{
280+
name: 'Create React App',
281+
url: 'https://rawgit.com/coderplex/learn/cdn/react/create-react-app.md',
282+
},
283+
{
284+
name: 'JavaScript XML Syntax',
285+
url: 'https://rawgit.com/coderplex/learn/cdn/react/javascript-xml-syntax.md',
286+
},
287+
],
288+
},
289+
{
290+
unit: {
291+
name: 'Components',
292+
},
293+
chapters: [
294+
{
295+
name: 'Custom Components',
296+
url: 'https://rawgit.com/coderplex/learn/cdn/react/custom-components.md',
297+
},
298+
{
299+
name: 'Rendering',
300+
url: 'https://rawgit.com/coderplex/learn/cdn/react/rendering.md',
301+
},
302+
{
303+
name: 'Conditional Rendering',
304+
url: 'https://rawgit.com/coderplex/learn/cdn/react/conditional-rendering.md',
305+
},
306+
{
307+
name: 'Data Flow',
308+
url: 'https://rawgit.com/coderplex/learn/cdn/react/data-flow.md',
309+
},
310+
{
311+
name: 'Lifecycle',
312+
url: 'https://rawgit.com/coderplex/learn/cdn/react/lifecycle.md',
313+
},
314+
{
315+
name: 'Events',
316+
url: 'https://rawgit.com/coderplex/learn/cdn/react/events.md',
317+
},
318+
],
319+
},
320+
{
321+
unit: {
322+
name: 'Forms',
323+
},
324+
chapters: [
325+
{
326+
name: 'Controlled Components',
327+
url: 'https://rawgit.com/coderplex/learn/cdn/react/controlled-components.md',
328+
},
329+
{
330+
name: 'Uncontrolled Components',
331+
url: 'https://rawgit.com/coderplex/learn/cdn/react/uncontrolled-components.md',
332+
},
333+
],
334+
},
335+
{
336+
unit: {
337+
name: 'Composition',
338+
},
339+
chapters: [
340+
{
341+
name: 'Lifting State Up',
342+
url: 'https://rawgit.com/coderplex/learn/cdn/react/lifting-state-up.md',
343+
},
344+
{
345+
name: 'Composition vs Inheritance',
346+
url: 'https://rawgit.com/coderplex/learn/cdn/react/composition-vs-inheritance.md',
347+
},
348+
{
349+
name: 'Context',
350+
url: 'https://rawgit.com/coderplex/learn/cdn/react/context.md',
351+
},
352+
],
353+
},
354+
{
355+
unit: {
356+
name: 'Tools',
357+
},
358+
chapters: [
359+
{
360+
name: 'Developer Tools',
361+
url: 'https://rawgit.com/coderplex/learn/cdn/react/developer-tools.md',
362+
},
363+
{
364+
name: 'Proptypes',
365+
url: 'https://rawgit.com/coderplex/learn/cdn/react/proptypes.md',
366+
},
367+
{
368+
name: 'Error Boundaries',
369+
url: 'https://rawgit.com/coderplex/learn/cdn/react/error-boundaries.md',
370+
},
371+
],
372+
},
373+
{
374+
unit: {
375+
name: 'In depth discussions',
376+
},
377+
chapters: [
378+
{
379+
name: 'JSX In Depth',
380+
url: 'https://rawgit.com/coderplex/learn/cdn/react/jsx-in-depth.md',
381+
},
382+
{
383+
name: 'Synthetic Events',
384+
url: 'https://rawgit.com/coderplex/learn/cdn/react/synthetic-events.md',
385+
},
386+
{
387+
name: 'React Without JSX',
388+
url: 'https://rawgit.com/coderplex/learn/cdn/react/react-without-jsx.md',
389+
},
390+
{
391+
name: 'React without ES6',
392+
url: 'https://rawgit.com/coderplex/learn/cdn/react/react-without-es6.md',
393+
},
394+
{
395+
name: 'Reconcilation - Diff Algorithm',
396+
url: 'https://rawgit.com/coderplex/learn/cdn/react/reconcilation---diff-algorithm.md',
397+
},
398+
],
399+
},
400+
];

0 commit comments

Comments
 (0)
This repository has been archived.