refactor: Lesson -> Level
This commit is contained in:
@@ -9,11 +9,11 @@ import Paper from "@material-ui/core/Paper";
|
||||
|
||||
import Scoreboard from "../components/scoreboard";
|
||||
|
||||
import { ILesson } from "../models/lesson";
|
||||
import { ILevel } from "../models/level";
|
||||
import { ILearner } from "../models/learner";
|
||||
|
||||
interface IProps {
|
||||
nextLesson: () => ILesson;
|
||||
nextLevel: () => ILevel;
|
||||
learners: ILearner[];
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export default class Dashboard extends React.Component<IProps, IState> {
|
||||
const small = window.matchMedia("(max-width: 700px)").matches;
|
||||
const direction = small ? "column" : "row";
|
||||
|
||||
const lesson = this.props.nextLesson();
|
||||
const level = this.props.nextLevel();
|
||||
|
||||
return <div>
|
||||
{
|
||||
@@ -45,16 +45,16 @@ export default class Dashboard extends React.Component<IProps, IState> {
|
||||
<Grid container direction={direction} spacing={16}>
|
||||
<Grid item lg={4}>
|
||||
<Paper className="paper">
|
||||
<Typography variant="title">{`Level ${lesson.level}`}</Typography>
|
||||
<Typography variant="title" component="p">{lesson.name}</Typography>
|
||||
<Typography variant="title">{`Level ${level.level}`}</Typography>
|
||||
<Typography variant="title" component="p">{level.name}</Typography>
|
||||
<br />
|
||||
<Typography component="p">
|
||||
{lesson.desc}
|
||||
{level.desc}
|
||||
</Typography>
|
||||
<Button className="lesson-card-btn"
|
||||
onClick={() => {
|
||||
this.setState({
|
||||
toLevel: lesson.level,
|
||||
toLevel: level.level,
|
||||
});
|
||||
}}>
|
||||
Zum Level
|
||||
|
||||
@@ -7,10 +7,10 @@ import Card from '@material-ui/core/Card';
|
||||
import CardActions from '@material-ui/core/CardActions';
|
||||
import CardContent from '@material-ui/core/CardContent';
|
||||
|
||||
import { ILesson } from "../models/lesson";
|
||||
import { ILevel } from "../models/lesson";
|
||||
|
||||
interface IProps {
|
||||
lessons: ILesson[];
|
||||
levels: ILevel[];
|
||||
}
|
||||
|
||||
export default class Dashboard extends React.Component<{}> {
|
||||
@@ -23,17 +23,17 @@ export default class Dashboard extends React.Component<{}> {
|
||||
const cName = small ? "lesson-card-xs" : "lesson-card-lg";
|
||||
|
||||
let key = 0;
|
||||
const lessonToCard = (lesson: ILesson) => {
|
||||
const levelToCard = (level: ILevel) => {
|
||||
return <Grid item key={key++}>
|
||||
<Card style={{
|
||||
width: small ? window.width - 32 : "300px"
|
||||
}}>
|
||||
<CardContent className={cName}>
|
||||
<Typography variant="title">{`Level ${lesson.level}`}</Typography>
|
||||
<Typography variant="title" component="p">{lesson.name}</Typography>
|
||||
<Typography variant="title">{`Level ${level.level}`}</Typography>
|
||||
<Typography variant="title" component="p">{level.name}</Typography>
|
||||
<br />
|
||||
<Typography component="p">
|
||||
{lesson.desc}
|
||||
{level.desc}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
<CardActions>
|
||||
@@ -46,7 +46,7 @@ export default class Dashboard extends React.Component<{}> {
|
||||
};
|
||||
|
||||
return <Grid container spacing={16} direction="row">
|
||||
{this.props.lessons.map(lessonToCard)}
|
||||
{this.props.levels.map(levelToCard)}
|
||||
</Grid>
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user