Skip to content

Commit cf56d9c

Browse files
committed
Adding basic Mithril Game component
1 parent 744cc43 commit cf56d9c

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

app/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44
<title>Blue Lagoon</title>
55
</head>
66
<body>
7-
<div id="app"></div>
8-
<script src="build/bundle.js"></script>
97
</body>
108
</html>

app/src/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
import m from "mithril";
2-
m.render(document.getElementById('app'), "Blu");
2+
import Game from './views/Game';
3+
4+
m.render(
5+
document.body,
6+
m('main', [
7+
m('h1', 'Blue Lagoon'),
8+
m(Game)
9+
])
10+
);

app/src/models/Game.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
const Game = {
3+
size: 4
4+
};
5+
6+
export default Game;

app/src/views/Game.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import m from 'mithril';
2+
import GameModel from '../models/Game';
3+
4+
class GameView {
5+
view() {
6+
return m('.game', m('h2', `Starting Game of ${GameModel.size}`));
7+
}
8+
}
9+
10+
export default GameView;

0 commit comments

Comments
 (0)