Skip to content

Commit a11bcec

Browse files
committed
Small fixes
1 parent 2be0ef8 commit a11bcec

3 files changed

Lines changed: 9 additions & 36 deletions

File tree

src/components/TreeView/TreeViewItem.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Location } from '@reach/router'
1212
const ChildrenList = styled.ul`
1313
height: calc(var(--open-ratio) * var(--calculated-height) * 1px);
1414
overflow: hidden;
15+
margin-left: 0;
1516
`
1617

1718
const ListItem = styled.li`
@@ -22,6 +23,7 @@ const ListItem = styled.li`
2223
`
2324

2425
const NavigationLink = styled(GatsbyLink)`
26+
padding-left: 0.5rem;
2527
${props => props.active == "t" && `
2628
background-color: #ffccc6;
2729
width: 100%;
@@ -101,7 +103,7 @@ export default class TreeViewItem extends React.Component {
101103
<NavigationLink
102104
to={this.props.item.href}
103105
active={
104-
this.props.item.href == location.pathname ? 't' : 'f'
106+
(this.props.item.href == location.pathname || this.props.item.href == location.pathname.slice(0, -1)) ? 't' : 'f'
105107
}
106108
>
107109
<ListItem onClick={this.onClick}>

src/components/TreeView/index.js

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,19 @@
11
import React from 'react'
22
import TreeViewItem from './TreeViewItem'
33
import styled from 'styled-components'
4-
import Scrollspy from 'react-scrollspy'
54

65
const StyledUl = styled.ul`
7-
margin-left: 0rem;
6+
margin-left: 0;
87
`
98

109
export default class TreeView extends React.Component {
1110
render() {
1211
return (
13-
<Scrollspy
14-
items={['yleistä', 'kurssin-kaksi-versiota', 'sisältö-ja-aikataulu']}
15-
currentClassName="is-current"
16-
onUpdate={element => {
17-
document
18-
.querySelectorAll('.active-section')
19-
.forEach(e => e.classList.remove('active-section'))
20-
const selector = element.id
21-
const current = document.querySelectorAll(`.nav-item-${selector}`)
22-
current.forEach(e => e.classList.add('active-section'))
23-
24-
}}
25-
>
26-
<StyledUl>
27-
{this.props.data.map(top => <TreeViewItem key={top.name} item={top} spy />)}
28-
</StyledUl>
29-
</Scrollspy>
12+
<StyledUl>
13+
{this.props.data.map(top => (
14+
<TreeViewItem key={top.name} item={top} spy />
15+
))}
16+
</StyledUl>
3017
)
3118
}
3219
}

src/pages/index.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,6 @@ const IndexPage = () => (
200200
</p>
201201
</section>
202202

203-
<section id="kurssi-vaylana">
204-
<h2>Ohjelmoinnin MOOC väylänä yliopistoon</h2>
205-
206-
<p>
207-
Ohjelmoinnin MOOC toimii väylänä yliopistoon. Suorittamalla Ohjelmoinnin
208-
MOOCin jokaisen osan tehtävistä yli 90 % annetussa aikataulussa, saat
209-
kutsun Helsingin yliopistolla järjestettävään näyttökokeeseen. Näyttökokeessa
210-
tehdään kurssin laajempia tehtäviä vastaava ohjelmointitehtävä sekä vastataan
211-
muutamaan esseetyyppiseen kysymykseen.
212-
</p>
213-
214-
<p>
215-
Ohjelmoinnin MOOC on osa yhteishakua. Lisäämme tänne yhteishaun lähestyessä
216-
ohjeita yhteishakulomakkeen täyttämiseen.
217-
</p>
218-
</section>
219203
</Layout>
220204
</ContentArea>
221205
</Fragment>

0 commit comments

Comments
 (0)