forked from rage/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTopBar.js
More file actions
46 lines (41 loc) · 1.24 KB
/
TopBar.js
File metadata and controls
46 lines (41 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from "react"
import styled from "styled-components"
import LoginControls from "./LoginControls"
import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary"
import LoginStateContext, {
withLoginStateContext,
} from "../contexes/LoginStateContext"
import Button from "./Button"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faChartLine as pointsIcon } from "@fortawesome/free-solid-svg-icons"
import CourseSettings from "../../course-settings"
const TopBarContainer = styled.div`
height: 4rem;
width: 100%;
display: flex;
justify-content: flex-end;
@media only screen and (max-width: 1200px) {
justify-content: center;
}
`
const StyledIcon = styled(FontAwesomeIcon)`
margin-right: 0.5rem;
`
class TopBar extends React.Component {
static contextType = LoginStateContext
render() {
return (
<TopBarContainer>
{CourseSettings.default.useNewPointsVisualization &&
this.context.loggedIn && (
<Button to="/progress">
<StyledIcon icon={pointsIcon} />
Pisteet
</Button>
)}
<LoginControls />
</TopBarContainer>
)
}
}
export default withSimpleErrorBoundary(withLoginStateContext(TopBar))