Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit 9034db6

Browse files
author
z
committed
1. bug of unit not highlighting fixed
2. margin for chapter increased on right
1 parent 90dc057 commit 9034db6

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

components/learn/syllabus-tree/syllabus-tree-component.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default class TreeView extends React.PureComponent {
4242
}
4343
4444
.chapters {
45-
padding-left: 0.4rem;
45+
padding-left: 0.8rem;
4646
}
4747
4848
.chapters-collapsed {
@@ -71,9 +71,9 @@ export default class TreeView extends React.PureComponent {
7171
return (
7272
<Container>
7373
<div
74-
className={this.props.unitTitle === this.props.activeUnit ? 'unit unit-active' : 'unit'}
74+
className={this.props.unitName === this.props.activeUnit ? 'unit unit-active' : 'unit'}
7575
onClick={this.unitClick}>
76-
{this.props.UnitTitleComponent}
76+
{this.props.UnitNameComponent}
7777
<div className={this.state.collapsed ? 'pointer pointer-collapsed' : 'pointer'} />
7878
</div>
7979
<div className={this.state.collapsed ? 'chapters chapters-collapsed' : 'chapters'}>

components/learn/syllabus-tree/syllabus-tree-container.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,27 @@ export default class SyllabusTree extends React.Component {
5959

6060
return (
6161
<Container>
62-
{this.props.data.map((node, i) => {
63-
const UnitTitleComponent = (
64-
<div className="unit_name" key={node.unit.name} onClick={() => this.handleClick(i)}>
65-
{node.unit.name}
62+
{this.props.data.map((unitNode, i) => {
63+
const UnitNameComponent = (
64+
<div className="unit_name" key={unitNode.unit.name} onClick={() => this.handleClick(i)}>
65+
{unitNode.unit.name}
6666
</div>
6767
);
6868
return (
6969
<TreeView
7070
key={i}
71-
unitTitle={node.unit.name}
72-
UnitTitleComponent={UnitTitleComponent}
71+
unitName={unitNode.unit.name}
72+
UnitNameComponent={UnitNameComponent}
7373
activeUnit={this.state.activeUnit}
7474
collapsed={this.state.nodeStateTracker[i]}
7575
onClick={() => this.handleClick(i)}>
76-
{node.chapters.map(chapter => (
76+
{unitNode.chapters.map(chapter => (
7777
<div
7878
className={`chapter ${
7979
this.state.activeChapter === chapter.url ? 'chapter-active' : 'chapter-inactive'
8080
}`}
8181
key={chapter.url}
82-
onClick={() => this.clickOnChapter(chapter)}>
82+
onClick={() => this.clickOnChapter(chapter, unitNode.unit.name)}>
8383
{chapter.name}
8484
</div>
8585
))}

pages/learn/subject.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import SubjectMarkdown from '../../components/learn/subject-marked';
1212

1313
import { laravelSyllabus } from '../../utils/mock-data';
1414

15-
const defaultChapter = laravelSyllabus[0].chapters[0];
16-
1715
const CurriculumSection = styled.section`
1816
${baseContainer};
1917
${space};
@@ -34,12 +32,14 @@ const CurriculumSection = styled.section`
3432
}
3533
`;
3634

35+
const defaultChapter = laravelSyllabus[0].chapters[0];
36+
3737
export default class Subject extends React.Component {
3838
constructor(props) {
3939
super(props);
4040
this.state = {
4141
activeChapterContent: '',
42-
activeChapterName: '',
42+
activeChapterName: defaultChapter.name,
4343
loading: true,
4444
};
4545
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy